if j == 4: bot_modules += "|{:<15}|\n".format(i) j = 0 else: bot_modules += "|{:<15}".format(i) j += 1 print("+===============================================================+") print("| WBB - Modules |") print("+===============+===============+===============+===============+") print(bot_modules) print("+===============+===============+===============+===============+") print("Bot Started Successfully as {}!".format(botinfo.BOT_NAME)) await idle() @app.on_message(cust_filter.command("start")) async def start(client, message): if message.chat.type != "private": await message.reply_text((await random_line("wbb/utils/start.txt"))) return await message.reply("Hi, try /help") @app.on_message(cust_filter.command("help")) async def help_command(_, message): if message.chat.type != "private": if len(message.command) >= 2 and message.command[1] == "help": text, keyboard = await help_parser(message) await message.reply(text, reply_markup=keyboard, disable_web_page_preview=True)
import youtube_dl from pyrogram import filters from pyrogram.types import Message from wbb.utils import cust_filter from wbb import app __MODULE__ = "Music" __HELP__ = "/music [link] To Download Music From Various Websites" ydl_opts = { 'format': 'bestaudio', 'writethumbnail': True } @app.on_message(cust_filter.command(commands=("music")) & ~filters.edited) async def music(_, message: Message): if len(message.command) != 2: await message.reply_text("`/music` needs a link as argument") return link = message.text.split(None, 1)[1] m = await message.reply_text(f"Downloading {link}", disable_web_page_preview=True) try: with youtube_dl.YoutubeDL(ydl_opts) as ydl: info_dict = ydl.extract_info(link, download=False) audio_file = ydl.prepare_filename(info_dict) ydl.process_info(info_dict) # .webm -> .weba basename = audio_file.rsplit(".", 1)[-2] thumbnail_url = info_dict['thumbnail']
__MODULE__ = "Music" __HELP__ = "/music [link] To Download Music From Various Websites" ydl_opts = { 'format': 'bestaudio/best', 'writethumbnail': True, 'postprocessors': [{ 'key': 'FFmpegExtractAudio', 'preferredcodec': 'mp3', 'preferredquality': '192' }] } @app.on_message(cust_filter.command(commands=("music")) & ~filters.edited & filters.user(SUDOERS)) async def music(_, message: Message): if len(message.command) != 2: await message.reply_text("`/music` needs a link as argument") return link = message.text.split(None, 1)[1] m = await message.reply_text(f"Downloading {link}", disable_web_page_preview=True) try: with youtube_dl.YoutubeDL(ydl_opts) as ydl: info_dict = ydl.extract_info(link, download=False) audio_file = ydl.prepare_filename(info_dict) ydl.process_info(info_dict) # .webm -> .weba basename = audio_file.rsplit(".", 1)[-2] thumbnail_url = info_dict['thumbnail']
from wbb.utils.errors import capture_err from wbb import app, OWNER_ID, SUDO_USER_ID, bot_start_time, NEOFETCH, JSMAPI __MODULE__ = "Sudoers" __HELP__ = '''/log - To Get Logs From Last Run. /speedtest - To Perform A Speedtest. /stats - To Check System Status. /song - To Download Songs From JioSaavn''' SUDOERS = [OWNER_ID, SUDO_USER_ID] # Logs Module @app.on_message(filters.user(SUDOERS) & cust_filter.command("log")) @capture_err async def logs_chat(_, message: Message): keyb = types.InlineKeyboardMarkup( [ [ types.InlineKeyboardButton( "Paste on Nekobin", callback_data="paste_log_nekobin" ) ] ] ) await message.reply_document( "error.log", reply_markup=keyb )
# Get List Of Members In A Chat async def list_members(group_id): list_of_members = [] async for member in app.iter_chat_members(group_id): list_of_members.append(member.user.id) return list_of_members # Purge Messages @app.on_message(cust_filter.command(commands=("purge")) & ~filters.edited) @capture_err async def purge(client, message: Message): message_ids = [] if message.chat.type not in ("supergroup", "channel"): return admins = await list_admins(message.chat.id) if message.from_user.id in admins \ or message.from_user.id in SUDO: chat_id = message.chat.id from_user_id = message.from_user.id if (await app.get_chat_member(chat_id, from_user_id)).can_delete_messages \
import requests as r from pyrogram.types import Message from pyrogram import filters from wbb import app from wbb.utils import cust_filter from wbb.utils.errors import capture_err __MODULE__ = "Reddit" __HELP__ = "/reddit [query] - results something from reddit" @app.on_message(cust_filter.command(commands=("reddit")) & ~filters.edited) @capture_err async def reddit(_, message: Message): if len(message.command) != 2: await message.reply_text("/reddit needs an argument") return subreddit = message.command[1] res = r.get(f"https://meme-api.herokuapp.com/gimme/{subreddit}") res = res.json() rpage = res.get(str("subreddit")) # Subreddit title = res.get(str("title")) # Post title memeu = res.get(str("url")) # meme pic url plink = res.get(str("postLink")) caps = f"<b>Title</b>: {title}\n" caps += f"<b>Subreddit: </b>r/{rpage}\n" caps += f"<b>PostLink:</b> {plink}" await message.reply_photo(photo=memeu, caption=(caps))
from wbb import app from wbb.utils import cust_filter import requests __MODULE__ = "Ping" __HELP__ = " /ping - To Get Response Time From All TG Datacenters" @app.on_message(cust_filter.command(commands=("ping"))) async def ping(client, message): app.set_parse_mode("markdown") m = await message.reply_text("```Wait, Pinging all Datacenters```") result = "" for i in range(1, 6): dc = (f"https://cdn{i}.telesco.pe") ping1 = round(requests.head(dc).elapsed.total_seconds() * 1000) result += f'```DC{i} - {ping1}ms```' await m.edit(result)
__MODULE__ = "Misc" __HELP__ = '''/commit - Generate Funny Commit Messages /runs - Idk Test Yourself /id - Get Chat_ID or User_ID /random - Generate Random Complex Passwords /encrypt - Encrypt Text [Can Only Be Decrypted By This Bot] /decrypt - Decrypt Text /cheat - Get Programming Related Help /weather - To Get Weather Info /tr [en] - Translate A Message /json [URL] - Get Response From An API or Something. #RTFM - Check it lol''' @app.on_message(cust_filter.command(commands=("commit")) & ~filters.edited) @capture_err async def commit(_, message: Message): await message.reply_text((await random_line('wbb/utils/commit.txt'))) @app.on_message(filters.command("RTFM", "#")) @capture_err async def rtfm(_, message): await message.delete() if not message.reply_to_message: await message.reply_text("Reply To A Message lol") return await message.reply_to_message.reply_text( "Are You Lost? READ THE F*****G DOCS!")
from wbb import app from wbb.utils import cust_filter, random_line __MODULE__ = "Commit" __HELP__ = "/commit - To Generate Funny Commit Messages" @app.on_message(cust_filter.command(commands=("commit"))) async def commit(client, message): await message.reply_text((await random_line('wbb/utils/commit.txt')))
from pyrogram.types import Message from wbb.utils import cust_filter from wbb import app, WALL_API_KEY from wbb.utils.errors import capture_err __MODULE__ = "Images" __HELP__ = '''/cat - Get Cute Cats Images /wall - Get Wallpapers''' async def delete_message_with_delay(delay, message: Message): await asyncio.sleep(delay) await message.delete() @app.on_message(cust_filter.command(commands=("cat")) & ~filters.edited) @capture_err async def cat(_, message: Message): with urllib.request.urlopen( "https://api.thecatapi.com/v1/images/search" ) as url: data = json.loads(url.read().decode()) cat_url = (data[0]['url']) await message.reply_photo(cat_url) @app.on_message(cust_filter.command(commands=("wall")) & ~filters.edited) @capture_err async def wall(_, message: Message): if len(message.command) < 2: await message.reply_text("/wall needs an argument")
import os from pyrogram import filters from pyrogram.types import Message from wbb.utils import cust_filter, nekobin from wbb.utils.errors import capture_err from wbb import app __MODULE__ = "Paste" __HELP__ = "/paste - To Paste Replied Text Or Document To Neokobin" @app.on_message(cust_filter.command(commands=("paste")) & ~filters.edited) @capture_err async def paste(_, message: Message): if bool(message.reply_to_message) is True: app.set_parse_mode("markdown") if bool(message.reply_to_message.text) is True: m = await message.reply_text("```Pasting To Nekobin...```") message_get = message.reply_to_message.text message_as_str = str(message_get) paste_link = await nekobin.neko(message_as_str) final_link = f"[Nekobin]({paste_link})" await m.edit(final_link, disable_web_page_preview=True) elif bool(message.reply_to_message.document) is True: m = await message.reply_text("```Pasting To Nekobin...```") await message.reply_to_message.download(file_name='paste.txt') i = open("downloads/paste.txt", "r") paste_link = await nekobin.neko(i.read()) os.remove('downloads/paste.txt') final_link = f"[Nekobin]({paste_link})"
ydl_opts = { 'format': 'bestaudio/best', 'writethumbnail': True, 'postprocessors': [{ 'key': 'FFmpegExtractAudio', 'preferredcodec': 'mp3', 'preferredquality': '192' }] } @app.on_message( cust_filter.command(commands=("music")) & ~filters.edited & filters.user(SUDOERS)) @capture_err async def music(_, message: Message): if len(message.command) != 2: await message.reply_text("`/music` needs a link as argument") return link = message.text.split(None, 1)[1] m = await message.reply_text(f"Downloading {link}", disable_web_page_preview=True) try: with youtube_dl.YoutubeDL(ydl_opts) as ydl: info_dict = ydl.extract_info(link, download=False) audio_file = ydl.prepare_filename(info_dict) ydl.process_info(info_dict) # .webm -> .weba
from search_engine_parser import GoogleSearch from pyrogram.types import Message from pyrogram import filters from requests import get from wbb import app from wbb.utils import cust_filter __MODULE__ = "Search" __HELP__ = '''/ud - Search For Something In Urban Dictionary /google - Search For Something On Google /yt - Search For Something On YouTube''' # ud - urbandictionary @app.on_message(cust_filter.command(commands=("ud")) & ~filters.edited) async def urbandict(_, message: Message): if len(message.command) < 2: await message.reply_text('"/ud" Needs An Argument.') return text = message.text.split(None, 1)[1] api = "http://api.urbandictionary.com/v0/define?term=" try: results = get(f"{api}{text}").json() reply_text = f'Definition: {results["list"][0]["definition"]}' reply_text += f'\n\nExample: {results["list"][0]["example"]}' except IndexError: reply_text = ("Sorry could not find any matching results!") ignore_chars = "[]" reply = reply_text
from wbb import app from wbb.utils import cust_filter import requests __MODULE__ = "Repo" __HELP__ = "/repo - To Get My Github Repository Link" api = 'https://api.github.com/repos/thehamkercat/' \ 'WilliamButcherBot/stats/contributors' print(api) @app.on_message(cust_filter.command(commands=("repo"))) async def repo(client, message): app.set_parse_mode("markdown") profile_url = [] username = [] # Get The List Of Usernames And Profile Url for item in requests.get(api).json(): profile_url.append(f"{item['author']['html_url']}") username.append(f"{item['author']['login']}") # Join Usernames And Profile Url For Markdown no_of_contributors = len(username) i = 0 n = 1 contributors = "" while i < no_of_contributors: contributors += f"[{n}. {username[i]}]({profile_url[i]})\n"
import asyncio from wbb.utils import cust_filter from wbb import app from wbb.utils.is_admin import is_admin __MODULE__ = "Admin" __HELP__ = ''' /purge - Purge Messages [Limit = 100] ''' @app.on_message(cust_filter.command(commands=("purge"))) async def purge(client, message): app.set_parse_mode("markdown") if message.chat.type not in (("supergroup", "channel")): return admin = await is_admin(message) if not admin: return message_ids = [] if message.reply_to_message: for a_s_message_id in range( message.reply_to_message.message_id, message.message_id ): message_ids.append(a_s_message_id)