This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`**") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from translate import Translator | |
translator = Translator(to_lang="bn") | |
text = "welcome" | |
translated_text = translator.translate(text) | |
print(translated_text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import moviepy.editor | |
from pathlib import Path | |
video_file = Path('video.mp4') | |
video = moviepy.editor.VideoFileClip(f'{video_file}') | |
audio = video.audio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import os | |
from pathlib import Path | |
from PyPDF2 import PdfFileMerger | |
def convert_images_to_pdf(folder_path, output_file): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from threading import Thread | |
app = Flask('') | |
@app.route('/') | |
def home(): | |
return "Hello. I am alive!" | |
def run(): |