Skip to content

Instantly share code, notes, and snippets.

View Hunter87ff's full-sized avatar
🎯
Focusing

hunter87 Hunter87ff

🎯
Focusing
View GitHub Profile
@bot.group(invoke_without_command=True)
async def help(ctx):
invite_btn = Button(label="Invite Me", url="https://sprucebot.ml/invite")
vote_btn = Button(label="Vote Me", url="https://discord.ly/spruce/upvote")
btns = [invite_btn, vote_btn]
view = View()
for btn in btns:
view.add_item(btn)
emb = emd(title="Help Command", color=0xff0000, description=helpdsk)
@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_bot_uptime.py
Created September 17, 2022 13:44
Discord.py Bot Uptime Command
import ctypes
@bot.command()
async def uptime(ctx):
lib = ctypes.windll.kernel32
t = lib.GetTickCount64()
t = int(str(t)[:-3])
mins, sec = divmod(t, 60)
hour, mins = divmod(mins, 60)
days, hour = divmod(hour, 24)
return await ctx.reply(f"\🟢 Online For `{days:02}D {hour:02}H {mins:02}M`")
@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 flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "Hello. I am alive!"
def run():
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()
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")