Skip to content

Instantly share code, notes, and snippets.

View Hunter87ff's full-sized avatar
🎯
Focusing

hunter87 Hunter87ff

🎯
Focusing
View GitHub Profile
@Hunter87ff
Hunter87ff / shash_cog.py
Created April 4, 2023 07:11
add slash command in commands.Cog
import discord
from discord.ext import commands
from discord import app_commands, Interaction
class Slash(commands.Cog):
def __init__(self, bot):
self.bot = bot
#self.tree = app_commands.CommandTree(self)
@Hunter87ff
Hunter87ff / onetime_url.py
Created April 1, 2023 04:25
generate onetime form till submit
from flask import Flask, render_template, request, jsonify, redirect, url_for
import json
#from threading import Thread
import datetime
import secrets
#token = secrets.token_hex(16)
app = Flask(__name__)
@Hunter87ff
Hunter87ff / bot_uptime.py
Created March 31, 2023 07:04
provide the uptime of a bot
async def uptime(self, ctx):
try:
sch = self.bot.get_channel(log_channel_id) #channel where the bot send message on_ready
except:
return
messages = [message async for message in sch.history(limit=3)]
uptime = ctx.message.created_at - messages[0].created_at
upt = str(uptime).split(".")[0]
try:
await ctx.send(f"**Current Uptime Is - `{upt} h`**")
@Hunter87ff
Hunter87ff / translator.py
Created March 30, 2023 15:05
eng to all lang translate
from translate import Translator
translator = Translator(to_lang="bn")
text = "welcome"
translated_text = translator.translate(text)
print(translated_text)
@Hunter87ff
Hunter87ff / mp423.py
Created March 10, 2023 10:35
Video 2 Audio
import moviepy.editor
from pathlib import Path
video_file = Path('video.mp4')
video = moviepy.editor.VideoFileClip(f'{video_file}')
audio = video.audio
@Hunter87ff
Hunter87ff / jpg2pdf.py
Created March 10, 2023 10:32
Image to pdf converter
from PIL import Image
import os
from pathlib import Path
from PyPDF2 import PdfFileMerger
def convert_images_to_pdf(folder_path, output_file):
@Hunter87ff
Hunter87ff / mp3_extract.py
Created March 8, 2023 15:38
get mp3 link from search query
import requests
from bs4 import BeautifulSoup
def fetch_audio(url):
data = requests.get(url).content
soup = BeautifulSoup(data,'html')
images = soup.findAll('source')
for image in images:
img_url = image.get('src')
async def reply(message, check=None):
ctx = await bot.get_context(message)
check = check or (lambda m: m.channel == ctx.channel and m.author == ctx.author)
try:
msg = await ctx.bot.wait_for("message", check=check)
except asyncio.TimeoutError:
return await ctx.send("Time Out! Try Again")
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
tokens = []
driver = webdriver.Chrome(executable_path='C:/Users/abc/Desktop/bot setup/server_mod/chromedriver.exe')
def tokenLogin():
print('STATUS : [LOGIN WITH TOKEN]')
opts = webdriver.ChromeOptions()
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "Hello. I am alive!"
def run():