Skip to content

Instantly share code, notes, and snippets.

View Hunter87ff's full-sized avatar

Hunter87 Hunter87ff

View GitHub Profile
@Hunter87ff
Hunter87ff / reaction_role.py
Created September 12, 2022 15:34
Reaction Role (support custom emoji) with discord.py
# Note: You can use database to store values
# Only Custom emoji Supported
@bot.command()
async def rr_add(ctx, channel : discord.TextChannel, role :discord.Role, message_id : int, emoji:discord.Emoji):
message = await channel.fetch_message(message_id)
await message.add_reaction(emoji)
if emch.is_emoji(emoji):
@Hunter87ff
Hunter87ff / discord-py-dashboard.py
Created October 24, 2022 09:04
discord bot dashboard in python
#pip install quart
#pip install Quart-Discord
#pip install discord-ext-ipc
from quart import Quart, render_template, url_for, redirect
import quart_discord
from quart_discord import DiscordOAuth2Session , requires_authorization, Unauthorized
from discord.ext import ipc
@Hunter87ff
Hunter87ff / file_extract.py
Created October 26, 2022 14:52
Extract Image from Website
#author: hunter87ff
#author_url: https://github.com/hunter87ff
import request as rq
def extract(url: str, type:str): #example - .mp3, .jpg, .mp4, .png etc.
val = str(rq.get(url).content).split()
for i in val:
if type in i:
return i
@Hunter87ff
Hunter87ff / generator.py
Created November 12, 2022 13:00
Redeem Code Generator In Python
import random as rn
#pip install random
def code_gen():
CL = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L','1', '2', '3', '4', '5', '6', '7', '8', '9', '0','M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
code = rn.choice(CL) + rn.choice(CL) + rn.choice(CL) + rn.choice(CL) + rn.choice(CL) + rn.choice(CL) + rn.choice(CL) + rn.choice(CL) + rn.choice(CL) + rn.choice(CL)
return code
@Hunter87ff
Hunter87ff / fetch_title.py
Last active November 19, 2022 13:19
YT Title extract in python
import requests
from bs4 import BeautifulSoup as bfs
def fetch_title(url: str):
if "https://youtu.be/" not in url:
return print("Please Enter A Valid Link")
reqs = requests.get(url)
soup = bfs(reqs.text, 'html.parser')
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()
@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')
@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 / 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 / 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)