├── runtime.txt ├── Procfile ├── Aptfile ├── userbot ├── images │ ├── al.JPG │ ├── ia.JPG │ ├── ma.JPG │ ├── sa.JPG │ ├── astf.JPG │ ├── dmf.gif │ ├── dumb.jpg │ ├── fast.jpg │ ├── lust.gif │ ├── omg.gif │ ├── tfb.jpg │ ├── killua.gif │ ├── sob_im_in.jpg │ ├── intelligence.jpg │ ├── summoned_cat.jpg │ └── skyrim_background.png ├── fonts │ └── impact.ttf ├── __main__.py ├── helpers │ ├── expand.py │ ├── spacex.py │ ├── spotify.py │ ├── aiohttp_helper.py │ ├── interval.py │ ├── PyroHelpers.py │ ├── skyrim.py │ ├── adminHelpers.py │ ├── utility.py │ ├── file_sending_helpers.py │ └── constants.py ├── plugins │ ├── to_saved.py │ ├── unread.py │ ├── subreddit_link.py │ ├── screenshot.py │ ├── autoscroll.py │ ├── pats.py │ ├── thispersonandcatdoesnotexist.py │ ├── spam.py │ ├── quotly.py │ ├── weather.py │ ├── urbandictionary.py │ ├── metrics.py │ ├── unsplash.py │ ├── vulgar.py │ ├── memes │ │ ├── scam.py │ │ ├── dhivehi.py │ │ ├── skyrim.py │ │ ├── emoji.py │ │ ├── some-random-api │ │ │ ├── animu.py │ │ │ └── animals.py │ │ ├── text_apis.py │ │ ├── stickers.py │ │ ├── fixed_memes.py │ │ └── text.py │ ├── nekobin.py │ ├── mention.py │ ├── lyrics.py │ ├── help.py │ ├── hacker │ │ ├── dirbuster.py │ │ ├── addmember.py │ │ └── hashcracker.py │ ├── music.py │ ├── admin │ │ ├── pin.py │ │ ├── set_group_pic.py │ │ └── administrator.py │ ├── spacex.py │ ├── git_commands.py │ ├── corona.py │ ├── afk.py │ ├── whois.py │ ├── file_manager │ │ └── handlers.py │ ├── 1start.py │ └── handlers.py ├── __init__.py ├── userbot.py └── utils.py ├── heroku.yml ├── mrrobot ├── .deepsource.toml ├── .gitignore ├── requirements.txt ├── app.json └── README.md /runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.9.1 2 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: python3 -m userbot 2 | -------------------------------------------------------------------------------- /Aptfile: -------------------------------------------------------------------------------- 1 | pv 2 | tree 3 | mediainfo 4 | p7zip-full 5 | -------------------------------------------------------------------------------- /userbot/images/al.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/al.JPG -------------------------------------------------------------------------------- /userbot/images/ia.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/ia.JPG -------------------------------------------------------------------------------- /userbot/images/ma.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/ma.JPG -------------------------------------------------------------------------------- /userbot/images/sa.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/sa.JPG -------------------------------------------------------------------------------- /userbot/fonts/impact.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/fonts/impact.ttf -------------------------------------------------------------------------------- /userbot/images/astf.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/astf.JPG -------------------------------------------------------------------------------- /userbot/images/dmf.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/dmf.gif -------------------------------------------------------------------------------- /userbot/images/dumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/dumb.jpg -------------------------------------------------------------------------------- /userbot/images/fast.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/fast.jpg -------------------------------------------------------------------------------- /userbot/images/lust.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/lust.gif -------------------------------------------------------------------------------- /userbot/images/omg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/omg.gif -------------------------------------------------------------------------------- /userbot/images/tfb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/tfb.jpg -------------------------------------------------------------------------------- /heroku.yml: -------------------------------------------------------------------------------- 1 | build: 2 | docker: 3 | worker: Dockerfile 4 | run: 5 | worker: python3 -m userbot 6 | -------------------------------------------------------------------------------- /userbot/images/killua.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/killua.gif -------------------------------------------------------------------------------- /userbot/images/sob_im_in.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/sob_im_in.jpg -------------------------------------------------------------------------------- /userbot/images/intelligence.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/intelligence.jpg -------------------------------------------------------------------------------- /userbot/images/summoned_cat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/summoned_cat.jpg -------------------------------------------------------------------------------- /userbot/images/skyrim_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/HEAD/userbot/images/skyrim_background.png -------------------------------------------------------------------------------- /mrrobot: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pip3 install --upgrade pip setuptools 4 | 5 | sudo pip3 install -U -r requirements.txt 6 | 7 | python3 -m userbot 8 | -------------------------------------------------------------------------------- /.deepsource.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[analyzers]] 4 | name = "python" 5 | enabled = true 6 | 7 | [analyzers.meta] 8 | runtime_version = "3.x.x" -------------------------------------------------------------------------------- /userbot/__main__.py: -------------------------------------------------------------------------------- 1 | import userbot 2 | from userbot import UserBot 3 | 4 | 5 | if __name__ == "__main__": 6 | userbot.client = UserBot 7 | 8 | 9 | UserBot.run() 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Dockerfile 2 | venv/ 3 | .idea/ 4 | .env 5 | *.session 6 | *.session-journal 7 | __pycache__/ 8 | userbot.ini 9 | unknown_errors.txt 10 | file_ids.txt 11 | .cache-* 12 | privousdockerfile 13 | 14 | -------------------------------------------------------------------------------- /userbot/helpers/expand.py: -------------------------------------------------------------------------------- 1 | import aiohttp 2 | 3 | 4 | async def expand_url(url): 5 | async with aiohttp.ClientSession() as session: 6 | async with session.get(f"http://expandurl.com/api/v1/?url={url}") as resp: 7 | expanded = await resp.text() 8 | 9 | return expanded if expanded != "false" and expanded[:-1] != url else None 10 | -------------------------------------------------------------------------------- /userbot/helpers/spacex.py: -------------------------------------------------------------------------------- 1 | import aiohttp 2 | 3 | 4 | class Spacex: 5 | @staticmethod 6 | async def get(latest_or_next): 7 | async with aiohttp.ClientSession() as session: 8 | async with session.get( 9 | f"https://api.spacexdata.com/v3/launches/{latest_or_next}" 10 | ) as resp: 11 | data = await resp.json() 12 | return data 13 | 14 | async def latest(self): 15 | return await self.get("latest") 16 | 17 | async def next(self): 18 | return await self.get("next") 19 | -------------------------------------------------------------------------------- /userbot/plugins/to_saved.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | from pyrogram.types import Message 3 | from userbot import UserBot 4 | from userbot.plugins.help import add_command_help 5 | 6 | 7 | @UserBot.on_message(filters.command("s", ".") & filters.me) 8 | async def to_saved(_, message: Message): 9 | await message.delete() 10 | await message.reply_to_message.forward("self") 11 | 12 | 13 | # Command help section 14 | add_command_help( 15 | "save", 16 | [ 17 | ["s", "Reply to any message and instantly send it to your saved messages."], 18 | ], 19 | ) 20 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | aiofiles==0.6.0 2 | aiohttp==3.7.3 3 | async-lru==1.0.2 4 | async-timeout==3.0.1 5 | attrs==20.3.0 6 | certifi==2020.12.5 7 | chardet==3.0.4 8 | cssselect2==0.4.1 9 | gitdb==4.0.5 10 | GitPython==3.1.12 11 | humanize==3.2.0 12 | idna==2.10 13 | lxml==4.6.2 14 | multidict==5.1.0 15 | Pillow==8.1.0 16 | prettytable==2.0.0 17 | psutil==5.8.0 18 | pyaes==1.6.1 19 | Pyrogram==1.1.13 20 | PySocks==1.7.1 21 | python-magic==0.4.18 22 | reportlab==3.5.59 23 | requests==2.25.1 24 | smmap==3.0.5 25 | svglib==1.0.1 26 | TgCrypto==1.2.2 27 | thisapidoesnotexist==0.2 28 | tinycss2==1.1.0 29 | typing-extensions==3.7.4.3 30 | urllib3==1.26.3 31 | wcwidth==0.2.5 32 | webencodings==0.5.1 33 | yarl==1.6.3 34 | -------------------------------------------------------------------------------- /userbot/helpers/spotify.py: -------------------------------------------------------------------------------- 1 | import spotipy 2 | import spotipy.util as util 3 | from userbot import SPOTIFY_USERNAME, SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET 4 | 5 | redirect_uri = "http://localhost:8888/callback" 6 | scope = 'user-read-currently-playing' 7 | 8 | 9 | async def now_playing(): 10 | if [x for x in (SPOTIFY_USERNAME, SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET) if x is None]: 11 | return "API details not set" 12 | 13 | token = util.prompt_for_user_token( 14 | SPOTIFY_USERNAME, scope, SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET, redirect_uri) 15 | 16 | spotify = spotipy.Spotify(auth=token) 17 | 18 | current_track = spotify.currently_playing() 19 | return current_track 20 | -------------------------------------------------------------------------------- /userbot/__init__.py: -------------------------------------------------------------------------------- 1 | import ast 2 | import logging 3 | import os 4 | from configparser import ConfigParser 5 | from datetime import datetime 6 | 7 | from userbot.userbot import UserBot 8 | 9 | name = "userbot" 10 | 11 | if bool(os.environ.get("ENV", False)): 12 | # Pyrogram details 13 | API_ID = os.environ.get("API_ID", None) 14 | API_HASH = os.environ.get("API_HASH", None) 15 | USERBOT_SESSION = os.environ.get("USERBOT_SESSION", None) 16 | 17 | 18 | 19 | # Extra details 20 | __version__ = "0.1.0" 21 | __author__ = "AK HACKER" 22 | 23 | # Global Variables 24 | CMD_HELP = {} 25 | client = None 26 | START_TIME = datetime.now() 27 | 28 | UserBot = UserBot(name) 29 | 30 | 31 | # from pyrogram import __version__ 32 | -------------------------------------------------------------------------------- /userbot/plugins/unread.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import filters 4 | from pyrogram.raw import functions 5 | from pyrogram.types import Message 6 | 7 | from userbot import UserBot 8 | from userbot.plugins.help import add_command_help 9 | 10 | 11 | @UserBot.on_message(filters.command(["unread", "un"], ".") & filters.me) 12 | async def mark_chat_unread(_, message: Message): 13 | await asyncio.gather( 14 | message.delete(), 15 | UserBot.send( 16 | functions.messages.MarkDialogUnread( 17 | peer=await UserBot.resolve_peer(message.chat.id), unread=True 18 | ) 19 | ), 20 | ) 21 | 22 | 23 | # Command help section 24 | add_command_help( 25 | "chat", 26 | [ 27 | [".unread", "Mark chat as unread."], 28 | ], 29 | ) 30 | -------------------------------------------------------------------------------- /userbot/plugins/subreddit_link.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | from pyrogram.types import Message 3 | from userbot import UserBot 4 | from userbot.plugins.help import add_command_help 5 | 6 | the_regex = r"^r\/([^\s\/])+" 7 | 8 | 9 | # Generate full Reddit link with subreddit 10 | @UserBot.on_message(filters.regex(the_regex) & filters.me) 11 | async def subreddit_link(_, message: Message): 12 | html = "{string}" 13 | await message.edit( 14 | html.format(link="https://reddit.com/" + message.text, string=message.text), 15 | disable_web_page_preview=True, 16 | parse_mode="html", 17 | ) 18 | 19 | 20 | # Command help section 21 | add_command_help( 22 | "reddit", 23 | [ 24 | [ 25 | "r/telegram", 26 | "As long as your message starts with r/, it will automatically generate a subreddit link and " 27 | "hyperlink your message.", 28 | ], 29 | ], 30 | ) 31 | -------------------------------------------------------------------------------- /userbot/plugins/screenshot.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import filters 4 | from pyrogram.raw import functions 5 | from pyrogram.types import Message 6 | 7 | from userbot import UserBot 8 | from userbot.plugins.help import add_command_help 9 | 10 | 11 | @UserBot.on_message( 12 | filters.command(["screenshot", "ss"], ".") & filters.private & filters.me 13 | ) 14 | async def screenshot(_, message: Message): 15 | await asyncio.gather( 16 | message.delete(), 17 | UserBot.send( 18 | functions.messages.SendScreenshotNotification( 19 | peer=await UserBot.resolve_peer(message.chat.id), 20 | reply_to_msg_id=0, 21 | random_id=UserBot.rnd_id(), 22 | ) 23 | ), 24 | ) 25 | 26 | 27 | # Command help section 28 | add_command_help( 29 | "screenshot", 30 | [ 31 | [ 32 | ".screenshot", 33 | "Send a notification in a private chat (not secret) to annoy or troll your friends.", 34 | ], 35 | ], 36 | ) 37 | -------------------------------------------------------------------------------- /userbot/plugins/autoscroll.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | from pyrogram.types import Message 3 | 4 | from userbot import UserBot 5 | from userbot.plugins.help import add_command_help 6 | 7 | the_regex = r"^r\/([^\s\/])+" 8 | 9 | f = filters.chat([]) 10 | 11 | 12 | @UserBot.on_message(f) 13 | async def auto_read(_, message: Message): 14 | await UserBot.read_history(message.chat.id) 15 | message.continue_propagation() 16 | 17 | 18 | @UserBot.on_message(filters.command("autoscroll", ".") & filters.me) 19 | async def add_to_auto_read(_, message: Message): 20 | if message.chat.id in f: 21 | f.remove(message.chat.id) 22 | await message.edit("Autoscroll deactivated") 23 | else: 24 | f.add(message.chat.id) 25 | await message.edit("Autoscroll activated") 26 | 27 | 28 | # Command help section 29 | add_command_help( 30 | "autoscroll", 31 | [ 32 | [ 33 | ".autoscroll", 34 | "Send .autoscroll in any chat to automatically read all sent messages until you call " 35 | "autoscroll again. This is useful if you have Telegram open on another screen.", 36 | ], 37 | ], 38 | ) 39 | -------------------------------------------------------------------------------- /userbot/plugins/pats.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | import aiohttp 4 | from pyrogram import filters 5 | from pyrogram.types import Message 6 | from userbot import UserBot 7 | from userbot.helpers.PyroHelpers import ReplyCheck, GetChatID 8 | from userbot.plugins.help import add_command_help 9 | 10 | 11 | @UserBot.on_message(filters.command(["pat", "pats"], ".") & filters.me) 12 | async def give_pats(_, message: Message): 13 | URL = "https://some-random-api.ml/animu/pat" 14 | async with aiohttp.ClientSession() as session: 15 | async with session.get(URL) as request: 16 | if request.status == 404: 17 | return await message.edit("`no Pats for you :c") 18 | result = await request.json() 19 | url = result.get("link", None) 20 | await asyncio.gather( 21 | message.delete(), 22 | UserBot.send_video( 23 | GetChatID(message), url, reply_to_message_id=ReplyCheck(message) 24 | ), 25 | ) 26 | 27 | 28 | # Command help section 29 | add_command_help( 30 | "pats", 31 | [ 32 | [".pat | .pats", "Give pats."], 33 | ], 34 | ) 35 | -------------------------------------------------------------------------------- /userbot/plugins/thispersonandcatdoesnotexist.py: -------------------------------------------------------------------------------- 1 | import os 2 | from random import randint 3 | 4 | from pyrogram import filters 5 | from pyrogram.types import Message 6 | from thisapidoesnotexist import get_person, get_cat 7 | 8 | from userbot import UserBot 9 | from userbot.helpers.PyroHelpers import ReplyCheck 10 | 11 | 12 | @UserBot.on_message((filters.command("person", ".") & filters.me)) 13 | async def this_person_does_no_exist(_, message: Message): 14 | person = get_person() 15 | file_name = f"{randint(1, 999)}person.jpeg" 16 | person.save_image(file_name) 17 | await UserBot.send_photo( 18 | message.chat.id, file_name, reply_to_message_id=ReplyCheck(message) 19 | ) 20 | os.remove(file_name) 21 | await message.delete() 22 | 23 | 24 | @UserBot.on_message((filters.command("rcat", ".") & filters.me)) 25 | async def this_cat_does_no_exist(_, message: Message): 26 | cat = get_cat() 27 | file_name = f"{randint(1, 999)}cat.jpeg" 28 | cat.save_image(file_name) 29 | await UserBot.send_photo( 30 | message.chat.id, file_name, reply_to_message_id=ReplyCheck(message) 31 | ) 32 | os.remove(file_name) 33 | await message.delete() 34 | -------------------------------------------------------------------------------- /userbot/plugins/spam.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import filters 4 | from pyrogram.types import Message 5 | from userbot import UserBot 6 | from userbot.helpers.PyroHelpers import ReplyCheck 7 | from userbot.plugins.help import add_command_help 8 | 9 | 10 | @UserBot.on_message(filters.command("spam", ".") & filters.me) 11 | async def spam(_, message: Message): 12 | # Get current chat and spam to there. 13 | # if in group and replied to user, then spam replying to user. 14 | await message.delete() 15 | 16 | times = message.command[1] 17 | to_spam = " ".join(message.command[2:]) 18 | 19 | if message.chat.type in ["supergroup", "group"]: 20 | for _ in range(int(times)): 21 | await UserBot.send_message( 22 | message.chat.id, to_spam, reply_to_message_id=ReplyCheck(message) 23 | ) 24 | await asyncio.sleep(0.20) 25 | 26 | if message.chat.type == "private": 27 | for _ in range(int(times)): 28 | await UserBot.send_message(message.chat.id, to_spam) 29 | await asyncio.sleep(0.20) 30 | 31 | 32 | # Command help section 33 | add_command_help("spam", [[".spam", " "]]) 34 | -------------------------------------------------------------------------------- /userbot/helpers/aiohttp_helper.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | import aiohttp 4 | 5 | 6 | class AioHttp: 7 | @staticmethod 8 | async def get_json(link): 9 | async with aiohttp.ClientSession() as session: 10 | async with session.get(link) as resp: 11 | return await resp.json() 12 | 13 | @staticmethod 14 | async def get_text(link): 15 | async with aiohttp.ClientSession() as session: 16 | async with session.get(link) as resp: 17 | return await resp.text() 18 | 19 | @staticmethod 20 | async def get_json_from_text(link): 21 | async with aiohttp.ClientSession() as session: 22 | async with session.get(link) as resp: 23 | text = await resp.text() 24 | return json.loads(text) 25 | 26 | @staticmethod 27 | async def get_raw(link): 28 | async with aiohttp.ClientSession() as session: 29 | async with session.get(link) as resp: 30 | return await resp.read() 31 | 32 | @staticmethod 33 | async def get_url(link): 34 | async with aiohttp.ClientSession() as session: 35 | async with session.get(link) as resp: 36 | return resp.url 37 | -------------------------------------------------------------------------------- /userbot/helpers/interval.py: -------------------------------------------------------------------------------- 1 | # This class was created for combot and has been disclosed by Sergey 2 | # https://t.me/combotchat/45392 3 | 4 | import re 5 | 6 | 7 | class IntervalHelper: 8 | class IntervalError(Exception): 9 | pass 10 | 11 | interval_re = re.compile(r"^(\d+)(w|d|h|m)?$") 12 | 13 | def __init__(self, _interval): 14 | self._interval = _interval 15 | if not self.interval_ok(): 16 | raise Exception("Invalid interval format.") 17 | 18 | def interval_ok(self): 19 | if IntervalHelper.interval_re.match(self._interval): 20 | return True 21 | return False 22 | 23 | def to_secs(self): 24 | m = IntervalHelper.interval_re.match(self._interval) 25 | num, unit = m.groups() 26 | num = int(num) 27 | 28 | if not unit: 29 | unit = "m" 30 | 31 | if unit == "m": 32 | return [num * 60, num, "minute" if num == 1 else "minutes"] 33 | elif unit == "h": 34 | return [num * 60 * 60, num, "hour" if num == 1 else "hours"] 35 | elif unit == "d": 36 | return [num * 60 * 60 * 24, num, "day" if num == 1 else "days"] 37 | elif unit == "w": 38 | return [num * 60 * 60 * 24 * 7, num, "week" if num == 1 else "weeks"] 39 | 40 | interval = property(lambda self: self._interval) 41 | -------------------------------------------------------------------------------- /userbot/helpers/PyroHelpers.py: -------------------------------------------------------------------------------- 1 | from pyrogram.types import Message, User 2 | 3 | 4 | def ReplyCheck(message: Message): 5 | reply_id = None 6 | 7 | if message.reply_to_message: 8 | reply_id = message.reply_to_message.message_id 9 | 10 | elif not message.from_user.is_self: 11 | reply_id = message.message_id 12 | 13 | return reply_id 14 | 15 | 16 | def SpeedConvert(size): 17 | power = 2 ** 10 18 | zero = 0 19 | units = {0: "", 1: "Kbit/s", 2: "Mbit/s", 3: "Gbit/s", 4: "Tbit/s"} 20 | while size > power: 21 | size /= power 22 | zero += 1 23 | return f"{round(size, 2)} {units[zero]}" 24 | 25 | 26 | def GetFromUserID(message: Message): 27 | """ Get the user id of the incoming message.""" 28 | return message.from_user.id 29 | 30 | 31 | def GetChatID(message: Message): 32 | """ Get the group id of the incoming message""" 33 | return message.chat.id 34 | 35 | 36 | def GetUserMentionable(user: User): 37 | """ Get mentionable text of a user.""" 38 | if user.username: 39 | username = "@{}".format(user.username) 40 | else: 41 | if user.last_name: 42 | name_string = "{} {}".format(user.first_name, user.last_name) 43 | else: 44 | name_string = "{}".format(user.first_name) 45 | 46 | username = "{}".format(user.id, name_string) 47 | 48 | return username 49 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Userbot - Telegram Userbot based on pyrogram", 3 | "description": "A modular Telegram Userbot based on pyrogram running on Python 3.9", 4 | "logo": "https://telegra.ph/file/0549cdcecfadeab0dfd40.jpg", 5 | "keywords": [ 6 | "telegram", 7 | "userbot", 8 | "plugin", 9 | "modular", 10 | "pyrogram", 11 | "productivity", 12 | "testing", 13 | "AK HACKER userbot", 14 | "mrrobot userbot", 15 | "mrrobot telegram userbot" 16 | ], 17 | "repository": "https://github.com/AKHACKER-program4hack/mrrobot", 18 | "stack": "container", 19 | "env": { 20 | "ENV": { 21 | "description": "Fill this if you using environ variable as config.", 22 | "value": "Yes" 23 | }, 24 | "API_ID": { 25 | "description": "Get from https://my.telegram.org", 26 | "value": "Yes" 27 | }, 28 | "API_HASH": { 29 | "description": "Get from https://my.telegram.org", 30 | "value": "Yes" 31 | }, 32 | "USERBOT_SESSION": { 33 | "description": "Generate String from Heroku Shell by running 'bash genStr' after you deploy, Set this value later after genrating the string if you dont have. Make sure you choose option 1 since you are here to use it for userbot :)", 34 | "value": "Yes" 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /userbot/plugins/quotly.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import random 3 | from asyncio import sleep 4 | 5 | from pyrogram import filters 6 | from pyrogram.types import Message 7 | from userbot import UserBot 8 | from userbot.plugins.help import add_command_help 9 | 10 | 11 | @UserBot.on_message(filters.me & filters.command(["q"], '.')) 12 | async def quotly(_, message: Message): 13 | if not message.reply_to_message: 14 | await message.edit("Reply to any users text message") 15 | return 16 | await message.edit("```Making a Quote```") 17 | await message.reply_to_message.forward("@QuotLyBot") 18 | is_sticker = False 19 | progress = 0 20 | while not is_sticker: 21 | try: 22 | msg = await UserBot.get_history("@QuotLyBot", 1) 23 | check = msg[0]["sticker"]["file_id"] 24 | is_sticker = True 25 | except: 26 | await sleep(0.5) 27 | progress += random.randint(0, 10) 28 | try: 29 | await message.edit("```Making a Quote```\nProcessing {}%".format(progress)) 30 | except: 31 | await message.edit("ERROR SUUUU") 32 | if msg_id := msg[0]['message_id']: 33 | await asyncio.gather( 34 | message.delete(), 35 | UserBot.forward_messages(message.chat.id,"@QuotLyBot", msg_id) 36 | ) 37 | 38 | 39 | # Command help section 40 | add_command_help( 41 | 'quotly', [ 42 | ['.q | .quote', 'Make a quote with reply to message.'], 43 | ] 44 | ) 45 | -------------------------------------------------------------------------------- /userbot/plugins/weather.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from html import escape 3 | 4 | import aiohttp 5 | from pyrogram import filters 6 | from pyrogram.types import Message 7 | from userbot import UserBot 8 | from userbot.plugins.help import add_command_help 9 | 10 | 11 | @UserBot.on_message(filters.command(["weather", "w"], ".") & filters.me) 12 | async def get_weather(_, message: Message): 13 | if len(message.command) == 1: 14 | await message.edit("Usage: `.weather Maldives`") 15 | await asyncio.sleep(3) 16 | await message.delete() 17 | 18 | if len(message.command) > 1: 19 | location = message.command[1] 20 | headers = {"user-agent": "httpie"} 21 | url = f"https://wttr.in/{location}?mnTC0&lang=en" 22 | try: 23 | async with aiohttp.ClientSession(headers=headers) as session: 24 | async with session.get(url) as resp: 25 | data = await resp.text() 26 | except Exception: 27 | await message.edit("Failed to get the weather forecast") 28 | 29 | if "we processed more than 1M requests today" in data: 30 | await message.edit("`Sorry, we cannot process this request today!`") 31 | else: 32 | weather = f"{escape(data.replace('report', 'Report'))}" 33 | await message.edit(weather, parse_mode="html") 34 | 35 | 36 | # Command help section 37 | add_command_help( 38 | "weather", 39 | [ 40 | [".weather", "Gets weather information for provided location."], 41 | ], 42 | ) 43 | -------------------------------------------------------------------------------- /userbot/plugins/urbandictionary.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | from asyncio import sleep 3 | from userbot import UserBot 4 | from userbot.helpers.aiohttp_helper import AioHttp 5 | from userbot.plugins.help import add_command_help 6 | 7 | 8 | def replace_text(text): 9 | return text.replace('"', "").replace("\\r", "").replace("\\n", "").replace("\\", "") 10 | 11 | 12 | @UserBot.on_message(filters.me & filters.command(["ud"], ".")) 13 | async def urban_dictionary(bot, message): 14 | if len(message.text.split()) == 1: 15 | await message.edit("Usage: `ud example`") 16 | return 17 | try: 18 | text = message.text.split(None, 1)[1] 19 | response = await AioHttp().get_json( 20 | f"http://api.urbandictionary.com/v0/define?term={text}" 21 | ) 22 | word = response["list"][0]["word"] 23 | definition = response["list"][0]["definition"] 24 | example = response["list"][0]["example"] 25 | resp = ( 26 | f"**Text: {replace_text(word)}**\n" 27 | f"**Meaning:**\n`{replace_text(definition)}`\n\n" 28 | f"**Example:**\n`{replace_text(example)}` " 29 | ) 30 | await message.edit(resp) 31 | return 32 | except Exception as e: 33 | await message.edit("`The Urban Dictionary API could not be reached`") 34 | print(e) 35 | await sleep(3) 36 | await message.delete() 37 | 38 | 39 | # Command help section 40 | add_command_help( 41 | "dictionary", 42 | [ 43 | [".ubran | .ud", "Define the word you send or reply to."], 44 | ], 45 | ) 46 | -------------------------------------------------------------------------------- /userbot/plugins/metrics.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | from pyrogram import filters 4 | from pyrogram.types import Message 5 | from userbot import UserBot 6 | from userbot.plugins.help import add_command_help 7 | 8 | 9 | class Custom(dict): 10 | def __missing__(self, key): 11 | return 0 12 | 13 | 14 | @UserBot.on_message(filters.command("wordcount", ".") & filters.me) 15 | async def word_count(_, message: Message): 16 | await message.delete() 17 | words = Custom() 18 | progress = await UserBot.send_message(message.chat.id, "`Processed 0 messages...`") 19 | total = 0 20 | async for msg in UserBot.iter_history(message.chat.id, 1000): 21 | total += 1 22 | if total % 100 == 0: 23 | await progress.edit_text(f"`Processed {total} messages...`") 24 | time.sleep(0.5) 25 | if msg.text: 26 | for word in msg.text.split(): 27 | words[word.lower()] += 1 28 | if msg.caption: 29 | for word in msg.caption.split(): 30 | words[word.lower()] += 1 31 | freq = sorted(words, key=words.get, reverse=True) 32 | out = "Word Counter\n" 33 | for i in range(25): 34 | out += f"{i + 1}. **{words[freq[i]]}**: {freq[i]}\n" 35 | 36 | await progress.edit_text(out) 37 | 38 | 39 | # Command help section 40 | add_command_help( 41 | "metrics", 42 | [ 43 | [ 44 | ".wordcount", 45 | "Finds the 25 most used words in the last 1000 messages in a group or private chat. Use in " 46 | "chat you want to find the metric in.", 47 | ], 48 | ], 49 | ) 50 | -------------------------------------------------------------------------------- /userbot/helpers/skyrim.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | from PIL import Image, ImageDraw, ImageFont 4 | 5 | 6 | class SkyrimStatusMeme: 7 | font = ImageFont.truetype("userbot/fonts/impact.ttf", 60) 8 | background = Image.open("userbot/images/skyrim_background.png", "r") 9 | finalText = "" 10 | finalSize = [300, 200] 11 | imgx = 300 12 | finalImage = None 13 | 14 | def __init__(self, status, level): 15 | self.finalText = status.upper() + " : " + level 16 | offset_counter = 0 17 | while self.GetSize()[0] > (self.finalSize[0] - 100): 18 | self.finalSize[0] += 300 19 | offset_counter += 1 20 | backgroundImage = Image.new("RGB", self.finalSize, color="#FFF") 21 | count = 0 22 | for _ in range(0, offset_counter + 1): 23 | backgroundImage.paste(self.background, (count, 0)) 24 | count += self.imgx 25 | draw = ImageDraw.Draw(backgroundImage) 26 | posx = (backgroundImage.width - self.GetSize()[0]) / 2 27 | posy = (backgroundImage.height - self.GetSize()[1]) / 2 28 | draw.text((posx + 3, posy + 3), self.finalText, fill="black", font=self.font) 29 | draw.text((posx, posy), self.finalText, fill="white", font=self.font) 30 | self.finalImage = backgroundImage 31 | 32 | def SaveFile(self, filename): 33 | self.finalImage.save(filename) 34 | 35 | def GetSize(self): 36 | return self.font.getsize(self.finalText) 37 | 38 | 39 | if __name__ == "__main__": 40 | inst = SkyrimStatusMeme(sys.argv[1], sys.argv[2]) 41 | inst.SaveFile("userbot/downloads/skyrim.png") 42 | -------------------------------------------------------------------------------- /userbot/plugins/unsplash.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import filters 4 | from pyrogram.types import Message 5 | from userbot import UserBot 6 | from userbot.helpers.aiohttp_helper import AioHttp 7 | from userbot.plugins.help import add_command_help 8 | 9 | 10 | @UserBot.on_message(filters.command(["unsplash", "pic"], ".") & filters.me) 11 | async def unsplash_pictures(_, message: Message): 12 | cmd = message.command 13 | 14 | if len(cmd) > 1 and isinstance(cmd[1], str): 15 | keyword = cmd[1] 16 | 17 | if len(cmd) > 2 and int(cmd[2]) < 10: 18 | await message.edit("```Getting Pictures```") 19 | count = int(cmd[2]) 20 | images = [] 21 | while len(images) is not count: 22 | img = await AioHttp().get_url( 23 | f"https://source.unsplash.com/1600x900/?{keyword}" 24 | ) 25 | if img not in images: 26 | images.append(img) 27 | 28 | for img in images: 29 | await UserBot.send_photo(message.chat.id, str(img)) 30 | 31 | await message.delete() 32 | return 33 | else: 34 | await message.edit("```Getting Picture```") 35 | img = await AioHttp().get_url( 36 | f"https://source.unsplash.com/1600x900/?{keyword}" 37 | ) 38 | await asyncio.gather( 39 | message.delete(), UserBot.send_photo(message.chat.id, str(img)) 40 | ) 41 | 42 | 43 | # Command help section 44 | add_command_help( 45 | "unsplash", 46 | [ 47 | [".unsplash __or__ .pic", "Send random pic of keyword first argument."], 48 | ], 49 | ) 50 | -------------------------------------------------------------------------------- /userbot/userbot.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import pathlib 4 | import psutil 5 | from pyrogram import Client 6 | 7 | API_ID = os.environ.get("API_ID", None) 8 | API_HASH = os.environ.get("API_HASH", None) 9 | USERBOT_SESSION = os.environ.get("USERBOT_SESSION", None) 10 | 11 | 12 | class UserBot(Client): 13 | file_path = pathlib.Path(__file__).parent 14 | main_directory = str(file_path.parent) 15 | def __init__(self, name): 16 | name = name.lower() 17 | 18 | super().__init__( 19 | USERBOT_SESSION,# if USERBOT_SESSION is not None else name, 20 | api_id=API_ID, 21 | api_hash=API_HASH, 22 | plugins=dict(root=f"{name}/plugins"), 23 | workdir="./", 24 | app_version="Userbot v1.0", 25 | ) 26 | 27 | async def start(self): 28 | await super().start() 29 | await super().send_message("me", "Userbot started") 30 | 31 | print("Userbot started. Hi.") 32 | 33 | async def stop(self, *args): 34 | await super().stop() 35 | print("Userbot stopped. Bye.") 36 | 37 | async def restart(self, *args, git_update=False, pip=False): 38 | """ Shoutout to the Userg team for this.""" 39 | await self.stop() 40 | try: 41 | c_p = psutil.Process(os.getpid()) 42 | for handler in c_p.open_files() + c_p.connections(): 43 | os.close(handler.fd) 44 | except Exception as c_e: 45 | print(c_e) 46 | 47 | if git_update: 48 | os.system("git reset --hard") 49 | os.system("git pull") 50 | if pip: 51 | os.system("pip install -U -r requirements.txt") 52 | 53 | os.execl(sys.executable, sys.executable, "-m", self.__class__.__name__.lower()) 54 | sys.exit() 55 | -------------------------------------------------------------------------------- /userbot/plugins/vulgar.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import re 3 | 4 | from pyrogram import filters 5 | from pyrogram.types import Message 6 | from pyrogram.errors import MessageNotModified 7 | 8 | from userbot import UserBot 9 | from userbot.plugins.help import add_command_help 10 | 11 | bad_words = ["nigga", "nigger", "coon"] 12 | 13 | vulgar_filter = False 14 | 15 | 16 | def switch(): 17 | global vulgar_filter 18 | vulgar_filter = not vulgar_filter 19 | return vulgar_filter 20 | 21 | 22 | @UserBot.on_message(filters.command("vulgar", ".") & filters.me) 23 | async def toggle(_, message: Message): 24 | c = switch() 25 | await message.edit("`Vulgar Enabled`" if c else "`Vulgar Disabled`") 26 | await asyncio.sleep(3) 27 | await message.delete() 28 | 29 | 30 | @UserBot.on_message(~filters.regex(r"^\.\w*") & filters.me, group=10) 31 | async def i_am_not_allowed_to_say_this(_, message: Message): 32 | if vulgar_filter: 33 | try: 34 | txt = None 35 | if message.caption: 36 | txt = message.caption 37 | elif message.text: 38 | txt = message.text 39 | 40 | for word in bad_words: 41 | try: 42 | txt = re.sub(word, "bruh", txt, flags=re.IGNORECASE) 43 | except Exception: 44 | pass 45 | 46 | if message.caption: 47 | if txt != message.caption: 48 | await message.edit_caption(txt) 49 | 50 | elif message.text: 51 | if txt != message.text: 52 | await message.edit(txt) 53 | except MessageNotModified: 54 | return 55 | 56 | 57 | # Command help section 58 | add_command_help( 59 | "vulgar", 60 | [ 61 | [".vulgar", "Toggles bad word filtering on and off."], 62 | ], 63 | ) 64 | -------------------------------------------------------------------------------- /userbot/plugins/memes/scam.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from random import choice, randint 3 | 4 | from pyrogram import filters 5 | from pyrogram.types import Message 6 | from userbot import UserBot 7 | 8 | 9 | @UserBot.on_message(filters.command("scam", ".") & filters.me) 10 | async def scam(_, message: Message): 11 | options = ( 12 | "typing", 13 | "upload_photo", 14 | "record_video", 15 | "upload_video", 16 | "record_audio", 17 | "upload_audio", 18 | "upload_document", 19 | "find_location", 20 | "record_video_note", 21 | "upload_video_note", 22 | "choose_contact", 23 | "playing", 24 | ) 25 | 26 | input_str = message.command 27 | 28 | if len(input_str) == 1: # Let bot decide action and time 29 | scam_action = choice(options) 30 | scam_time = randint(30, 60) 31 | 32 | elif len(input_str) == 2: # User decides time/action, bot decides the other. 33 | try: 34 | scam_action = str(input_str[1]).lower() 35 | scam_time = randint(30, 60) 36 | 37 | except ValueError: 38 | scam_action = choice(options) 39 | scam_time = int(input_str[1]) 40 | 41 | elif len(input_str) == 3: # User decides both action and time 42 | scam_action = str(input_str[1]).lower() 43 | scam_time = int(input_str[2]) 44 | 45 | else: 46 | await message.edit("`Invalid Syntax !!`") 47 | return 48 | 49 | try: 50 | if scam_time > 0: 51 | chat_id = message.chat.id 52 | await message.delete() 53 | 54 | count = 0 55 | while count <= scam_time: 56 | await UserBot.send_chat_action(chat_id, scam_action) 57 | await asyncio.sleep(5) 58 | count += 5 59 | 60 | except Exception: 61 | return 62 | -------------------------------------------------------------------------------- /userbot/plugins/nekobin.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | import aiohttp 4 | from pyrogram import filters 5 | from pyrogram.types import Message 6 | from userbot import UserBot 7 | from userbot.plugins.help import add_command_help 8 | 9 | 10 | @UserBot.on_message( 11 | filters.command(["neko", "nekobin", "bin", "paste"], ".") & filters.me 12 | ) 13 | async def paste(_, message: Message): 14 | text = message.reply_to_message.text 15 | try: 16 | async with aiohttp.ClientSession() as session: 17 | async with session.post( 18 | "https://nekobin.com/api/documents", json={"content": text}, timeout=3 19 | ) as response: 20 | key = (await response.json())["result"]["key"] 21 | except Exception: 22 | await message.edit_text("`Pasting failed`") 23 | await asyncio.sleep(2) 24 | await message.delete() 25 | return 26 | else: 27 | url = f"https://nekobin.com/{key}" 28 | reply_text = f"Nekofied to **Nekobin** : {url}" 29 | delete = ( 30 | True 31 | if len(message.command) > 1 32 | and message.command[1] in ["d", "del"] 33 | and message.reply_to_message.from_user.is_self 34 | else False 35 | ) 36 | if delete: 37 | await asyncio.gather( 38 | UserBot.send_message( 39 | message.chat.id, reply_text, disable_web_page_preview=True 40 | ), 41 | message.reply_to_message.delete(), 42 | message.delete(), 43 | ) 44 | else: 45 | await message.edit_text( 46 | reply_text, 47 | disable_web_page_preview=True, 48 | ) 49 | 50 | 51 | add_command_help( 52 | "paste", 53 | [ 54 | [ 55 | ".paste `or` .bin `or` .neko `or` .nekobin", 56 | "Create a Nekobin paste using replied to message.", 57 | ], 58 | ], 59 | ) 60 | -------------------------------------------------------------------------------- /userbot/plugins/memes/dhivehi.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | from pyrogram.types import Message 3 | from userbot import UserBot 4 | from userbot.plugins.help import add_command_help 5 | 6 | dhivehi_text_memes = { 7 | "bidi": {"meme": "🚬", "help": "Bidi"}, 8 | "100": {"meme": "💯", "help": "💯"}, 9 | "kada": {"alts": ["k"], "meme": "ކަޑަ؟", "help": "ކަޑަ؟"}, 10 | "blk": {"alts": ["b"], "meme": "ބަލާކޭ", "help": "ޭބަލާކ"}, 11 | "gerey": {"alts": ["g"], "meme": "ގެރޭ", "help": "ގެރޭ"}, 12 | "ngb": {"alts": ["n"], "meme": "ނަގޫބަޅާ", "help": "ނަގޫބަޅާ"}, 13 | "amf": {"alts": ["a"], "meme": "އަމާފޫޅު", "help": "އަމާފޫޅު"}, 14 | "fdb": {"alts": [], "meme": "ފަޑަބޮއެ", "help": "ފަޑަބޮއެ"}, 15 | "kg": {"alts": [], "meme": "ކަލޯގަޔާ", "help": "ކަލޯގަޔާ"}, 16 | } 17 | 18 | dhivehi_text_memes_commands = [] 19 | fixed_memes_help = [] 20 | for dv in dhivehi_text_memes: 21 | dhivehi_text_memes_commands.append(dv) 22 | if "alts" in dhivehi_text_memes[dv]: 23 | for y in dhivehi_text_memes[dv]["alts"]: 24 | dhivehi_text_memes_commands.append(y) 25 | 26 | # Construct the help from the same loop eh. 27 | command = f".{dv}" 28 | if "alts" in dhivehi_text_memes[dv]: 29 | for y in dhivehi_text_memes[dv]["alts"]: 30 | command += f" __or__ .{y}" 31 | fixed_memes_help.append([command, dhivehi_text_memes[dv]["help"]]) 32 | 33 | 34 | @UserBot.on_message(filters.command(dhivehi_text_memes_commands, ".") & filters.me) 35 | async def dhivehi_memes(_, message: Message): 36 | cmd = message.command[0] 37 | 38 | meme = None 39 | 40 | if cmd not in dhivehi_text_memes: 41 | for x in dhivehi_text_memes: 42 | if "alts" in dhivehi_text_memes[x] and cmd in dhivehi_text_memes[x]["alts"]: 43 | meme = dhivehi_text_memes[x] 44 | break 45 | else: 46 | meme = dhivehi_text_memes[message.command[0]] 47 | 48 | if meme: 49 | await message.edit(meme["meme"]) 50 | 51 | 52 | # Command help section 53 | add_command_help("dhivehi", fixed_memes_help) 54 | -------------------------------------------------------------------------------- /userbot/helpers/adminHelpers.py: -------------------------------------------------------------------------------- 1 | from time import sleep, time 2 | 3 | from pyrogram.types import Message 4 | 5 | from userbot import UserBot 6 | from userbot.helpers.interval import IntervalHelper 7 | 8 | 9 | async def CheckAdmin(message: Message): 10 | """Check if we are an admin.""" 11 | admin = "administrator" 12 | creator = "creator" 13 | ranks = [admin, creator] 14 | 15 | SELF = await UserBot.get_chat_member( 16 | chat_id=message.chat.id, user_id=message.from_user.id 17 | ) 18 | 19 | if SELF.status not in ranks: 20 | await message.edit("__I'm not Admin!__") 21 | sleep(2) 22 | await message.delete() 23 | 24 | else: 25 | if SELF.status is not admin: 26 | return True 27 | elif SELF.can_restrict_members: 28 | return True 29 | else: 30 | await message.edit("__No Permissions to restrict Members__") 31 | sleep(2) 32 | await message.delete() 33 | 34 | 35 | async def CheckReplyAdmin(message: Message): 36 | """Check if the message is a reply to another user.""" 37 | if not message.reply_to_message: 38 | await message.edit(f"`?{message.command[0]}` needs to be a reply") 39 | sleep(2) 40 | await message.delete() 41 | elif message.reply_to_message.from_user.is_self: 42 | await message.edit(f"I can't {message.command[0]} myself.") 43 | sleep(2) 44 | await message.delete() 45 | else: 46 | return True 47 | 48 | 49 | async def Timer(message: Message): 50 | if len(message.command) > 1: 51 | secs = IntervalHelper(message.command[1]) 52 | return int(str(time()).split(".")[0] + secs.to_secs()[0]) 53 | else: 54 | return 0 55 | 56 | 57 | async def TimerString(message: Message): 58 | secs = IntervalHelper(message.command[1]) 59 | return f"{secs.to_secs()[1]} {secs.to_secs()[2]}" 60 | 61 | 62 | async def RestrictFailed(message: Message): 63 | await message.edit(f"I can't {message.command} this user.") 64 | sleep(2) 65 | await message.delete() 66 | -------------------------------------------------------------------------------- /userbot/plugins/memes/skyrim.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import os 3 | import time 4 | 5 | from pyrogram import filters 6 | from pyrogram.types import Message 7 | from userbot import UserBot 8 | from userbot.helpers.PyroHelpers import ReplyCheck 9 | from userbot.plugins.help import add_command_help 10 | 11 | 12 | @UserBot.on_message(filters.command(["skyrim", "skill"], ".") & filters.me) 13 | async def skyrim(_, message: Message): 14 | if len(message.command) >= 2: 15 | text = message.command[1] 16 | else: 17 | await message.edit("```Not enough params```") 18 | await asyncio.sleep(3) 19 | await message.delete() 20 | return 21 | 22 | level = message.command[2] if len(message.command) >= 3 else 100 23 | 24 | try: 25 | try: 26 | if os.name == "nt": 27 | os.system( 28 | f'venv\\Scripts\\activate && python userbot\\helpers\\skyrim.py "{text}" {level}' 29 | ) 30 | else: 31 | os.system( 32 | f'. venv/bin/activate && python userbot//helpers//skyrim.py "{text}" {level}' 33 | ) 34 | except Exception: 35 | await message.edit("```Failed to generate skill```") 36 | time.sleep(2) 37 | await message.delete() 38 | 39 | try: 40 | await UserBot.send_photo( 41 | message.chat.id, 42 | "userbot/downloads/skyrim.png", 43 | reply_to_message_id=ReplyCheck(message), 44 | ) 45 | await message.delete() 46 | except Exception: 47 | await message.edit("```Failed to send skill```") 48 | time.sleep(2) 49 | await message.delete() 50 | finally: 51 | os.remove("userbot/downloads/skyrim.png") 52 | except Exception as e: 53 | print(e) 54 | 55 | 56 | # Command help section 57 | add_command_help( 58 | "skyrim", 59 | [ 60 | [".skyrim", "Generate skyrim skill image.\n .skyrim "], 61 | [".skill", "Generate skyrim skill image.\n .skill "], 62 | ], 63 | ) 64 | -------------------------------------------------------------------------------- /userbot/plugins/mention.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from functools import partial 3 | 4 | from pyrogram import filters 5 | from pyrogram.types import Message 6 | 7 | from userbot import UserBot 8 | from userbot.plugins.help import add_command_help 9 | 10 | mention = partial("{}".format) 11 | 12 | hmention = partial("\u200B{}".format) 13 | 14 | 15 | @UserBot.on_message(filters.command("mention", ".") & filters.me) 16 | async def mention_user(_, message: Message): 17 | if len(message.command) < 3: 18 | await message.edit("Incorrect format\nExample: .mention @Athfan CTO") 19 | await asyncio.sleep(3) 20 | await message.delete() 21 | return 22 | try: 23 | user = await UserBot.get_users(message.command[1]) 24 | except Exception: 25 | await message.edit("User not found") 26 | await asyncio.sleep(3) 27 | await message.delete() 28 | return 29 | 30 | _mention = mention(user.id, " ".join(message.command[2:])) 31 | await message.edit(_mention) 32 | 33 | 34 | @UserBot.on_message(filters.command("hmention", ".") & filters.me) 35 | async def hidden_mention(_, message: Message): 36 | if len(message.command) < 3: 37 | await message.edit("Incorrect format\nExample: .hmention @Athfan") 38 | await asyncio.sleep(3) 39 | await message.delete() 40 | return 41 | try: 42 | user = await UserBot.get_users(message.command[1]) 43 | except Exception: 44 | await message.edit("User not found") 45 | await asyncio.sleep(3) 46 | await message.delete() 47 | return 48 | 49 | _hmention = hmention(user.id, " ".join(message.command[2:])) 50 | await message.edit(_hmention) 51 | 52 | 53 | # Command help section 54 | add_command_help( 55 | "mention", 56 | [ 57 | [ 58 | ".mention", 59 | "Mention a user with a different name\nExample: `.mention @Athfan CTO`", 60 | ], 61 | [ 62 | ".hmention", 63 | "Mention a user with a hidden text\nExample: `.hmention @Athfan`", 64 | ], 65 | ], 66 | ) 67 | -------------------------------------------------------------------------------- /userbot/plugins/memes/emoji.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from collections import deque 3 | from random import randint 4 | 5 | from pyrogram import filters 6 | from pyrogram.types import Message 7 | from userbot import UserBot 8 | from userbot.plugins.help import add_command_help 9 | 10 | emojis = { 11 | "moon": list("🌗🌘🌑🌒🌓🌔🌕🌖"), 12 | "clock": list("🕙🕘🕗🕖🕕🕔🕓🕒🕑🕐🕛"), 13 | "thunder": list("☀️🌤️⛅🌥️☁️🌩️🌧️⛈️⚡🌩️🌧️🌦️🌥️⛅🌤️☀️"), 14 | "earth": list("🌏🌍🌎🌎🌍🌏🌍🌎"), 15 | "heart": list("❤️🧡💛💚💙💜🖤"), 16 | } 17 | emoji_commands = [x for x in emojis] 18 | 19 | 20 | @UserBot.on_message(filters.command(emoji_commands, ".") & filters.me) 21 | async def emoji_cycle(_, message: Message): 22 | deq = deque(emojis[message.command[0]]) 23 | try: 24 | for _ in range(randint(16, 32)): 25 | await asyncio.sleep(0.3) 26 | await message.edit("".join(deq), parse_mode=None) 27 | deq.rotate(1) 28 | except Exception: 29 | await message.delete() 30 | 31 | 32 | special_emojis_dict = { 33 | "target": {"emoji": "🎯", "help": "The special target emoji"}, 34 | "dice": {"emoji": "🎲", "help": "The special dice emoji"}, 35 | "bb": {"emoji": "🏀", "help": "The special basketball emoji"}, 36 | "soccer": {"emoji": "⚽️", "help": "The special football emoji"}, 37 | } 38 | special_emoji_commands = [x for x in special_emojis_dict] 39 | 40 | 41 | @UserBot.on_message(filters.command(special_emoji_commands, ".") & filters.me) 42 | async def special_emojis(_, message: Message): 43 | emoji = special_emojis_dict[message.command[0]] 44 | await message.delete() 45 | await UserBot.send_dice(message.chat.id, emoji["emoji"]) 46 | 47 | 48 | # Command help section 49 | special_emoji_help = [ 50 | [".moon", "Cycles all the phases of the moon emojis."], 51 | [".clock", "Cycles all the phases of the clock emojis."], 52 | [".thunder", "Cycles thunder."], 53 | [".heart", "Cycles heart emojis."], 54 | [".earth `or` .globe", "Make the world go round."], 55 | ] 56 | 57 | for x in special_emojis_dict: 58 | command = f".{x}" 59 | special_emoji_help.append([command, special_emojis_dict[x]["help"]]) 60 | 61 | add_command_help("emoji", special_emoji_help) 62 | -------------------------------------------------------------------------------- /userbot/plugins/lyrics.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import filters 4 | from pyrogram.types import Message 5 | 6 | from userbot import UserBot 7 | from userbot.plugins.help import add_command_help 8 | 9 | 10 | @UserBot.on_message( 11 | filters.command(["l", "lyrics"], ".") & (filters.me) 12 | ) 13 | async def send_lyrics(_, message: Message): 14 | try: 15 | cmd = message.command 16 | 17 | song_name = "" 18 | if len(cmd) > 1: 19 | song_name = " ".join(cmd[1:]) 20 | elif message.reply_to_message: 21 | if message.reply_to_message.audio: 22 | song_name = f"{message.reply_to_message.audio.title} {message.reply_to_message.audio.performer}" 23 | elif len(cmd) == 1: 24 | song_name = message.reply_to_message.text 25 | elif not message.reply_to_message and len(cmd) == 1: 26 | await message.edit("Give a song name") 27 | await asyncio.sleep(2) 28 | await message.delete() 29 | return 30 | 31 | await message.edit(f"Getting lyrics for `{song_name}`") 32 | lyrics_results = await UserBot.get_inline_bot_results("ilyricsbot", song_name) 33 | 34 | try: 35 | # send to Saved Messages because hide_via doesn't work sometimes 36 | saved = await UserBot.send_inline_bot_result( 37 | chat_id="me", 38 | query_id=lyrics_results.query_id, 39 | result_id=lyrics_results.results[0].id, 40 | hide_via=True, 41 | ) 42 | await asyncio.sleep(3) 43 | 44 | # forward from Saved Messages 45 | await UserBot.forward_messages( 46 | chat_id=message.chat.id, 47 | from_chat_id="me", 48 | message_ids=saved.updates[1].message.id, 49 | ) 50 | 51 | # delete the message from Saved Messages 52 | await UserBot.delete_messages("me", saved.updates[1].message.id) 53 | except TimeoutError: 54 | await message.edit("That didn't work out") 55 | await asyncio.sleep(2) 56 | await message.delete() 57 | except Exception as e: 58 | print(e) 59 | await message.edit("`Failed to find lyrics`") 60 | await asyncio.sleep(2) 61 | await message.delete() 62 | 63 | 64 | # Command help section 65 | add_command_help("lyrics", [[".l `or` .lyrics", "Search lyrics and send."]]) 66 | -------------------------------------------------------------------------------- /userbot/plugins/help.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from prettytable import PrettyTable 4 | from pyrogram import filters 5 | from pyrogram.types import Message 6 | 7 | from userbot import UserBot, CMD_HELP 8 | from userbot.helpers.utility import split_list 9 | 10 | heading = "──「 **{0}** 」──\n" 11 | 12 | 13 | @UserBot.on_message(filters.command("help", ".") & filters.me) 14 | async def module_help(_, message: Message): 15 | cmd = message.command 16 | 17 | help_arg = "" 18 | if len(cmd) > 1: 19 | help_arg = " ".join(cmd[1:]) 20 | elif message.reply_to_message and len(cmd) == 1: 21 | help_arg = message.reply_to_message.text 22 | elif not message.reply_to_message and len(cmd) == 1: 23 | all_commands = "" 24 | all_commands += "Please specify which module you want help for!! \nUsage: `.help [module_name]`\n\n" 25 | 26 | ac = PrettyTable() 27 | ac.header = False 28 | ac.title = "UserBot Modules" 29 | ac.align = "l" 30 | 31 | for x in split_list(sorted(CMD_HELP.keys()), 2): 32 | ac.add_row([x[0], x[1] if len(x) >= 2 else None]) 33 | 34 | await message.edit(f"```{str(ac)}```") 35 | 36 | if help_arg: 37 | if help_arg in CMD_HELP: 38 | commands: dict = CMD_HELP[help_arg] 39 | this_command = "**Help for**\n" 40 | this_command += heading.format(str(help_arg)).upper() 41 | 42 | for x in commands: 43 | this_command += f"-> `{str(x)}`\n```{str(commands[x])}```\n" 44 | 45 | await message.edit(this_command, parse_mode="markdown") 46 | else: 47 | await message.edit( 48 | "`Please specify a valid module name.`", parse_mode="markdown" 49 | ) 50 | 51 | await asyncio.sleep(10) 52 | await message.delete() 53 | 54 | 55 | def add_command_help(module_name, commands): 56 | """ 57 | Adds a modules help information. 58 | :param module_name: name of the module 59 | :param commands: list of lists, with command and description each. 60 | """ 61 | 62 | # Key will be group name 63 | # values will be dict of dicts of key command and value description 64 | 65 | if module_name in CMD_HELP.keys(): 66 | command_dict = CMD_HELP[module_name] 67 | else: 68 | command_dict = {} 69 | 70 | for x in commands: 71 | for y in x: 72 | if y is not x: 73 | command_dict[x[0]] = x[1] 74 | 75 | CMD_HELP[module_name] = command_dict 76 | -------------------------------------------------------------------------------- /userbot/plugins/hacker/dirbuster.py: -------------------------------------------------------------------------------- 1 | from pyrogram.errors import BadRequest, Forbidden 2 | 3 | from pyrogram import filters 4 | 5 | from userbot import UserBot 6 | from userbot.helpers.PyroHelpers import GetChatID 7 | from userbot.plugins.help import add_command_help 8 | import time 9 | import requests 10 | 11 | @UserBot.on_message(filters.me & filters.text & filters.command("dirb",".")) 12 | async def dirbuster(client, message): 13 | cmd = message.command 14 | try: 15 | if len(cmd) > 2: 16 | url = cmd[1] 17 | wordlisturl = cmd[2] 18 | try: 19 | print("in brute") 20 | wordlist = requests.get(wordlisturl).content.decode("utf-8").split() 21 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Attack started...") 22 | msgid = d.message_id 23 | chatid = d.chat['id'] 24 | comd = message.message_id 25 | comdchat = message.chat['id'] 26 | # for i in range(1000): 27 | # msg = await client.get_messages(comdchat,comd) 28 | # print(msg.text) 29 | # time.sleep(5) 30 | for word in wordlist: 31 | msg = await client.get_messages(comdchat,comd) 32 | if msg.text == None: 33 | await client.send_message(chat_id=chatid, reply_to_message_id=int(msgid), text="Attack stopped...") 34 | break 35 | else: 36 | try: 37 | r = requests.get(url+word) 38 | print("trying : " + word) 39 | if r.status_code == 200: 40 | await client.send_message(chat_id=chatid,reply_to_message_id=msgid,text="\nfound : " + url + word) 41 | except Exception as error: 42 | await message.reply(str(error)) 43 | continue 44 | except Exception as error: 45 | await message.reply(str(error)) 46 | except Exception as error: 47 | await message.edit("Error : " + str(error)) 48 | 49 | 50 | add_command_help( 51 | "hackers", 52 | [ 53 | [ 54 | ".dirb", 55 | "perform directory brute force on a website\nyou can use github wordlist url in raw view\nUsage: ``.dirb ``", 56 | ], 57 | ], 58 | ) 59 | -------------------------------------------------------------------------------- /userbot/plugins/music.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import filters 4 | from pyrogram.types import Message 5 | from userbot import UserBot 6 | from userbot.plugins.help import add_command_help 7 | 8 | 9 | @UserBot.on_message( 10 | filters.command(["m", "music"], ".") & (filters.me) 11 | ) 12 | async def send_music(_, message: Message): 13 | try: 14 | cmd = message.command 15 | 16 | song_name = "" 17 | if len(cmd) > 1: 18 | song_name = " ".join(cmd[1:]) 19 | elif message.reply_to_message and len(cmd) == 1: 20 | song_name = ( 21 | message.reply_to_message.text or message.reply_to_message.caption 22 | ) 23 | elif not message.reply_to_message and len(cmd) == 1: 24 | await message.edit("Give a song name") 25 | await asyncio.sleep(2) 26 | await message.delete() 27 | return 28 | 29 | song_results = await UserBot.get_inline_bot_results("deezermusicbot", song_name) 30 | 31 | try: 32 | # send to Saved Messages because hide_via doesn't work sometimes 33 | saved = await UserBot.send_inline_bot_result( 34 | chat_id="me", 35 | query_id=song_results.query_id, 36 | result_id=song_results.results[0].id, 37 | hide_via=True, 38 | ) 39 | 40 | # forward as a new message from Saved Messages 41 | saved = await UserBot.get_messages("me", int(saved.updates[1].message.id)) 42 | reply_to = ( 43 | message.reply_to_message.message_id 44 | if message.reply_to_message 45 | else None 46 | ) 47 | await UserBot.send_audio( 48 | chat_id=message.chat.id, 49 | audio=str(saved.audio.file_id), 50 | file_ref=str(saved.audio.file_ref), 51 | reply_to_message_id=reply_to, 52 | ) 53 | 54 | # delete the message from Saved Messages 55 | await UserBot.delete_messages("me", saved.message_id) 56 | except TimeoutError: 57 | await message.edit("That didn't work out") 58 | await asyncio.sleep(2) 59 | await message.delete() 60 | except Exception as e: 61 | print(e) 62 | await message.edit("`Failed to find song`") 63 | await asyncio.sleep(2) 64 | await message.delete() 65 | 66 | 67 | # Command help section 68 | add_command_help("music", [[".m `or` .music", "Search songs and send."]]) 69 | -------------------------------------------------------------------------------- /userbot/plugins/memes/some-random-api/animu.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import re 3 | 4 | from pyrogram import filters 5 | from pyrogram.types import Message 6 | 7 | from userbot import UserBot 8 | from userbot.helpers.PyroHelpers import ReplyCheck 9 | from userbot.helpers.aiohttp_helper import AioHttp 10 | from userbot.plugins.help import add_command_help 11 | 12 | gif_categories = ['wink', 'pat', 'hug', 'face-palm'] 13 | 14 | 15 | @UserBot.on_message(filters.command(["animu-gif", "anime-gif"], ".") & filters.me) 16 | async def animu_gifs(_, message: Message): 17 | cmd = message.command 18 | 19 | if not (len(cmd) >= 2): 20 | await message.edit("```Not enough params provided```") 21 | await asyncio.sleep(3) 22 | await message.delete() 23 | return 24 | 25 | if cmd[1].lower() in gif_categories: 26 | category = cmd[1].lower() 27 | 28 | animu_link = f"https://some-random-api.ml/animu/{category}" 29 | 30 | try: 31 | data = await AioHttp().get_json(animu_link) 32 | gif = data["link"] 33 | except Exception: 34 | await message.edit(f"```Couldn't get a {category}```") 35 | await asyncio.sleep(3) 36 | await message.delete() 37 | else: 38 | await message.delete() 39 | await UserBot.send_animation( 40 | chat_id=message.chat.id, 41 | animation=gif, 42 | reply_to_message_id=ReplyCheck(message) 43 | ) 44 | else: 45 | await message.edit("`Unsupported category...`") 46 | await asyncio.sleep(2) 47 | await message.delete() 48 | 49 | 50 | @UserBot.on_message(filters.command(["animu-quote", "anime-quote"], ".") & filters.me) 51 | async def animu_fact(_, message: Message): 52 | try: 53 | data = await AioHttp().get_json('https://some-random-api.ml/animu/quote') 54 | except Exception: 55 | await message.edit("```Couldn't get an anime quote```") 56 | await asyncio.sleep(3) 57 | await message.delete() 58 | else: 59 | quote = ( 60 | f"\"{data['sentence'].strip()}\"\n\n" 61 | f"{data['characther'].strip()} in {data['anime'].strip()}" 62 | ) 63 | 64 | await message.edit(quote) 65 | 66 | # Animu gif help 67 | animu_gif_help = [] 68 | for x in gif_categories: 69 | animu_gif_help.append([f".animu-gif {x}", f"Sends a random anime gif of a {x}"]) 70 | 71 | add_command_help("animu", animu_gif_help) 72 | 73 | add_command_help( 74 | "animu", 75 | [ 76 | [".animu-quote", f"Send a random anime quote"] 77 | ], 78 | ) 79 | -------------------------------------------------------------------------------- /userbot/plugins/admin/pin.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import filters 4 | from pyrogram.methods.chats.get_chat_members import Filters as ChatMemberFilters 5 | from pyrogram.types import Message 6 | 7 | from userbot import UserBot 8 | from userbot.plugins.help import add_command_help 9 | 10 | 11 | @UserBot.on_message(filters.command("pin", ".") & filters.me) 12 | async def pin_message(_, message: Message): 13 | # First of all check if its a group or not 14 | if message.chat.type in ["group", "supergroup"]: 15 | # Here lies the sanity checks 16 | admins = await UserBot.get_chat_members( 17 | message.chat.id, filter=ChatMemberFilters.ADMINISTRATORS 18 | ) 19 | admin_ids = [user.user.id for user in admins] 20 | me = await UserBot.get_me() 21 | 22 | # If you are an admin 23 | if me.id in admin_ids: 24 | # If you replied to a message so that we can pin it. 25 | if message.reply_to_message: 26 | disable_notification = True 27 | 28 | # Let me see if you want to notify everyone. People are gonna hate you for this... 29 | if len(message.command) >= 2 and message.command[1] in [ 30 | "alert", 31 | "notify", 32 | "loud", 33 | ]: 34 | disable_notification = False 35 | 36 | # Pin the fucking message. 37 | await UserBot.pin_chat_message( 38 | message.chat.id, 39 | message.reply_to_message.message_id, 40 | disable_notification=disable_notification, 41 | ) 42 | await message.edit("`Pinned message!`") 43 | else: 44 | # You didn't reply to a message and we can't pin anything. ffs 45 | await message.edit( 46 | "`Reply to a message so that I can pin the god damned thing...`" 47 | ) 48 | else: 49 | # You have no business running this command. 50 | await message.edit("`I am not an admin here lmao. What am I doing?`") 51 | else: 52 | # Are you fucking dumb this is not a group ffs. 53 | await message.edit("`This is not a place where I can pin shit.`") 54 | 55 | # And of course delete your lame attempt at changing the group picture. 56 | # RIP you. 57 | # You're probably gonna get ridiculed by everyone in the group for your failed attempt. 58 | # RIP. 59 | await asyncio.sleep(3) 60 | await message.delete() 61 | 62 | 63 | # Command help section 64 | add_command_help("admin", [[".pin", "Pin the replied to message."]]) 65 | -------------------------------------------------------------------------------- /userbot/plugins/spacex.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | 3 | from pyrogram import filters 4 | from pyrogram.types import Message 5 | from userbot import UserBot 6 | from userbot.helpers.PyroHelpers import ReplyCheck 7 | from userbot.helpers.spacex import Spacex 8 | from userbot.plugins.help import add_command_help 9 | 10 | 11 | @UserBot.on_message(filters.command(["spacex", "elon", "ae12"], ".") & filters.me) 12 | async def spacex(_, message: Message): 13 | await message.delete() 14 | 15 | data = await Spacex().latest() 16 | 17 | dt = datetime.utcfromtimestamp(int(data["launch_date_unix"])).strftime( 18 | "%d-%m-%Y %H:%M:%S" 19 | ) 20 | images = data["links"]["flickr_images"] 21 | 22 | txt = ( 23 | f"Mission Name: {data['mission_name']}\n" 24 | f"Flight No: {data['flight_number']}\n" 25 | f"Rocket Name: {data['rocket']['rocket_name']}\n" 26 | f"Launch Site: {data['launch_site']['site_name']}\n" 27 | f"Launch Date: {dt}\n\n" 28 | f"Links:\n" 29 | f"Reddit, " 30 | f"YouTube" 31 | ) 32 | 33 | if images: 34 | for i, image in enumerate(images, start=1): 35 | txt += f", Flicker {i}" 36 | 37 | txt += f"\n\n{data['details']}" 38 | 39 | if images: 40 | await UserBot.send_photo( 41 | chat_id=message.chat.id, 42 | photo=images[0], 43 | caption=txt, 44 | reply_to_message_id=ReplyCheck(message), 45 | ) 46 | else: 47 | await UserBot.send_message( 48 | chat_id=message.chat.id, text=txt, disable_web_page_preview=True 49 | ) 50 | 51 | 52 | @UserBot.on_message(filters.command(["nspacex", "nextlaunch"], ".") & filters.me) 53 | async def next_launch(_, message: Message): 54 | await message.delete() 55 | 56 | data = await Spacex().next() 57 | 58 | dt = datetime.utcfromtimestamp(int(data["launch_date_unix"])).strftime( 59 | "%d-%m-%Y %H:%M:%S" 60 | ) 61 | 62 | txt = ( 63 | "NEXT SPACEX LAUNCH\n" 64 | f"Mission Name: {data['mission_name']}\n" 65 | f"Flight No: {data['flight_number']}\n" 66 | f"Rocket Name: {data['rocket']['rocket_name']}\n" 67 | f"Launch Site: {data['launch_site']['site_name']}\n" 68 | f"Launch Date: {dt}" 69 | f"\n\n{data['details']}" 70 | ) 71 | 72 | await UserBot.send_message( 73 | chat_id=message.chat.id, text=txt, disable_web_page_preview=True 74 | ) 75 | 76 | 77 | # Command help section 78 | add_command_help( 79 | "spacex", 80 | [ 81 | [".spacex", "Get the latest launch details"], 82 | [".nspacex", "Get the next launch details"], 83 | ], 84 | ) 85 | -------------------------------------------------------------------------------- /userbot/plugins/memes/text_apis.py: -------------------------------------------------------------------------------- 1 | from aiohttp.client_exceptions import ClientError 2 | from pyrogram import filters 3 | from pyrogram.types import Message 4 | 5 | from userbot import UserBot 6 | from userbot.helpers.aiohttp_helper import AioHttp 7 | from userbot.plugins.help import add_command_help 8 | 9 | text_apis_data = { 10 | "compliment": { 11 | "url": "https://complimentr.com/api", 12 | "target_key": "compliment", 13 | "help": "Sends a nice compliment.", 14 | }, 15 | "devexcuse": { 16 | "url": "https://dev-excuses-api.herokuapp.com/", 17 | "target_key": "text", 18 | "help": "It works on my machine!", 19 | }, 20 | "insult": { 21 | "url": "https://evilinsult.com/generate_insult.php?lang=en", 22 | "target_key": "insult", 23 | "help": "Give it a guess dumbass!", 24 | }, 25 | "kanye": { 26 | "url": "https://api.kanye.rest/", 27 | "target_key": "quote", 28 | "format": "Kanye once said:\n`{}`", 29 | "help": "Kanye used to say", 30 | }, 31 | "programmer": { 32 | "url": "https://programming-quotes-api.herokuapp.com/quotes/random", 33 | "target_key": "en", 34 | "help": "Programmers be like.", 35 | }, 36 | "affirmation": { 37 | "url": "https://www.affirmations.dev/", 38 | "target_key": "affirmation", 39 | "help": "Affirmative messages", 40 | }, 41 | } 42 | 43 | text_api_commands = [] 44 | for x in text_apis_data: 45 | text_api_commands.append(x) 46 | if "alts" in text_apis_data[x]: 47 | for y in text_apis_data[x]["alts"]: 48 | text_api_commands.append(y) 49 | 50 | 51 | @UserBot.on_message( 52 | filters.command(text_api_commands, ".") & (filters.me) 53 | ) 54 | async def text_api(_, message: Message): 55 | cmd = message.command 56 | api_key = cmd[0] 57 | api = text_apis_data[api_key] 58 | 59 | try: 60 | try: 61 | data = await AioHttp().get_json(api["url"]) 62 | resp_json = data[api["target_key"]] 63 | if "format" in api: 64 | txt = api["format"].format(resp_json) 65 | else: 66 | txt = resp_json.capitalize() 67 | if message.from_user.is_self: 68 | await message.edit(txt) 69 | else: 70 | await message.reply(txt) 71 | except Exception: 72 | data = await AioHttp().get_text(api["url"]) 73 | if message.from_user.is_self: 74 | await message.edit(data) 75 | else: 76 | await message.reply(data) 77 | except ClientError as e: 78 | print(e) 79 | await message.delete() 80 | 81 | 82 | # Command help section 83 | for x in text_apis_data: 84 | add_command_help( 85 | "text", 86 | [ 87 | [f".{x}", text_apis_data[x]["help"]], 88 | ], 89 | ) 90 | -------------------------------------------------------------------------------- /userbot/plugins/admin/set_group_pic.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import filters 4 | from pyrogram.methods.chats.get_chat_members import Filters as ChatMemberFilters 5 | from pyrogram.types import Message 6 | 7 | from userbot import UserBot 8 | from userbot.plugins.help import add_command_help 9 | 10 | 11 | @UserBot.on_message(filters.command("setpic", ".") & filters.me) 12 | async def set_picture(_, message: Message): 13 | # First of all check if its a group or not 14 | if message.chat.type in ["group", "supergroup"]: 15 | # Here lies the sanity checks 16 | admins = await UserBot.get_chat_members( 17 | message.chat.id, filter=ChatMemberFilters.ADMINISTRATORS 18 | ) 19 | admin_ids = [user.user.id for user in admins] 20 | me = await UserBot.get_me() 21 | 22 | # If you are an admin 23 | if me.id in admin_ids: 24 | 25 | my_permissions = None 26 | # Fetch your permissions 27 | for user in admins: 28 | if user.user.id == me.id: 29 | my_permissions = user 30 | 31 | # If you can change group photo 32 | if my_permissions and my_permissions.can_change_info: 33 | # If you replied to a message and it has a photo 34 | if message.reply_to_message and message.reply_to_message.media: 35 | file_id = message.reply_to_message.photo.file_id 36 | file_ref = message.reply_to_message.photo.file_ref 37 | await UserBot.set_chat_photo( 38 | message.chat.id, file_id, file_ref=file_ref 39 | ) 40 | await message.edit( 41 | f"`{message.chat.type.title()} picture has been set.`" 42 | ) 43 | return 44 | else: 45 | # You didn't reply and it didn't have a photo either. Baka. 46 | await message.edit( 47 | f"`Please reply to a message with a photo to set it as {message.chat.type} picture.`" 48 | ) 49 | else: 50 | # You literally CANNOT do this. 51 | await message.edit("`I lack the permissions to do this...`") 52 | else: 53 | # You have no business running this command. 54 | await message.edit("`I am not an admin here.`") 55 | else: 56 | # Are you fucking dumb this is not a group ffs. 57 | await message.edit("`This is not a place where I can change the picture.`") 58 | 59 | # And of course delete your lame attempt at changing the group picture. 60 | # RIP you. 61 | # You're probably gonna get ridiculed by everyone in the group for your failed attempt. 62 | # RIP. 63 | await asyncio.sleep(3) 64 | await message.delete() 65 | 66 | 67 | # Command help section 68 | add_command_help("admin", [[".setpic", "Set group picture as the replied to photo."]]) 69 | -------------------------------------------------------------------------------- /userbot/plugins/git_commands.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import datetime 3 | import os 4 | from asyncio import sleep 5 | from glob import iglob 6 | from random import randint 7 | 8 | import aiofiles 9 | import git 10 | from pyrogram import filters 11 | from pyrogram.types import Message 12 | from reportlab.graphics import renderPM 13 | from svglib.svglib import svg2rlg 14 | 15 | from userbot import UserBot 16 | from userbot.helpers.PyroHelpers import ReplyCheck 17 | from userbot.helpers.aiohttp_helper import AioHttp 18 | from userbot.plugins.help import add_command_help 19 | 20 | 21 | @UserBot.on_message(filters.command(["lastcommit", "lc"], ".") & filters.me) 22 | async def last_commit(_, message: Message): 23 | repo = git.Repo(os.getcwd()) 24 | master = repo.head.reference 25 | commit = master.commit.message.strip() 26 | commit_id = master.commit.hexsha 27 | commit_link = f"{commit_id[:7]}" 28 | author = master.commit.author.name 29 | date_time = datetime.datetime.fromtimestamp(master.commit.committed_date) 30 | commit_msg = ( 31 | f"**Latest commit**: {commit_link}\n\n**Commit Message**:\n```{commit.strip()}```\n\n" 32 | f"**By**: `{author}`\n\n**On**: `{date_time}`" 33 | ) 34 | await message.edit(commit_msg, disable_web_page_preview=True) 35 | 36 | 37 | @UserBot.on_message(filters.command(["ggraph", "commitgraph"], ".") & filters.me) 38 | async def commit_graph(_, message: Message): 39 | if len(message.command) < 2: 40 | await message.edit( 41 | "Please provide a github profile username to generate the graph!" 42 | ) 43 | await sleep(2) 44 | await message.delete() 45 | return 46 | else: 47 | git_user = message.command[1] 48 | 49 | url = f"https://ghchart.rshah.org/{git_user}" 50 | file_name = f"{randint(1, 999)}{git_user}" 51 | 52 | resp = await AioHttp.get_raw(url) 53 | f = await aiofiles.open(f"{file_name}.svg", mode="wb") 54 | await f.write(resp) 55 | await f.close() 56 | 57 | try: 58 | drawing = svg2rlg(f"{file_name}.svg") 59 | renderPM.drawToFile(drawing, f"{file_name}.png") 60 | except UnboundLocalError: 61 | await message.edit("Username does not exist!") 62 | await sleep(2) 63 | await message.delete() 64 | return 65 | 66 | await asyncio.gather( 67 | UserBot.send_photo( 68 | chat_id=message.chat.id, 69 | photo=f"{file_name}.png", 70 | caption=git_user, 71 | reply_to_message_id=ReplyCheck(message), 72 | ), 73 | message.delete(), 74 | ) 75 | 76 | for file in iglob(f"{file_name}.*"): 77 | os.remove(file) 78 | 79 | 80 | # Command help section 81 | add_command_help( 82 | "git", 83 | [ 84 | [".lastcommit | .lc", "Gets the last commit message."], 85 | [".ggraph | .commitgraph", "Gets the commit graph for a Github user."], 86 | ], 87 | ) 88 | -------------------------------------------------------------------------------- /userbot/helpers/utility.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import math 3 | import random 4 | import time 5 | import uuid 6 | from random import randint 7 | 8 | 9 | def split_list(input_list, n): 10 | """ 11 | Takes a list and splits it into smaller lists of n elements each. 12 | :param input_list: 13 | :param n: 14 | :return: 15 | """ 16 | n = max(1, n) 17 | return [input_list[i : i + n] for i in range(0, len(input_list), n)] 18 | 19 | 20 | def human_time(*args, **kwargs): 21 | secs = float(datetime.timedelta(*args, **kwargs).total_seconds()) 22 | units = [("day", 86400), ("hour", 3600), ("minute", 60), ("second", 1)] 23 | parts = [] 24 | for unit, mul in units: 25 | if secs / mul >= 1 or mul == 1: 26 | if mul > 1: 27 | n = int(math.floor(secs / mul)) 28 | secs -= n * mul 29 | else: 30 | n = secs if secs != int(secs) else int(secs) 31 | parts.append("%s %s%s" % (n, unit, "" if n == 1 else "s")) 32 | return ", ".join(parts) 33 | 34 | 35 | def random_interval(): 36 | """ 37 | Get me a time delta between 4 hours and 12 hours. 38 | :return: int 39 | """ 40 | rand_value = randint(14400, 43200) 41 | delta = (time.time() + rand_value) - time.time() 42 | return int(delta) 43 | 44 | 45 | def get_random_hex(chars=4): 46 | """Generate random hex. limited to chars provided. 47 | If chars not provided then limit to 4 48 | """ 49 | my_hex = uuid.uuid4().hex[:chars] 50 | return my_hex 51 | 52 | 53 | def get_mock_text(sentence): 54 | new_sentence = "" 55 | number = 0 # Dummy number for tracking 56 | 57 | for letter in sentence.lower(): 58 | if len(new_sentence) < 2: # Creates the first two letter 59 | random_number = random.randint( 60 | 0, 1 61 | ) # This randomly decides if the letter should be upper or lowercase 62 | if random_number == 0: 63 | new_sentence += letter.upper() 64 | else: 65 | new_sentence += letter 66 | else: 67 | if ( 68 | new_sentence[number - 2].isupper() 69 | and new_sentence[number - 1].isupper() 70 | or new_sentence[number - 2].islower() 71 | and new_sentence[number - 1].islower() 72 | ): 73 | # Checks if the two letters before are both upper or lowercase 74 | if new_sentence[ 75 | number - 1 76 | ].isupper(): # Makes the next letter the opposite of the letter before 77 | new_sentence += letter.lower() 78 | else: 79 | new_sentence += letter.upper() 80 | else: 81 | random_number = random.randint(0, 1) 82 | if random_number == 0: 83 | new_sentence += letter.upper() 84 | else: 85 | new_sentence += letter 86 | 87 | number += 1 # Add one more to the tracking 88 | 89 | return new_sentence 90 | -------------------------------------------------------------------------------- /userbot/plugins/memes/some-random-api/animals.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import re 3 | 4 | from pyrogram import filters 5 | from pyrogram.types import Message 6 | 7 | from userbot import UserBot 8 | from userbot.helpers.PyroHelpers import ReplyCheck 9 | from userbot.helpers.aiohttp_helper import AioHttp 10 | from userbot.plugins.help import add_command_help 11 | 12 | animal = r"([^.]*)$" 13 | ok_exts = ["jpg", "jpeg", "png"] 14 | 15 | animals_without_facts = ['dog', 'cat', 'panda', 'fox', 'red_panda', 'birb', 'koala', 'kangaroo', 'racoon'] 16 | 17 | animals_with_facts = ['dog', 'cat', 'panda', 'fox', 'birb', 'koala', 'kangaroo', 'racoon', 'elephant', 'giraffe', 18 | 'whale'] 19 | 20 | 21 | async def prep_animal_image(input_animal): 22 | ext = "" 23 | image = None 24 | 25 | while ext not in ok_exts: 26 | data = await AioHttp().get_json(f"https://some-random-api.ml/animal/{input_animal}") 27 | image = data['image'] 28 | ext = re.search(animal, image).group(1).lower() 29 | 30 | return image 31 | 32 | 33 | @UserBot.on_message(filters.command(animals_without_facts, [".", ""]) & filters.me) 34 | async def animal_image(_, message: Message): 35 | cmd = message.command 36 | 37 | if len(message.command) > 1: 38 | return 39 | 40 | if cmd[0].lower() in animals_without_facts: 41 | await message.delete() 42 | await UserBot.send_photo( 43 | chat_id=message.chat.id, 44 | photo=await prep_animal_image(cmd[0].lower()), 45 | reply_to_message_id=ReplyCheck(message), 46 | ) 47 | 48 | 49 | @UserBot.on_message(filters.command("fact", ".") & filters.me) 50 | async def fact(_, message: Message): 51 | cmd = message.command 52 | 53 | if not (len(cmd) >= 2): 54 | await message.edit("```Not enough params provided```") 55 | await asyncio.sleep(3) 56 | await message.delete() 57 | return 58 | 59 | if cmd[1].lower() in animals_with_facts: 60 | await message.edit(f"```Getting {cmd[1]} fact```") 61 | 62 | link = "https://some-random-api.ml/facts/{animal}" 63 | 64 | fact_link = link.format(animal=cmd[1].lower()) 65 | 66 | try: 67 | data = await AioHttp().get_json(fact_link) 68 | fact_text = data["fact"] 69 | except Exception: 70 | await message.edit("```The fact API could not be reached```") 71 | await asyncio.sleep(3) 72 | await message.delete() 73 | else: 74 | await message.edit(fact_text, disable_web_page_preview=True) 75 | else: 76 | await message.edit("`Unsupported animal...`") 77 | await asyncio.sleep(2) 78 | await message.delete() 79 | 80 | 81 | # Animal image help 82 | animal_image_help = [] 83 | for x in animals_without_facts: 84 | animal_image_help.append([f".{x}", f"Sends a random picture of a {x}"]) 85 | 86 | animal_image_help.append(["These commands", "Works without the command prefix also"]) 87 | 88 | add_command_help("animals", animal_image_help) 89 | 90 | add_command_help( 91 | "facts", 92 | [ 93 | [f".fact {x}", f"Send a random fact about {x}"] 94 | for x in animals_with_facts 95 | ], 96 | ) 97 | -------------------------------------------------------------------------------- /userbot/helpers/file_sending_helpers.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os.path 3 | 4 | from pyrogram.types import Message 5 | 6 | from userbot import UserBot 7 | from userbot.helpers.PyroHelpers import ReplyCheck, GetChatID 8 | 9 | 10 | def reset_file_ids(): 11 | with open("file_ids.txt", "w") as f: 12 | f.write(json.dumps({})) 13 | 14 | 15 | if not os.path.exists("file_ids.txt"): 16 | reset_file_ids() 17 | 18 | 19 | async def get_old_message(message_id, media_type): 20 | old_message = await UserBot.get_messages("self", message_id) 21 | 22 | if media_type == "photo": 23 | return old_message.photo 24 | 25 | if media_type == "animation": 26 | return old_message.animation 27 | 28 | 29 | # Save the sent media's ID to file to send faster next time 30 | def save_media_id(name, media: Message): 31 | file_json = json.load(open("file_ids.txt", "r")) 32 | message_id = media.message_id 33 | file_json[name] = message_id 34 | with open("file_ids.txt", "w") as f: 35 | f.write(json.dumps(file_json)) 36 | 37 | 38 | # Function to reuse to send animation and remember the file_id 39 | async def send_saved_animation(message: Message, name: str, image: str, caption=None): 40 | files = json.load(open("file_ids.txt", "r")) 41 | 42 | if name in files: 43 | old_message = await get_old_message(int(files[name]), "animation") 44 | if old_message is not None: 45 | await UserBot.send_animation( 46 | message.chat.id, 47 | old_message.file_id, 48 | reply_to_message_id=ReplyCheck(message), 49 | caption=caption if caption is not None else "", 50 | ) 51 | else: 52 | # Reset file id list because of the one error 53 | reset_file_ids() 54 | await send_saved_animation(message, name, image, caption) 55 | else: 56 | sent_animation = await UserBot.send_animation( 57 | "self", 58 | "userbot/images/{}".format(image), 59 | reply_to_message_id=ReplyCheck(message), 60 | ) 61 | save_media_id(name, sent_animation) 62 | await send_saved_animation(message, name, image, caption) 63 | 64 | 65 | # Function to reuse to send image and save file_id 66 | async def send_saved_image(message: Message, name: str, image: str, caption=None): 67 | files = json.load(open("file_ids.txt", "r")) 68 | 69 | if name in files: 70 | old_message = await get_old_message(int(files[name]), "photo") 71 | if old_message is not None: 72 | await UserBot.send_photo( 73 | GetChatID(message), 74 | old_message.file_id, 75 | reply_to_message_id=ReplyCheck(message), 76 | caption=caption if caption is not None else "", 77 | ) 78 | else: 79 | # Reset file id list because of the one error 80 | reset_file_ids() 81 | await send_saved_image(message, name, image, caption) 82 | else: 83 | sent_photo = await UserBot.send_photo( 84 | "self", 85 | photo="userbot/images/{}".format(image), 86 | reply_to_message_id=ReplyCheck(message), 87 | ) 88 | save_media_id(name, sent_photo) 89 | await send_saved_image(message, name, image, caption) 90 | -------------------------------------------------------------------------------- /userbot/plugins/corona.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import datetime 3 | 4 | from prettytable import PrettyTable 5 | from pyrogram import filters 6 | from pyrogram.types import Message 7 | 8 | from userbot import UserBot 9 | from userbot.helpers.aiohttp_helper import AioHttp 10 | from userbot.plugins.help import add_command_help 11 | 12 | 13 | @UserBot.on_message(filters.command("c", ".") & filters.me) 14 | async def corona_all(_, message: Message): 15 | try: 16 | r = await AioHttp().get_json("https://corona.lmao.ninja/v2/all?yesterday=true") 17 | last_updated = datetime.datetime.fromtimestamp(r["updated"] / 1000).strftime( 18 | "%Y-%m-%d %I:%M:%S" 19 | ) 20 | 21 | ac = PrettyTable() 22 | ac.header = False 23 | ac.title = "Global Statistics" 24 | ac.add_row(["Cases", f"{r['cases']:,}"]) 25 | ac.add_row(["Cases Today", f"{r['todayCases']:,}"]) 26 | ac.add_row(["Deaths", f"{r['deaths']:,}"]) 27 | ac.add_row(["Deaths Today", f"{r['todayDeaths']:,}"]) 28 | ac.add_row(["Recovered", f"{r['recovered']:,}"]) 29 | ac.add_row(["Active", f"{r['active']:,}"]) 30 | ac.add_row(["Critical", f"{r['critical']:,}"]) 31 | ac.add_row(["Cases/Million", f"{r['casesPerOneMillion']:,}"]) 32 | ac.add_row(["Deaths/Million", f"{r['deathsPerOneMillion']:,}"]) 33 | ac.add_row(["Tests", f"{r['tests']:,}"]) 34 | ac.add_row(["Tests/Million", f"{r['testsPerOneMillion']:,}"]) 35 | ac.align = "l" 36 | 37 | await message.edit(f"```{str(ac)}```\nLast updated on: {last_updated}") 38 | except Exception as e: 39 | await message.edit("`The corona API could not be reached`") 40 | print(e) 41 | await asyncio.sleep(3) 42 | await message.delete() 43 | 44 | 45 | @UserBot.on_message(filters.command("cs", ".") & filters.me) 46 | async def corona_search(_, message: Message): 47 | cmd = message.command 48 | 49 | if not (len(cmd) >= 2): 50 | await message.edit("```Not enough params provided```") 51 | await asyncio.sleep(3) 52 | await message.delete() 53 | return 54 | 55 | country = cmd[1] 56 | await message.edit(f"```Getting Corona statistics for {country}```") 57 | 58 | r = await AioHttp().get_json(f"https://corona.lmao.ninja/v2/countries/{country}") 59 | if "cases" not in r: 60 | await message.edit("```The country could not be found!```") 61 | await asyncio.sleep(3) 62 | await message.delete() 63 | else: 64 | last_updated = datetime.datetime.fromtimestamp(r["updated"] / 1000).strftime( 65 | "%Y-%m-%d %I:%M:%S" 66 | ) 67 | 68 | cc = PrettyTable() 69 | cc.header = False 70 | country = r["countryInfo"]["iso3"] if len(r["country"]) > 12 else r["country"] 71 | cc.title = f"Corona Cases in {country}" 72 | cc.add_row(["Cases", f"{r['cases']:,}"]) 73 | cc.add_row(["Cases Today", f"{r['todayCases']:,}"]) 74 | cc.add_row(["Deaths", f"{r['deaths']:,}"]) 75 | cc.add_row(["Deaths Today", f"{r['todayDeaths']:,}"]) 76 | cc.add_row(["Recovered", f"{r['recovered']:,}"]) 77 | cc.add_row(["Active", f"{r['active']:,}"]) 78 | cc.add_row(["Critical", f"{r['critical']:,}"]) 79 | cc.add_row(["Cases/Million", f"{r['casesPerOneMillion']:,}"]) 80 | cc.add_row(["Deaths/Million", f"{r['deathsPerOneMillion']:,}"]) 81 | cc.add_row(["Tests", f"{r['tests']:,}"]) 82 | cc.add_row(["Tests/Million", f"{r['testsPerOneMillion']:,}"]) 83 | cc.align = "l" 84 | await message.edit(f"```{str(cc)}```\nLast updated on: {last_updated}") 85 | 86 | 87 | add_command_help( 88 | "corona", 89 | [ 90 | [".c", "Sends global corona stats: cases, deaths, recovered, and active cases"], 91 | [ 92 | ".cs Country", 93 | "Sends cases, new cases, deaths, new deaths, recovered, active cases, critical cases, " 94 | "and cases/deaths per one million people for a specific country", 95 | ], 96 | ], 97 | ) 98 | -------------------------------------------------------------------------------- /userbot/plugins/memes/stickers.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import random 3 | 4 | from pyrogram import filters 5 | from pyrogram.types import Message 6 | from userbot import UserBot 7 | from userbot.helpers.PyroHelpers import ReplyCheck 8 | from userbot.plugins.help import add_command_help 9 | 10 | sticker_data = { 11 | "mock": { 12 | "value": 7, 13 | "empty_message": "GiVE ME sOMEThINg TO MOCK", 14 | "action": "Mocking...", 15 | }, 16 | "ggl": { 17 | "value": 12, 18 | "empty_message": "Senpai, I need something to Google...", 19 | "action": "Googling...", 20 | }, 21 | "waifu": { 22 | "alts": ["ag", "animegirl"], 23 | "value": [15, 20, 32, 33, 34, 40, 41, 42, 58], 24 | "empty_message": "The waifu ran away...", 25 | "action": "Asking my wiafus to say it...", 26 | }, 27 | "animeboy": { 28 | "alts": ["ab"], 29 | "value": [37, 38, 48, 55], 30 | "empty_message": "Senpai, I need something to say...", 31 | "action": "The boys are on it...", 32 | }, 33 | } 34 | 35 | sticker_commands = [] 36 | for x in sticker_data: 37 | sticker_commands.append(x) 38 | if "alts" in sticker_data[x]: 39 | for y in sticker_data[x]["alts"]: 40 | sticker_commands.append(y) 41 | 42 | 43 | @UserBot.on_message(filters.command(sticker_commands, ".") & filters.me) 44 | async def sticker_super_func(_, message: Message): 45 | try: 46 | sticker = {} 47 | command = message.command[0] 48 | if command not in sticker_data: 49 | for sticker in sticker_data: 50 | if ( 51 | "alts" in sticker_data[sticker] 52 | and command in sticker_data[sticker]["alts"] 53 | ): 54 | sticker = sticker_data[sticker] 55 | break 56 | else: 57 | sticker = sticker_data[message.command[0]] 58 | 59 | cmd = message.command 60 | 61 | sticker_text = "" 62 | if len(cmd) > 1: 63 | sticker_text = " ".join(cmd[1:]) 64 | elif message.reply_to_message and len(cmd) == 1: 65 | sticker_text = message.reply_to_message.text 66 | elif not message.reply_to_message and len(cmd) == 1: 67 | await message.edit(sticker["empty_message"]) 68 | await asyncio.sleep(2) 69 | await message.delete() 70 | return 71 | 72 | await message.edit(f"`{sticker['action']}`") 73 | 74 | values = sticker["value"] 75 | choice = None 76 | if isinstance(values, list): 77 | choice = int(random.choice(values)) 78 | elif isinstance(values, int): 79 | choice = values 80 | 81 | if choice: 82 | sticker_results = await UserBot.get_inline_bot_results( 83 | "stickerizerbot", f"#{choice}" + sticker_text 84 | ) 85 | else: 86 | sticker_results = await UserBot.get_inline_bot_results( 87 | "stickerizerbot", sticker_text 88 | ) 89 | 90 | try: 91 | await UserBot.send_inline_bot_result( 92 | chat_id=message.chat.id, 93 | query_id=sticker_results.query_id, 94 | result_id=sticker_results.results[0].id, 95 | reply_to_message_id=ReplyCheck(message), 96 | hide_via=True, 97 | ) 98 | except TimeoutError: 99 | await message.edit("`@StickerizerBot didn't respond in time...`") 100 | await asyncio.sleep(2) 101 | except Exception: 102 | await message.edit("`Failed to reach @Stickerizerbot...`") 103 | await asyncio.sleep(2) 104 | await message.delete() 105 | 106 | 107 | # Command help section 108 | add_command_help( 109 | "stickers", 110 | [ 111 | [ 112 | ".mock", 113 | "Sends a Spongebob mocking meme of what you sent with command or text of what you replied to.\n" 114 | '**Usage**:\n```.mock you smell like shit``` will give you the meme that says "You smell like shit"\n' 115 | "Reply to a text message with .mock and it will grab the text of that message and generate the meme.", 116 | ], 117 | [ 118 | ".animegirl `or` .ag", 119 | "Sends a random anime girl sticker. Rules apply as above.", 120 | ], 121 | [".animeboy `or` .ab", "Sends a random boy sticker. Rules apply as above."], 122 | [ 123 | ".ggl", 124 | "Sends google search buttons with the query you give it. Rules apply as above.", 125 | ], 126 | ], 127 | ) 128 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MR.ROBOT Userbot 2 | ![Python Version](https://img.shields.io/badge/Python-v3.9-blue) 3 | [![Join Group](https://img.shields.io/badge/Telegram-Join%20Group-informational)](https://t.me/program4hack) 4 | [![Contributors](https://img.shields.io/github/contributors/AKHACKER-program4hack/mrrobot)](https://github.com/AKHACKER-program4hack/mrrobot/graphs/contributors) 5 | ![Last Commit](https://img.shields.io/github/last-commit/AKHACKER-program4hack/mrrobot/main) 6 | ![Issues](https://img.shields.io/github/issues/AKHACKER-program4hack/mrrobot) 7 | ![Pull Requests](https://img.shields.io/github/issues-pr/AKHACKER-program4hack/mrrobot) 8 | 9 | 10 | 11 | > A Telegram Userbot based on [Pyrogram](https://github.com/pyrogram/pyrogram) 12 | 13 | This repository contains the source code of a Telegram Userbot and the instructions for running a 14 | copy yourself. Beside its main purpose, the bot is featuring [**Pyrogram Asyncio**](https:////github.com/pyrogram/pyrogram/issues/181) and 15 | [**Smart Plugins**](https://docs.pyrogram.org/topics/smart-plugins); feel free to explore the source code to 16 | learn more about these topics. 17 | 18 | I assume you will read this whole README.md file before continuing. 19 | 20 | > Development in progress. 21 | 22 | ## Requirements 23 | You're gonna need to get the following programs and services either installed on your server 24 | or signed up for. You must do all. It is a cardinal sin if you don't. 25 | 26 | * `virtualenv` installed so that the packages don't interfere with other system packages. 27 | 28 | ## Installing 29 | 30 | 42 | 43 | #### Quick Deploy on Heroku using the button down below: 44 | 45 | [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/AKHACKER-program4hack/mrrobot) 46 | 47 | #### Quick Deploy on Railway using the button down below: 48 | 49 | [![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template?template=https%3A%2F%2Fgithub.com%2FAKHACKER-program4hack%2Fmrrobot&envs=API_ID%2CAPI_HASH%2CUSERBOT_SESSION&API_IDDesc=Get+from+https%3A%2F%2Fmy.telegram.org%2Fapps&API_HASHDesc=Get+from+https%3A%2F%2Fmy.telegram.org%2Fapps&USERBOT_SESSIONDesc=Get+it+from+https%3A%2F%2Freplit.com%2F%40program4hack%2Fmrrobotsessioncreator%23main.py&referralCode=w6Llh-) 50 | 51 | 52 | *To Get USERBOT_SESSION CLICK Blow Button* : 53 | 54 | [![Run on Repl.it](https://repl.it/badge/github/@program4hack/mrrobotsessioncreator#main.py)](https://repl.it/@program4hack/mrrobotsessioncreator#main.py) 55 | 56 | *USE Termux To Get USERBOT_SESSION* : 57 | 58 | ``` 59 | pkg install python && pkg install wget && python -m pip install Pyrogram==1.1.13 && wget https://raw.githubusercontent.com/AKHACKER-program4hack/mrrobot/main/sessioncreater.py && python sessioncreater.py 60 | ``` 61 | 62 | *The way I deploy* 63 | ```bash 64 | git clone https://github.com/AKHACKER-program4hack/mrrobot.git 65 | cd userbot 66 | python3 -m venv env 67 | source env/bin/activate 68 | pip3 install -r requirements.txt 69 | python3 sessioncreater.py 70 | python3 -m userbot. 71 | ``` 72 | 73 | 74 | 75 | ## Developing 76 | To add extra modules to the bot, simply add the code into [userbot/plugins](userbot/plugins).I have made to functions for it first is ```.download``` which download media you can see in general in help menu and other is ```.load_plugin``` which load_plugin from download directory to plugin directory 77 | .Each file 78 | that is added to the plugins directory should have the following code at a minimum. 79 | ```python 80 | from pyrogram import filters 81 | 82 | from userbot import UserBot 83 | 84 | @UserBot.on_message(filters.command('sample', ['.'])) 85 | async def module_name(client, message): 86 | await message.edit( 87 | "This is a sample module" 88 | ) 89 | ``` 90 | 91 | This example is only for Pyrogram on_message events. 92 | 93 | # For New Plugins visit : 94 | 95 | [![Plugins](https://img.shields.io/badge/Mrrobot-plugins-informational)](https://github.com/AKHACKER-program4hack/mrrobot-plugins) 96 | 97 | 98 | ## Credits, and Thanks to 99 | 100 | * [AKHACKER](https://github.com/AKHACKER-program4hack) Owner Of the Userbot. 101 | 102 | --- 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /userbot/plugins/memes/fixed_memes.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters, emoji 2 | from pyrogram.types import Message 3 | from userbot import UserBot 4 | from userbot.helpers.file_sending_helpers import send_saved_image, send_saved_animation 5 | from userbot.plugins.help import add_command_help 6 | 7 | memes_data = { 8 | "fast": { 9 | "name": "fast_image", 10 | "image": "fast.jpg", 11 | "type": "image", 12 | "caption": "I. Am. Speed.", 13 | "help": "Picture of Lightning McQueen and says 'I am speed'", 14 | }, 15 | "tfb": { 16 | "alts": ["tbf"], 17 | "name": "tfb_image", 18 | "image": "tfb.jpg", 19 | "type": "image", 20 | "caption": None, 21 | "help": "Some guy saying 'The Fuah Balhaa'", 22 | }, 23 | "kill": { 24 | "name": "kill_image", 25 | "image": "killua.gif", 26 | "type": "animation", 27 | "caption": "I will kill you.", 28 | "help": "Gif of Killua from Hunter X Hunter.", 29 | }, 30 | "lust": { 31 | "name": "lust_gif", 32 | "image": "lust.gif", 33 | "type": "animation", 34 | "caption": f"I wanna do bad things with you {emoji.SMIRKING_FACE}", 35 | "help": "Gif of lustful things.", 36 | }, 37 | "dmf": { 38 | "name": "dmf_image", 39 | "image": "dmf.gif", 40 | "type": "animation", 41 | "caption": None, 42 | "help": 'Syndrome from The Incredible\'s saying "You dense mf".', 43 | }, 44 | "smart": { 45 | "alts": ["intelligence"], 46 | "name": "intelligence_image", 47 | "image": "intelligence.jpg", 48 | "type": "image", 49 | "caption": None, 50 | "help": "Press E to use intelligence.", 51 | }, 52 | "sobimin": { 53 | "name": "sob_im_in_image", 54 | "image": "sob_im_in.jpg", 55 | "type": "image", 56 | "caption": None, 57 | "help": "Morty - SOB I'm In", 58 | }, 59 | "omg": { 60 | "name": "omg_image", 61 | "image": "omg.gif", 62 | "type": "animation", 63 | "caption": None, 64 | "help": "Anime character saying OMG.", 65 | }, 66 | "ma": { 67 | "name": "ma_image", 68 | "image": "ma.JPG", 69 | "type": "image", 70 | "caption": None, 71 | "help": "Anime character saying mashaallah.", 72 | }, 73 | "sa": { 74 | "name": "sa_image", 75 | "image": "sa.JPG", 76 | "type": "image", 77 | "caption": None, 78 | "help": "Anime character saying subuhanallah.", 79 | }, 80 | "al": { 81 | "name": "al_image", 82 | "image": "al.JPG", 83 | "type": "image", 84 | "caption": None, 85 | "help": "Anime character saying alhamdhulilah.", 86 | }, 87 | "astf": { 88 | "name": "astf_image", 89 | "image": "astf.JPG", 90 | "type": "image", 91 | "caption": None, 92 | "help": "Anime character saying asthagfirullah.", 93 | }, 94 | "ia": { 95 | "name": "ia_image", 96 | "image": "ia.JPG", 97 | "type": "image", 98 | "caption": None, 99 | "help": "Anime character inshaallah.", 100 | }, 101 | "dumb": { 102 | "name": "dumb", 103 | "image": "dumb.jpg", 104 | "type": "image", 105 | "caption": None, 106 | "help": "Are you dumb?.", 107 | }, 108 | } 109 | 110 | memes = [] 111 | fixed_memes_help = [] 112 | for meme in memes_data: 113 | memes.append(meme) 114 | if "alts" in memes_data[meme]: 115 | for y in memes_data[meme]["alts"]: 116 | memes.append(y) 117 | 118 | # Construct the help from the same loop eh. 119 | command = f".{meme}" 120 | if "alts" in memes_data[meme]: 121 | for y in memes_data[meme]["alts"]: 122 | command += f" __or__ .{y}" 123 | fixed_memes_help.append([command, memes_data[meme]["help"]]) 124 | 125 | 126 | @UserBot.on_message(filters.command(memes, ".") & filters.me) 127 | async def fixed_memes(_, message: Message): 128 | await message.delete() 129 | 130 | cmd = message.command[0] 131 | if cmd not in memes_data: 132 | for x in memes_data: 133 | if "alts" in memes_data[x] and cmd in memes_data[x]["alts"]: 134 | the_meme = memes_data[x] 135 | break 136 | else: 137 | the_meme = memes_data[message.command[0]] 138 | 139 | if the_meme["type"] == "animation": 140 | await send_saved_animation( 141 | message, the_meme["name"], the_meme["image"], caption=the_meme["caption"] 142 | ) 143 | elif the_meme["type"] == "image": 144 | await send_saved_image( 145 | message, the_meme["name"], the_meme["image"], caption=the_meme["caption"] 146 | ) 147 | 148 | 149 | # Command help section 150 | add_command_help("memes", fixed_memes_help) 151 | -------------------------------------------------------------------------------- /userbot/plugins/afk.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from datetime import datetime 3 | 4 | import humanize 5 | from pyrogram import filters 6 | from pyrogram.types import Message 7 | 8 | from userbot import UserBot 9 | from userbot.helpers.PyroHelpers import GetChatID 10 | from userbot.plugins.help import add_command_help 11 | 12 | AFK = False 13 | AFK_REASON = "" 14 | AFK_TIME = "" 15 | USERS = {} 16 | GROUPS = {} 17 | 18 | 19 | def subtract_time(start, end): 20 | """Get humanized time""" 21 | subtracted = humanize.naturaltime(start - end) 22 | return str(subtracted) 23 | 24 | 25 | @UserBot.on_message( 26 | ((filters.group & filters.mentioned) | filters.private) & ~filters.me & ~filters.service, group=3 27 | ) 28 | async def collect_afk_messages(_, message: Message): 29 | if AFK: 30 | last_seen = subtract_time(datetime.now(), AFK_TIME) 31 | is_group = True if message.chat.type in ["supergroup", "group"] else False 32 | CHAT_TYPE = GROUPS if is_group else USERS 33 | 34 | if GetChatID(message) not in CHAT_TYPE: 35 | text = ( 36 | f"`Beep boop. This is an automated message.\n" 37 | f"I am not available right now.\n" 38 | f"Last seen: {last_seen}\n" 39 | f"Reason: ```{AFK_REASON.upper()}```\n" 40 | f"See you after I'm done doing whatever I'm doing.`" 41 | ) 42 | await UserBot.send_message( 43 | chat_id=GetChatID(message), 44 | text=text, 45 | reply_to_message_id=message.message_id, 46 | ) 47 | CHAT_TYPE[GetChatID(message)] = 1 48 | return 49 | elif GetChatID(message) in CHAT_TYPE: 50 | if CHAT_TYPE[GetChatID(message)] == 50: 51 | text = ( 52 | f"`This is an automated message\n" 53 | f"Last seen: {last_seen}\n" 54 | f"This is the 10th time I've told you I'm AFK right now..\n" 55 | f"I'll get to you when I get to you.\n" 56 | f"No more auto messages for you`" 57 | ) 58 | await UserBot.send_message( 59 | chat_id=GetChatID(message), 60 | text=text, 61 | reply_to_message_id=message.message_id, 62 | ) 63 | elif CHAT_TYPE[GetChatID(message)] > 50: 64 | return 65 | elif CHAT_TYPE[GetChatID(message)] % 5 == 0: 66 | text = ( 67 | f"`Hey I'm still not back yet.\n" 68 | f"Last seen: {last_seen}\n" 69 | f"Still busy: ```{AFK_REASON.upper()}```\n" 70 | f"Try pinging a bit later.`" 71 | ) 72 | await UserBot.send_message( 73 | chat_id=GetChatID(message), 74 | text=text, 75 | reply_to_message_id=message.message_id, 76 | ) 77 | 78 | CHAT_TYPE[GetChatID(message)] += 1 79 | 80 | 81 | @UserBot.on_message(filters.command("afk", ".") & filters.me, group=3) 82 | async def afk_set(_, message: Message): 83 | global AFK_REASON, AFK, AFK_TIME 84 | 85 | cmd = message.command 86 | afk_text = "" 87 | 88 | if len(cmd) > 1: 89 | afk_text = " ".join(cmd[1:]) 90 | 91 | if isinstance(afk_text, str): 92 | AFK_REASON = afk_text 93 | 94 | AFK = True 95 | AFK_TIME = datetime.now() 96 | 97 | await message.delete() 98 | 99 | 100 | @UserBot.on_message(filters.command("afk", "!") & filters.me, group=3) 101 | async def afk_unset(_, message: Message): 102 | global AFK, AFK_TIME, AFK_REASON, USERS, GROUPS 103 | 104 | if AFK: 105 | last_seen = subtract_time(datetime.now(), AFK_TIME).replace("ago", "").strip() 106 | await message.edit( 107 | f"`While you were away (for {last_seen}), you received {sum(USERS.values()) + sum(GROUPS.values())} " 108 | f"messages from {len(USERS) + len(GROUPS)} chats`" 109 | ) 110 | AFK = False 111 | AFK_TIME = "" 112 | AFK_REASON = "" 113 | USERS = {} 114 | GROUPS = {} 115 | await asyncio.sleep(5) 116 | 117 | await message.delete() 118 | 119 | 120 | @UserBot.on_message(filters.me, group=3) 121 | async def auto_afk_unset(_, message: Message): 122 | global AFK, AFK_TIME, AFK_REASON, USERS, GROUPS 123 | 124 | if AFK: 125 | last_seen = subtract_time(datetime.now(), AFK_TIME).replace("ago", "").strip() 126 | reply = await message.reply( 127 | f"`While you were away (for {last_seen}), you received {sum(USERS.values()) + sum(GROUPS.values())} " 128 | f"messages from {len(USERS) + len(GROUPS)} chats`" 129 | ) 130 | AFK = False 131 | AFK_TIME = "" 132 | AFK_REASON = "" 133 | USERS = {} 134 | GROUPS = {} 135 | await asyncio.sleep(5) 136 | await reply.delete() 137 | 138 | 139 | add_command_help( 140 | "afk", 141 | [ 142 | [ 143 | ".afk", 144 | "Activates AFK mode with reason as anything after .afk\nUsage: ```.afk ```", 145 | ], 146 | ["!afk", "Deactivates AFK mode."], 147 | ], 148 | ) 149 | -------------------------------------------------------------------------------- /userbot/plugins/whois.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | from time import sleep 3 | 4 | from pyrogram import filters 5 | from pyrogram.raw import functions 6 | from pyrogram.types import Message, User 7 | from pyrogram.errors import PeerIdInvalid 8 | 9 | from userbot import UserBot 10 | from userbot.helpers.PyroHelpers import ReplyCheck 11 | from userbot.plugins.help import add_command_help 12 | 13 | WHOIS = ( 14 | '**WHO IS "{full_name}"?**\n' 15 | "[Link to profile](tg://user?id={user_id})\n" 16 | "════════════════\n" 17 | "UserID: `{user_id}`\n" 18 | "First Name: `{first_name}`\n" 19 | "Last Name: `{last_name}`\n" 20 | "Username: `{username}`\n" 21 | "Last Online: `{last_online}`\n" 22 | "Common Groups: `{common_groups}`\n" 23 | "════════════════\n" 24 | "Bio:\n{bio}" 25 | ) 26 | 27 | WHOIS_PIC = ( 28 | '**WHO IS "{full_name}"?**\n' 29 | "[Link to profile](tg://user?id={user_id})\n" 30 | "════════════════\n" 31 | "UserID: `{user_id}`\n" 32 | "First Name: `{first_name}`\n" 33 | "Last Name: `{last_name}`\n" 34 | "Username: `{username}`\n" 35 | "Last Online: `{last_online}`\n" 36 | "Common Groups: `{common_groups}`\n" 37 | "════════════════\n" 38 | "Profile Pics: `{profile_pics}`\n" 39 | "Last Updated: `{profile_pic_update}`\n" 40 | "════════════════\n" 41 | "Bio:\n{bio}" 42 | ) 43 | 44 | 45 | def LastOnline(user: User): 46 | if user.is_bot: 47 | return "" 48 | elif user.status == "recently": 49 | return "Recently" 50 | elif user.status == "within_week": 51 | return "Within the last week" 52 | elif user.status == "within_month": 53 | return "Within the last month" 54 | elif user.status == "long_time_ago": 55 | return "A long time ago :(" 56 | elif user.status == "online": 57 | return "Currently Online" 58 | elif user.status == "offline": 59 | return datetime.fromtimestamp(user.status.date).strftime( 60 | "%a, %d %b %Y, %H:%M:%S" 61 | ) 62 | 63 | 64 | async def GetCommon(get_user): 65 | common = await UserBot.send( 66 | functions.messages.GetCommonChats( 67 | user_id=await UserBot.resolve_peer(get_user), max_id=0, limit=0 68 | ) 69 | ) 70 | return common 71 | 72 | 73 | def FullName(user: User): 74 | return user.first_name + " " + user.last_name if user.last_name else user.first_name 75 | 76 | 77 | def ProfilePicUpdate(user_pic): 78 | return datetime.fromtimestamp(user_pic[0].date).strftime("%d.%m.%Y, %H:%M:%S") 79 | 80 | 81 | @UserBot.on_message(filters.command("whois", [".", ""]) & filters.me) 82 | async def summon_here(_, message: Message): 83 | cmd = message.command 84 | if not message.reply_to_message and len(cmd) == 1: 85 | get_user = message.from_user.id 86 | elif message.reply_to_message and len(cmd) == 1: 87 | get_user = message.reply_to_message.from_user.id 88 | elif len(cmd) > 1: 89 | get_user = cmd[1] 90 | try: 91 | get_user = int(cmd[1]) 92 | except ValueError: 93 | pass 94 | try: 95 | user = await UserBot.get_users(get_user) 96 | except PeerIdInvalid: 97 | await message.edit("I don't know that User.") 98 | sleep(2) 99 | await message.delete() 100 | return 101 | desc = await UserBot.get_chat(get_user) 102 | desc = desc.description 103 | user_pic = await UserBot.get_profile_photos(user.id) 104 | pic_count = await UserBot.get_profile_photos_count(user.id) 105 | common = await GetCommon(user.id) 106 | 107 | if not user.photo: 108 | await message.edit( 109 | WHOIS.format( 110 | full_name=FullName(user), 111 | user_id=user.id, 112 | first_name=user.first_name, 113 | last_name=user.last_name if user.last_name else "", 114 | username=user.username if user.username else "", 115 | last_online=LastOnline(user), 116 | common_groups=len(common.chats), 117 | bio=desc if desc else "`No bio set up.`", 118 | ), 119 | disable_web_page_preview=True, 120 | ) 121 | elif user.photo: 122 | await UserBot.send_photo( 123 | message.chat.id, 124 | user_pic[0].file_id, 125 | caption=WHOIS_PIC.format( 126 | full_name=FullName(user), 127 | user_id=user.id, 128 | first_name=user.first_name, 129 | last_name=user.last_name if user.last_name else "", 130 | username=user.username if user.username else "", 131 | last_online=LastOnline(user), 132 | profile_pics=pic_count, 133 | common_groups=len(common.chats), 134 | bio=desc if desc else "`No bio set up.`", 135 | profile_pic_update=ProfilePicUpdate(user_pic), 136 | ), 137 | reply_to_message_id=ReplyCheck(message), 138 | ) 139 | await message.delete() 140 | 141 | 142 | add_command_help( 143 | "whois", 144 | [ 145 | [ 146 | ".whois", 147 | "Finds out who the person is. Reply to message sent by the person" 148 | "you want information from and send the command. Without the dot also works.", 149 | ] 150 | ], 151 | ) 152 | -------------------------------------------------------------------------------- /userbot/plugins/hacker/addmember.py: -------------------------------------------------------------------------------- 1 | import time 2 | from pyrogram import filters 3 | from userbot import UserBot 4 | from userbot.helpers.PyroHelpers import GetChatID 5 | from userbot.plugins.help import add_command_help 6 | from pyrogram.raw import functions 7 | 8 | @UserBot.on_message(filters.me & filters.text & filters.command("add_members",".")) 9 | async def hi(client, message): 10 | cmd = message.command 11 | fromgroup = cmd[1] 12 | togroup = cmd[2] 13 | if len(fromgroup) > 0 and len(togroup) > 0: 14 | async def GetCommon(get_user): 15 | common = await client.send( 16 | functions.messages.GetCommonChats( 17 | user_id=await client.resolve_peer(get_user), max_id=0, limit=0 18 | ) 19 | ) 20 | return common 21 | failed = 0 22 | added = 0 23 | already = 0 24 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="adding members\nadded : " + str(added)) 25 | msgid = d.message_id 26 | chatid = d.chat['id'] 27 | comd = message.message_id 28 | comdchat = message.chat['id'] 29 | tog = cmd[2].split("@")[1] 30 | async for member in client.iter_chat_members(fromgroup): 31 | msg = await client.get_messages(comdchat,comd) 32 | common = await GetCommon(member.user.id) 33 | try: 34 | if msg.text == None: 35 | await d.reply("message is deleted member adding is stopped") 36 | break 37 | else: 38 | if member.user.is_bot == False and f'"username": "{tog}"' not in str(common): #.is_bot == False: 39 | print("before add") 40 | status = await client.add_chat_members(togroup, int(member.user.id)) 41 | # print(status) 42 | print("after add") 43 | if status: 44 | await client.edit_message_text(chatid,msgid,"adding members" + "\nalready : " + str(already)+"\nadded : " + str(added) + "\nfailed : " + str(failed)) 45 | added += 1 46 | else: 47 | await client.edit_message_text(chatid,msgid,"adding members" + "\nalready : " + str(already)+"\nadded : " + str(added) + "\nfailed : " + str(failed)) 48 | failed += 1 49 | else: 50 | await client.edit_message_text(chatid,msgid,"adding members" + "\nalready : " + str(already)+"\nadded : " + str(added) + "\nfailed : " + str(failed)) 51 | already += 1 52 | except Exception as error: 53 | if "CHAT_ADMIN_REQUIRED" in str(error): 54 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="CHAT_ADMIN_REQUIRED") 55 | failed += 1 56 | elif "BROADCAST_FORBIDDEN" in str(error): 57 | # await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="BROADCAST_FORBIDDEN") 58 | failed += 1 59 | elif "CHANNEL_PUBLIC_GROUP_NA" in str(error): 60 | # await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="CHANNEL_PUBLIC_GROUP_NA") 61 | failed += 1 62 | elif "CHAT_ADMIN_INVITE_REQUIRED" in str(error): 63 | # await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="CHAT_ADMIN_INVITE_REQUIRED") 64 | failed += 1 65 | elif "CHAT_FORBIDDEN" in str(error): 66 | # await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="CHAT_FORBIDDEN") 67 | failed += 1 68 | elif "USER_NOT_MUTUAL_CONTACT" in str(error): 69 | # await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="USER_NOT_MUTUAL_CONTACT") 70 | failed += 1 71 | elif "USER_PRIVACY_RESTRICTED" in str(error): 72 | failed += 1 73 | continue 74 | elif "account is currently limited" in str(error): 75 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="The account is currently limited for this action restart bot and try later") 76 | failed += 1 77 | break 78 | else: 79 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text=str(error)) 80 | second = await client.send_message(chat_id=chatid,reply_to_message_id=int(message.message_id),text="adding members" + "\talready : " + str(already)+"\nadded : " + str(added) + "\nfailed : " + str(failed)) 81 | continue 82 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Finished adding members") 83 | else: 84 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Invalid arguments") 85 | 86 | 87 | 88 | add_command_help( 89 | "hackers", 90 | [ 91 | [ 92 | ".add_members", 93 | "ADD MEMBERS from one group to other group \nUsage: ``.add_members ``", 94 | ], 95 | ], 96 | ) 97 | -------------------------------------------------------------------------------- /userbot/plugins/admin/administrator.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | from pyrogram import filters 4 | from pyrogram.types import Message, ChatPermissions 5 | 6 | from pyrogram.errors import UserAdminInvalid 7 | 8 | from userbot import UserBot 9 | from userbot.helpers.PyroHelpers import GetUserMentionable 10 | from userbot.helpers.adminHelpers import CheckAdmin, CheckReplyAdmin, RestrictFailed 11 | from userbot.plugins.help import add_command_help 12 | 13 | 14 | @UserBot.on_message(filters.command("ban", ".") & filters.me) 15 | async def ban_hammer(_, message: Message): 16 | if await CheckReplyAdmin(message) is True and await CheckAdmin(message) is True: 17 | try: 18 | mention = GetUserMentionable(message.reply_to_message.from_user) 19 | if message.command == ["ban", "24"]: 20 | await UserBot.kick_chat_member( 21 | chat_id=message.chat.id, 22 | user_id=message.reply_to_message.from_user.id, 23 | until_date=int(time.time() + 86400), 24 | ) 25 | await message.edit(f"{mention} has been banned for 24hrs.") 26 | else: 27 | await UserBot.kick_chat_member( 28 | chat_id=message.chat.id, 29 | user_id=message.reply_to_message.from_user.id, 30 | ) 31 | await message.edit(f"{mention} has been banned indefinitely.") 32 | except UserAdminInvalid: 33 | await RestrictFailed(message) 34 | 35 | 36 | @UserBot.on_message(filters.command("unban", ".") & filters.me) 37 | async def unban(_, message: Message): 38 | if await CheckReplyAdmin(message) is True and await CheckAdmin(message) is True: 39 | try: 40 | mention = GetUserMentionable(message.reply_to_message.from_user) 41 | await UserBot.unban_chat_member( 42 | chat_id=message.chat.id, user_id=message.reply_to_message.from_user.id 43 | ) 44 | await message.edit( 45 | f"Congratulations {mention} you have been unbanned." 46 | " Follow the rules and be careful from now on." 47 | ) 48 | except UserAdminInvalid: 49 | await message.edit("I can't unban this user.") 50 | 51 | 52 | # Mute Permissions 53 | mute_permission = ChatPermissions( 54 | can_send_messages=False, 55 | can_send_media_messages=False, 56 | can_send_stickers=False, 57 | can_send_animations=False, 58 | can_send_games=False, 59 | can_use_inline_bots=False, 60 | can_add_web_page_previews=False, 61 | can_send_polls=False, 62 | can_change_info=False, 63 | can_invite_users=True, 64 | can_pin_messages=False, 65 | ) 66 | 67 | 68 | @UserBot.on_message(filters.command(["mute", "mute 24"], ".") & filters.me) 69 | async def mute_hammer(_, message: Message): 70 | if await CheckReplyAdmin(message) is True and await CheckAdmin(message) is True: 71 | try: 72 | mention = GetUserMentionable(message.reply_to_message.from_user) 73 | if message.command == ["mute", "24"]: 74 | await UserBot.restrict_chat_member( 75 | chat_id=message.chat.id, 76 | user_id=message.reply_to_message.from_user.id, 77 | permissions=mute_permission, 78 | until_date=int(time.time() + 86400), 79 | ) 80 | await message.edit(f"{mention} has been muted for 24hrs.") 81 | else: 82 | await UserBot.restrict_chat_member( 83 | chat_id=message.chat.id, 84 | user_id=message.reply_to_message.from_user.id, 85 | permissions=mute_permission, 86 | ) 87 | await message.edit(f"{mention} has been muted indefinitely.") 88 | except UserAdminInvalid: 89 | await RestrictFailed(message) 90 | 91 | 92 | # Unmute permissions 93 | unmute_permissions = ChatPermissions( 94 | can_send_messages=True, 95 | can_send_media_messages=True, 96 | can_send_stickers=True, 97 | can_send_animations=True, 98 | can_send_games=True, 99 | can_use_inline_bots=True, 100 | can_add_web_page_previews=True, 101 | can_send_polls=True, 102 | can_change_info=False, 103 | can_invite_users=True, 104 | can_pin_messages=False, 105 | ) 106 | 107 | 108 | @UserBot.on_message(filters.command("unmute", ".") & filters.me) 109 | async def unmute(_, message: Message): 110 | if await CheckReplyAdmin(message) is True and await CheckAdmin(message) is True: 111 | try: 112 | mention = GetUserMentionable(message.reply_to_message.from_user) 113 | await UserBot.restrict_chat_member( 114 | chat_id=message.chat.id, 115 | user_id=message.reply_to_message.from_user.id, 116 | permissions=unmute_permissions, 117 | ) 118 | await message.edit(f"{mention}, you may send messages here now.") 119 | except UserAdminInvalid: 120 | await RestrictFailed(message) 121 | 122 | 123 | @UserBot.on_message(filters.command("kick", ".") & filters.me) 124 | async def kick_user(_, message: Message): 125 | if await CheckReplyAdmin(message) is True and await CheckAdmin(message) is True: 126 | try: 127 | mention = GetUserMentionable(message.reply_to_message.from_user) 128 | await UserBot.kick_chat_member( 129 | chat_id=message.chat.id, 130 | user_id=message.reply_to_message.from_user.id, 131 | ) 132 | await message.edit(f"{mention}, Sayonara motherfucker.") 133 | except UserAdminInvalid: 134 | await RestrictFailed(message) 135 | 136 | 137 | add_command_help( 138 | "ban", 139 | [ 140 | [".ban", "Bans user indefinitely."], 141 | [".ban 24", "Bans user for 24hrs."], 142 | [".unban", "Unbans the user."], 143 | [".mute", "Mutes user indefinitely."], 144 | [".mute 24", "Bans user for 24hrs."], 145 | [".unmute", "Unmutes the user."], 146 | [".kick", "Kicks the user out of the group."], 147 | ], 148 | ) 149 | -------------------------------------------------------------------------------- /userbot/plugins/file_manager/handlers.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | from userbot import UserBot 3 | from userbot.plugins.help import add_command_help 4 | from userbot.helpers.PyroHelpers import GetChatID 5 | import time 6 | import os 7 | from pathlib import Path 8 | import sys 9 | from shutil import copyfile 10 | import magic 11 | 12 | @UserBot.on_message(filters.me & filters.text & filters.command("ls",".")) 13 | async def list_dir(client, message): 14 | cmd = message.command 15 | if len(cmd) > 1: 16 | try: 17 | directory_param = cmd[1] 18 | directory = UserBot.main_directory + "/userbot" + "/" + directory_param# + f"/{directory}" 19 | files = os.listdir(directory) 20 | view = "**__List items in "+ directory_param + "__** : \n" 21 | for f in files: 22 | if os.path.isdir(directory + "/" + f): 23 | view += "\n📂 " + f 24 | else: 25 | view += "\n📄 " + f 26 | await client.delete_messages(GetChatID(message),message.message_id) 27 | d = await client.send_message(chat_id=message.chat["id"], text=view) 28 | except Exception as error: 29 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text=str(error)) 30 | else: 31 | try: 32 | # extention = message.reply_to_message 33 | # print(message.reply_to_message) 34 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="invalid directory") 35 | except Exception as error: 36 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text=str(error)) 37 | 38 | @UserBot.on_message(filters.me & filters.text & filters.command("del",".")) 39 | async def download(client, message): 40 | cmd = message.command 41 | if len(cmd) > 1: 42 | try: 43 | file_param = cmd[1] 44 | file_to_del = UserBot.main_directory + "/userbot" + "/" + file_param# + f"/{directory}" 45 | try: 46 | status = os.system("rm -rf \"" + file_to_del + "\"") 47 | d = await client.send_message(chat_id=message.chat["id"], text="deleted\n") 48 | await client.delete_messages(GetChatID(message),message.message_id) 49 | time.sleep(3) 50 | await client.delete_messages(GetChatID(d),d.message_id) 51 | except Exception as error: 52 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text=str(error)) 53 | 54 | except Exception as error: 55 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text=str(error)) 56 | else: 57 | try: 58 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="invalid directory") 59 | except Exception as error: 60 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text=str(error)) 61 | 62 | @UserBot.on_message(filters.me & filters.text & filters.command("send",".")) 63 | async def send_files(client, message): 64 | cmd = message.command 65 | async def progress(current, total): 66 | await message.edit(f"uploaded {current * 100 / total:.1f}%") 67 | 68 | if len(cmd) > 1: 69 | try: 70 | file_param = cmd[1] 71 | if cmd[2]: 72 | caption_text = cmd[2] 73 | else: caption_text = None 74 | file_to_upload = str(UserBot.WORKDIR) + "/userbot" + "/" + file_param# + f"/{directory}" 75 | try: 76 | filetype = magic.from_file(file_to_upload) 77 | if "document" in filetype: 78 | await UserBot.send_document(GetChatID(message), file_to_upload, progress=progress,caption=caption_text) 79 | elif "script" in filetype: 80 | await UserBot.send_document(GetChatID(message), file_to_upload, progress=progress,caption=caption_text) 81 | elif "GIF" in filetype: 82 | await UserBot.send_animation(GetChatID(message), file_to_upload, progress=progress,caption=caption_text) 83 | elif "image" in filetype: 84 | await UserBot.send_photo(GetChatID(message), file_to_upload, progress=progress,caption=caption_text) 85 | elif "Media" in filetype: 86 | await UserBot.send_video(GetChatID(message), file_to_upload, progress=progress,caption=caption_text) 87 | elif "Audio" in filetype: 88 | await UserBot.send_audio(GetChatID(message), file_to_upload, progress=progress,caption=caption_text) 89 | await client.delete_messages(GetChatID(message),message.message_id) 90 | time.sleep(3) 91 | except Exception as error: 92 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text=str(error)) 93 | 94 | except Exception as error: 95 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text=str(error)) 96 | else: 97 | try: 98 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="invalid directory") 99 | except Exception as error: 100 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text=str(error)) 101 | 102 | 103 | add_command_help( 104 | "filemanager", 105 | [ 106 | [ 107 | ".ls", 108 | "show list of files in a directory\nUsage: ``.ls ``", 109 | ],[ 110 | ".del", 111 | "Delete file or directory\nUsage: ``.del ``", 112 | ], 113 | [ 114 | ".send", 115 | "send file from any directory\nUsage: ``.send ``", 116 | ], 117 | 118 | 119 | ], 120 | ) 121 | -------------------------------------------------------------------------------- /userbot/plugins/1start.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from datetime import datetime 3 | from platform import python_version 4 | 5 | from pyrogram import filters 6 | from pyrogram.types import Message 7 | from pyrogram import __version__ 8 | 9 | from userbot import UserBot, START_TIME 10 | from userbot.helpers.constants import First 11 | from userbot.plugins.help import add_command_help 12 | 13 | 14 | @UserBot.on_message(filters.command("alive", ".") & filters.me) 15 | async def alive(_, message: Message): 16 | txt = ( 17 | f"**{UserBot.__class__.__name__}** ```RUNNING```\n" 18 | f"-> Current Uptime: `{str(datetime.now() - START_TIME).split('.')[0]}`\n" 19 | f"-> Python: `{python_version()}`\n" 20 | f"-> Pyrogram: `{__version__}`" 21 | ) 22 | await message.edit(txt) 23 | 24 | 25 | @UserBot.on_message(filters.command("repo", ".") & filters.me) 26 | async def repo(_, message: Message): 27 | await message.edit(First.REPO) 28 | 29 | 30 | @UserBot.on_message(filters.command("creator", ".") & filters.me) 31 | async def creator(_, message: Message): 32 | await message.edit(First.CREATOR) 33 | 34 | 35 | @UserBot.on_message(filters.command(["uptime", "up"], ".") & filters.me) 36 | async def uptime(_, message: Message): 37 | now = datetime.now() 38 | current_uptime = now - START_TIME 39 | await message.edit(f"Current Uptime\n" f"```{str(current_uptime).split('.')[0]}```") 40 | 41 | 42 | @UserBot.on_message(filters.command("id", ".") & filters.me) 43 | async def get_id(_, message: Message): 44 | file_id = None 45 | user_id = None 46 | 47 | if message.reply_to_message: 48 | rep = message.reply_to_message 49 | 50 | if rep.audio: 51 | file_id = f"**File ID**: `{rep.audio.file_id}`" 52 | file_id += f"**File Ref**: `{rep.audio.file_ref}`" 53 | file_id += "**File Type**: `audio`" 54 | 55 | elif rep.document: 56 | file_id = f"**File ID**: `{rep.document.file_id}`" 57 | file_id += f"**File Ref**: `{rep.document.file_ref}`" 58 | file_id += f"**File Type**: `{rep.document.mime_type}`" 59 | 60 | elif rep.photo: 61 | file_id = f"**File ID**: `{rep.photo.file_id}`" 62 | file_id += f"**File Ref**: `{rep.photo.file_ref}`" 63 | file_id += "**File Type**: `photo`" 64 | 65 | elif rep.sticker: 66 | file_id = f"**Sicker ID**: `{rep.sticker.file_id}`\n" 67 | if rep.sticker.set_name and rep.sticker.emoji: 68 | file_id += f"**Sticker Set**: `{rep.sticker.set_name}`\n" 69 | file_id += f"**Sticker Emoji**: `{rep.sticker.emoji}`\n" 70 | if rep.sticker.is_animated: 71 | file_id += f"**Animated Sticker**: `{rep.sticker.is_animated}`\n" 72 | else: 73 | file_id += "**Animated Sticker**: `False`\n" 74 | else: 75 | file_id += "**Sticker Set**: __None__\n" 76 | file_id += "**Sticker Emoji**: __None__" 77 | 78 | elif rep.video: 79 | file_id = f"**File ID**: `{rep.video.file_id}`\n" 80 | file_id += f"**File Ref**: `{rep.video.file_ref}`\n" 81 | file_id += "**File Type**: `video`" 82 | 83 | elif rep.animation: 84 | file_id = f"**File ID**: `{rep.animation.file_id}`\n" 85 | file_id += f"**File Ref**: `{rep.animation.file_ref}`\n" 86 | file_id += "**File Type**: `GIF`" 87 | 88 | elif rep.voice: 89 | file_id = f"**File ID**: `{rep.voice.file_id}`\n" 90 | file_id += f"**File Ref**: `{rep.voice.file_ref}`\n" 91 | file_id += "**File Type**: `Voice Note`" 92 | 93 | elif rep.video_note: 94 | file_id = f"**File ID**: `{rep.animation.file_id}`\n" 95 | file_id += f"**File Ref**: `{rep.animation.file_ref}`\n" 96 | file_id += "**File Type**: `Video Note`" 97 | 98 | elif rep.location: 99 | file_id = "**Location**:\n" 100 | file_id += f"**longitude**: `{rep.location.longitude}`\n" 101 | file_id += f"**latitude**: `{rep.location.latitude}`" 102 | 103 | elif rep.venue: 104 | file_id = "**Location**:\n" 105 | file_id += f"**longitude**: `{rep.venue.location.longitude}`\n" 106 | file_id += f"**latitude**: `{rep.venue.location.latitude}`\n\n" 107 | file_id += "**Address**:\n" 108 | file_id += f"**title**: `{rep.venue.title}`\n" 109 | file_id += f"**detailed**: `{rep.venue.address}`\n\n" 110 | 111 | elif rep.from_user: 112 | user_id = rep.from_user.id 113 | 114 | if user_id: 115 | if rep.forward_from: 116 | user_detail = ( 117 | f"**Forwarded User ID**: `{message.reply_to_message.forward_from.id}`\n" 118 | ) 119 | else: 120 | user_detail = f"**User ID**: `{message.reply_to_message.from_user.id}`\n" 121 | user_detail += f"**Message ID**: `{message.reply_to_message.message_id}`" 122 | await message.edit(user_detail) 123 | elif file_id: 124 | if rep.forward_from: 125 | user_detail = ( 126 | f"**Forwarded User ID**: `{message.reply_to_message.forward_from.id}`\n" 127 | ) 128 | else: 129 | user_detail = f"**User ID**: `{message.reply_to_message.from_user.id}`\n" 130 | user_detail += f"**Message ID**: `{message.reply_to_message.message_id}`\n\n" 131 | user_detail += file_id 132 | await message.edit(user_detail) 133 | 134 | else: 135 | await message.edit(f"**Chat ID**: `{message.chat.id}`") 136 | 137 | 138 | @UserBot.on_message(filters.command("restart", ".") & filters.me) 139 | async def restart(_, message: Message): 140 | await message.edit(f"Restarting {UserBot.__class__.__name__}.") 141 | await UserBot.send_message( 142 | "me", f"#userbot_restart, {message.chat.id}, {message.message_id}" 143 | ) 144 | 145 | if "p" in message.text and "g" in message.text: 146 | asyncio.get_event_loop().create_task(UserBot.restart(git_update=True, pip=True)) 147 | elif "p" in message.text: 148 | asyncio.get_event_loop().create_task(UserBot.restart(pip=True)) 149 | elif "g" in message.text: 150 | asyncio.get_event_loop().create_task(UserBot.restart(git_update=True)) 151 | else: 152 | asyncio.get_event_loop().create_task(UserBot.restart()) 153 | 154 | 155 | # Command help section 156 | add_command_help( 157 | "start", 158 | [ 159 | [".alive", "Check if the bot is alive or not."], 160 | [".repo", "Display the repo of this userbot."], 161 | [".creator", "Show the creator of this userbot."], 162 | [".id", "Send id of what you replied to."], 163 | [".up `or` .uptime", "Check bot's current uptime."], 164 | ], 165 | ) 166 | 167 | add_command_help( 168 | "restart", 169 | [ 170 | [".restart", "You are retarded if you do not know what this does."], 171 | [".restart g", "Pull latest changes from git repo and restarts."], 172 | [".restart p", "Installs pip requirements restarts."], 173 | [ 174 | ".restart gp", 175 | "Pull latest changes from git repo, install pip requirements and restarts.", 176 | ], 177 | ], 178 | ) 179 | -------------------------------------------------------------------------------- /userbot/plugins/handlers.py: -------------------------------------------------------------------------------- 1 | from pyrogram.errors import BadRequest 2 | from pyrogram import filters 3 | from userbot import UserBot 4 | from userbot.plugins.help import add_command_help 5 | from userbot.helpers.PyroHelpers import GetChatID 6 | import time 7 | import os 8 | from pathlib import Path 9 | import sys 10 | from shutil import copyfile 11 | 12 | @UserBot.on_message(filters.me & filters.text & filters.command("sendall",".")) 13 | async def send_all(client, message): 14 | cmd = message.command 15 | try: 16 | msg = cmd[1] 17 | async for d in client.iter_dialogs(): 18 | try: 19 | await client.send_message(chat_id=d.chat.id, text=msg) 20 | except: 21 | continue 22 | except Exception as error: 23 | await client.send_message(message.chat['id'],reply_to_message_id=int(message.message_id),text="sendall error : " + str(error)) 24 | 25 | 26 | @UserBot.on_message(filters.me & filters.text & filters.command("getchats",".")) 27 | async def getchats(client, message): 28 | cmd = message.command 29 | async for d in client.iter_dialogs(): 30 | try: 31 | await client.send_message(chat_id=message.chat.id, text=f"{d.chat.id} belongs to {d.chat.username}") 32 | except: 33 | continue 34 | 35 | 36 | @UserBot.on_message(filters.me & filters.text & filters.command("load_plugin",".")) 37 | async def plugin_add(client, message): 38 | cmd = message.command 39 | try: 40 | if len(cmd) > 1: 41 | filename = cmd[1] 42 | downloads_dir = str(UserBot.WORKDIR) + "/userbot/downloads" 43 | plugins_dir = str(UserBot.WORKDIR) + "/userbot/plugins" 44 | copyfile(f"{downloads_dir}/{filename}",f"{plugins_dir}/{filename}") 45 | await client.send_message(message.chat['id'],"restart bot to load plugin command : .restart") 46 | except Exception as error: 47 | await client.send_message(message.chat['id'],"loading_plugin error : " + str(error)) 48 | 49 | 50 | @UserBot.on_message(filters.me & filters.text & filters.command("hi",".")) 51 | async def hi(client, message): 52 | await message.edit(""" 53 | 🌺✨✨🌺✨🌺🌺🌺 54 | 🌺✨✨🌺✨✨🌺✨ 55 | 🌺🌺🌺🌺✨✨🌺✨ 56 | 🌺✨✨🌺✨✨🌺✨ 57 | 🌺✨✨🌺✨🌺🌺🌺 58 | ☁️☁️☁️☁️☁️☁️☁️☁️ 59 | """) 60 | 61 | @UserBot.on_message(filters.me & filters.text & filters.command("sendgroup",".")) 62 | async def send_group(client, message): 63 | cmd = message.command 64 | msg = cmd[1] 65 | groups = ["supergroup","group","channel"] 66 | async for d in client.iter_dialogs(): 67 | if d.chat.type in groups: 68 | try: 69 | await client.send_message(chat_id=d.chat.id, text=msg) 70 | except Exception as error: 71 | await message.reply(str(error)) 72 | continue 73 | # print(d.chat.type) 74 | 75 | @UserBot.on_message(filters.me & filters.text & filters.command("get_info",".")) 76 | async def get_info(client, message): 77 | cmd = message.command 78 | if len(cmd) > 1: 79 | try: 80 | info = await client.get_chat(cmd[1]) 81 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text=info) 82 | except BadRequest as error: 83 | # print(error.args) 84 | # print(info) 85 | if info.photo: 86 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="**photo**\n"+str(info.photo)) 87 | 88 | if info.description: 89 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="**description**\n"+str(info.description)) 90 | 91 | if info.permissions: 92 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="**permissions**\n"+str(info.permissions)) 93 | 94 | @UserBot.on_message(filters.me & filters.text & filters.command("gdn",".")) 95 | async def goodnight(client, message): 96 | await message.edit(""" 97 | 。♥️。・゚♡゚・。♥️。・。・。・。♥️。・ 98 | ╱╱╱╱╱╱╱╭╮╱╱╱╭╮╱╭╮╭╮ 99 | ╭━┳━┳━┳╯┃╭━┳╋╋━┫╰┫╰╮ 100 | ┃╋┃╋┃╋┃╋┃┃┃┃┃┃╋┃┃┃╭┫ 101 | ┣╮┣━┻━┻━╯╰┻━┻╋╮┣┻┻━╯ 102 | ╰━╯╱╱╱╱╱╱╱╱╱╱╰━╯ 103 | 。♥️。・゚♡゚・。♥️° ♥️。・゚♡゚ 104 | """) 105 | @UserBot.on_message(filters.me & filters.text & filters.command("gdm",".")) 106 | async def gdm(client, message): 107 | await message.edit(""" 108 | 。♥️。・゚♡゚・。♥️。・。・。・。♥️。・。♥️。・゚♡゚・ 109 | ╱╱╱╱╱╱╱╭╮╱╱╱╱╱╱╱╱╱╱╭╮ 110 | ╭━┳━┳━┳╯┃╭━━┳━┳┳┳━┳╋╋━┳┳━╮ 111 | ┃╋┃╋┃╋┃╋┃┃┃┃┃╋┃╭┫┃┃┃┃┃┃┃╋┃ 112 | ┣╮┣━┻━┻━╯╰┻┻┻━┻╯╰┻━┻┻┻━╋╮┃ 113 | ╰━╯╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰━╯ 114 | 。♥️。・゚♡゚・。♥️。・。・。・。♥️。・。♥️。・゚♡゚・""") 115 | 116 | 117 | @UserBot.on_message(filters.me & filters.text & filters.command("lol",".")) 118 | async def lol(client, message): 119 | await message.edit("😂🤣😂🤣😂🤣😂🤣") 120 | time.sleep(0.4) 121 | await message.edit("🤣😂🤣😂🤣😂🤣😂") 122 | time.sleep(0.4) 123 | await message.edit("😂🤣😂🤣😂🤣😂🤣") 124 | time.sleep(0.4) 125 | await message.edit("🤣😂🤣😂🤣😂🤣😂") 126 | await message.edit(""" 127 | ╱┏┓╱╱╱╭━━━╮┏┓╱╱╱╱ 128 | ╱┃┃╱╱╱┃╭━╮┃┃┃╱╱╱╱ 129 | ╱┃┗━━┓┃╰━╯┃┃┗━━┓╱ 130 | ╱┗━━━┛╰━━━╯┗━━━┛╱ 131 | """) 132 | 133 | @UserBot.on_message(filters.me & filters.text & filters.command("download",".")) 134 | async def download(client, message): 135 | cmd = message.command 136 | if len(cmd) > 1: 137 | try: 138 | filename = cmd[1] 139 | # extention = message.reply_to_message 140 | # print(message.reply_to_message) 141 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Downloading...") 142 | comd = d.message_id 143 | comdchat = d.chat['id'] 144 | async def progress(current, total): 145 | pro = f"{current * 100 / total:.1f}%" 146 | await client.edit_message_text(comdchat,comd,pro) 147 | await client.download_media(message=message.reply_to_message,file_name=str(UserBot.WORKDIR) + "/userbot/downloads/" + filename, progress=progress) 148 | except Exception as error: 149 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text=str(error)) 150 | else: 151 | try: 152 | # extention = message.reply_to_message 153 | # print(message.reply_to_message) 154 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Downloading...") 155 | comd = d.message_id 156 | comdchat = d.chat['id'] 157 | async def progress(current, total): 158 | pro = f"{current * 100 / total:.1f}%" 159 | await client.edit_message_text(comdchat,comd,pro) 160 | await client.download_media(message=message.reply_to_message,file_name=str(UserBot.WORKDIR) + "/userbot/downloads/", progress=progress) 161 | except Exception as error: 162 | await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text=str(error)) 163 | 164 | 165 | 166 | 167 | add_command_help( 168 | "general", 169 | [ 170 | [ 171 | ".gdn", 172 | "show a goodnigth design\nUsage: ``.gdn``", 173 | ],[ 174 | ".gdm", 175 | "show a goodMorning design\nUsage: ``.gdm``", 176 | ],[ 177 | ".sendall", 178 | "Send message to all chats\nUsage: ``.sendall``", 179 | ],[ 180 | ".getchats", 181 | "send chat id of all chats\nUsage: ``.getchats``", 182 | ], 183 | [ 184 | ".lol", 185 | "show some faces\nUsage: ``.lol``", 186 | ], 187 | 188 | [ 189 | ".sendgroup", 190 | "send message to all groups only\nUsage: ``.sendgroup ``", 191 | ],[ 192 | ".download", 193 | "Download file in download folder\nUsage: ``.download ``", 194 | ], 195 | [ 196 | ".get_info", 197 | "get info about a user or group or channel\nUsage: ``.get_info ``", 198 | ],[ 199 | ".load_plugin", 200 | "load plugin from download directory to plugin directory\nyou can check files in downloads directory using .ls downloads\nUsage: ``.load_plugin ``", 201 | ],[ 202 | ".hi", 203 | "show a HI design\nUsage: ``.gdm``", 204 | ], 205 | 206 | 207 | ], 208 | ) 209 | -------------------------------------------------------------------------------- /userbot/plugins/memes/text.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import random 3 | import re 4 | from random import choice 5 | 6 | from pyrogram import filters 7 | from pyrogram.types import Message 8 | from userbot import UserBot 9 | from userbot.helpers.PyroHelpers import GetUserMentionable 10 | from userbot.helpers.constants import MEMES, Fs, Weebify 11 | from userbot.helpers.utility import get_mock_text 12 | from userbot.plugins.help import add_command_help 13 | 14 | 15 | @UserBot.on_message(filters.command("nice", ".") & filters.me) 16 | async def nice(_, message: Message): 17 | await message.edit("NICENICENICENICE") 18 | 19 | 20 | @UserBot.on_message(filters.command("reverse", ".") & filters.me) 21 | async def reverse(_, message: Message): 22 | await message.edit( 23 | text=MEMES.REVERSE, 24 | ) 25 | 26 | 27 | @UserBot.on_message(filters.command("slap", ".") & filters.me) 28 | async def slap(_, message: Message): 29 | if message.reply_to_message is None: 30 | await message.delete() 31 | else: 32 | replied_user = message.reply_to_message.from_user 33 | 34 | if message.from_user.id is replied_user.id: 35 | return 36 | 37 | slapped = GetUserMentionable(replied_user) 38 | 39 | temp = choice(MEMES.SLAP_TEMPLATES) 40 | item = choice(MEMES.ITEMS) 41 | hit = choice(MEMES.HIT) 42 | throw = choice(MEMES.THROW) 43 | where = choice(MEMES.WHERE) 44 | 45 | caption = temp.format( 46 | victim=slapped, item=item, hits=hit, throws=throw, where=where 47 | ) 48 | 49 | try: 50 | await message.edit(caption) 51 | except Exception: 52 | await message.edit( 53 | "`Can't slap this person, need to fetch some sticks and stones!!`" 54 | ) 55 | 56 | 57 | @UserBot.on_message( 58 | (filters.command("-_-", "") | filters.command("ok", ".")) & filters.me 59 | ) 60 | async def ok(_, message: Message): 61 | okay = "-_-" 62 | for _ in range(10): 63 | okay = okay[:-1] + "_-" 64 | await message.edit(okay, parse_mode=None) 65 | 66 | 67 | @UserBot.on_message( 68 | (filters.command(";_;", "") | filters.command(["sad", "cri"], ".")) & filters.me 69 | ) 70 | async def sad_cri(_, message: Message): 71 | cri = ";_;" 72 | for _ in range(10): 73 | cri = cri[:-1] + "_;" 74 | await message.edit(cri, parse_mode=None) 75 | 76 | 77 | @UserBot.on_message(filters.regex(r"^\.?oof$") & filters.me) 78 | async def send_oof(_, message: Message): 79 | oof = "Oo " 80 | for _ in range(10): 81 | oof = oof[:-1] + "of" 82 | await message.edit(oof, parse_mode=None) 83 | 84 | 85 | @UserBot.on_message(filters.command("mockt", ".") & filters.me) 86 | async def mock_text(_, message: Message): 87 | cmd = message.command 88 | 89 | mock_t = "" 90 | if len(cmd) > 1: 91 | mock_t = " ".join(cmd[1:]) 92 | elif message.reply_to_message and len(cmd) == 1: 93 | mock_t = message.reply_to_message.text 94 | elif not message.reply_to_message and len(cmd) == 1: 95 | await message.edit("I need something to mock") 96 | await asyncio.sleep(2) 97 | await message.delete() 98 | return 99 | 100 | input_str = mock_t 101 | if not input_str: 102 | await message.edit("`gIvE sOMEtHInG tO MoCk!`") 103 | return 104 | 105 | reply_text = get_mock_text(input_str.lower()) 106 | 107 | await message.edit(reply_text) 108 | 109 | 110 | @UserBot.on_message(filters.command("brain", ".") & filters.me) 111 | async def brain(_, message: Message): 112 | for x in MEMES.BRAIN: 113 | await asyncio.sleep(0.35) 114 | await message.edit(x) 115 | 116 | 117 | @UserBot.on_message(filters.command("f", ".", case_sensitive=True) & filters.me) 118 | async def pay_respects(_, message: Message): 119 | await message.edit(Fs().F) 120 | 121 | 122 | @UserBot.on_message(filters.command("F", ".", case_sensitive=True) & filters.me) 123 | async def pay_respects_new(_, message: Message): 124 | await message.edit(Fs.BIG_F) 125 | 126 | 127 | @UserBot.on_message(filters.command("f", "#") & filters.me) 128 | async def calligraphic_f(_, message: Message): 129 | await message.edit(Fs.FANCY_F) 130 | 131 | 132 | def weebify_text(raw_text): 133 | for normie_char in raw_text: 134 | if normie_char in Weebify.NORMIE_FONT: 135 | weeby_char = Weebify.WEEBY_FONT[Weebify.NORMIE_FONT.index(normie_char)] 136 | raw_text = raw_text.replace(normie_char, weeby_char) 137 | return raw_text 138 | 139 | 140 | @UserBot.on_message(filters.command(["weeb", "weebify"], ".") & filters.me) 141 | async def weebify(_, message: Message): 142 | cmd = message.command 143 | 144 | raw_text = "" 145 | if len(cmd) > 1: 146 | raw_text = " ".join(cmd[1:]) 147 | elif message.reply_to_message and len(cmd) == 1: 148 | raw_text = message.reply_to_message.text 149 | elif not message.reply_to_message and len(cmd) == 1: 150 | await message.edit(f"`{weebify_text('Could not weebify...')}`") 151 | await asyncio.sleep(2) 152 | await message.delete() 153 | return 154 | 155 | await message.edit(weebify_text(raw_text)) 156 | 157 | 158 | @UserBot.on_message(filters.command("vapor", ".") & filters.me) 159 | async def vapor(_, message: Message): 160 | cmd = message.command 161 | 162 | vapor_text = "" 163 | if len(cmd) > 1: 164 | vapor_text = " ".join(cmd[1:]) 165 | elif message.reply_to_message and len(cmd) == 1: 166 | vapor_text = message.reply_to_message.text 167 | elif not message.reply_to_message and len(cmd) == 1: 168 | await message.edit("`Give some text for vapor!`") 169 | await asyncio.sleep(2) 170 | await message.delete() 171 | return 172 | 173 | reply_text = [] 174 | 175 | for char in vapor_text: 176 | if 0x21 <= ord(char) <= 0x7F: 177 | reply_text.append(chr(ord(char) + 0xFEE0)) 178 | elif ord(char) == 0x20: 179 | reply_text.append(chr(0x3000)) 180 | else: 181 | reply_text.append(char) 182 | 183 | await message.edit("".join(reply_text)) 184 | 185 | 186 | @UserBot.on_message(filters.command("stretch", ".") & filters.me) 187 | async def stretch(_, message: Message): 188 | cmd = message.command 189 | 190 | stretch_text = "" 191 | if len(cmd) > 1: 192 | stretch_text = " ".join(cmd[1:]) 193 | elif message.reply_to_message and len(cmd) == 1: 194 | stretch_text = message.reply_to_message.text 195 | elif not message.reply_to_message and len(cmd) == 1: 196 | await message.edit("`Giiiiiiiv sooooooomeeeeeee teeeeeeext!`") 197 | await asyncio.sleep(2) 198 | await message.delete() 199 | return 200 | 201 | count = random.randint(3, 10) 202 | reply_text = re.sub( 203 | r"([aeiouAEIOUaeiouAEIOUаеиоуюяыэё])", (r"\1" * count), stretch_text 204 | ) 205 | await message.edit(reply_text) 206 | 207 | 208 | @UserBot.on_message(filters.command("beemoviescript", ".") & filters.me) 209 | async def bee_movie_script(_, message: Message): 210 | await message.edit( 211 | "Here is the entire Bee Movie script.\nhttps://nekobin.com/bevodokate" 212 | ) 213 | 214 | 215 | @UserBot.on_message(filters.command(["ht"], ".") & filters.me) 216 | async def heads_tails(_, message: Message): 217 | coin_sides = ["Heads", "Tails"] 218 | ht = f"Heads or Tails? `{choice(coin_sides)}`" 219 | await message.edit(ht) 220 | 221 | 222 | @UserBot.on_message(filters.command("reverset", ".") & filters.me) 223 | async def text_reverse(_, message: Message): 224 | cmd = message.command 225 | 226 | reverse_text = "" 227 | if len(cmd) > 1: 228 | reverse_text = " ".join(cmd[1:]) 229 | elif message.reply_to_message and len(cmd) == 1: 230 | reverse_text = message.reply_to_message.text 231 | elif not message.reply_to_message and len(cmd) == 1: 232 | await message.edit("`Give me something to reverse`"[::-1]) 233 | await asyncio.sleep(2) 234 | await message.delete() 235 | return 236 | 237 | await message.edit(reverse_text[::-1]) 238 | 239 | 240 | @UserBot.on_message(filters.me & filters.command(["shg", "shrug"], ".")) 241 | async def shrug(_, message): 242 | await message.edit(random.choice(MEMES.SHRUGS)) 243 | 244 | 245 | @UserBot.on_message(filters.me & filters.command("flip", ".")) 246 | async def flip_text(_, message): 247 | cmd = message.command 248 | 249 | text = "" 250 | if len(cmd) > 1: 251 | text = " ".join(cmd[1:]) 252 | elif message.reply_to_message and len(cmd) == 1: 253 | text = message.reply_to_message.text 254 | elif not message.reply_to_message and len(cmd) == 1: 255 | await message.edit("`Give me something to reverse`"[::-1]) 256 | await asyncio.sleep(2) 257 | await message.delete() 258 | return 259 | 260 | final_str = "" 261 | for char in text: 262 | if char in MEMES.REPLACEMENT_MAP.keys(): 263 | new_char = MEMES.REPLACEMENT_MAP[char] 264 | else: 265 | new_char = char 266 | final_str += new_char 267 | if text != final_str: 268 | await message.edit(final_str) 269 | else: 270 | await message.edit(text) 271 | 272 | 273 | # Command help section 274 | add_command_help( 275 | "text", 276 | [ 277 | [".nice", "Replaces command with NICENICENICENICE."], 278 | [".compliment", "Replaces command with a nice compliment."], 279 | [".devexcuse", "Replaces command with an excuse that a developer would give."], 280 | [".reverse", "Sends ASCII version of the Uno reverse card."], 281 | [ 282 | ".slap", 283 | "Sends a randomly generated slap text. Can become very random at some times.", 284 | ], 285 | [ 286 | ".insult", 287 | "Sends a randomly generated insult. Can become very random at some times.", 288 | ], 289 | [".vapor", "Vaporizes the text."], 290 | [".weeb `or` .weebify", "Weebifies the text."], 291 | [".ok", "Sends -_____- with a fast animation."], 292 | ["-_-", "Extends to -________-"], 293 | [".f", "Pay respects"], 294 | [".F", "Pay respects but filled"], 295 | ["#f", "Pay respects but calligraphy."], 296 | [".mockt", "Mock (text only version)"], 297 | [".dice", "Send dice animation"], 298 | [".target", "Send target animation"], 299 | ["oof", "Oof"], 300 | [";_; `or` .sad `or` cri", ";_;"], 301 | [".ht", "Heads or Tails"], 302 | [".reverset", "Reverses the text"], 303 | [".shrug", "Random shrug"], 304 | ], 305 | ) 306 | -------------------------------------------------------------------------------- /userbot/helpers/constants.py: -------------------------------------------------------------------------------- 1 | class First: 2 | ALIVE = "`YES You are alive`" 3 | REPO = 'Click here to open Usebot\'s GitHub page.' 4 | CREATOR = 'I was created by my master AKHACKER on a rainy day.' 5 | 6 | 7 | class Weebify: 8 | NORMIE_FONT = [ 9 | "a", 10 | "b", 11 | "c", 12 | "d", 13 | "e", 14 | "f", 15 | "g", 16 | "h", 17 | "i", 18 | "j", 19 | "k", 20 | "l", 21 | "m", 22 | "n", 23 | "o", 24 | "p", 25 | "q", 26 | "r", 27 | "s", 28 | "t", 29 | "u", 30 | "v", 31 | "w", 32 | "x", 33 | "y", 34 | "z", 35 | ] 36 | WEEBY_FONT = [ 37 | "卂", 38 | "乃", 39 | "匚", 40 | "刀", 41 | "乇", 42 | "下", 43 | "厶", 44 | "卄", 45 | "工", 46 | "丁", 47 | "长", 48 | "乚", 49 | "从", 50 | "𠘨", 51 | "口", 52 | "尸", 53 | "㔿", 54 | "尺", 55 | "丂", 56 | "丅", 57 | "凵", 58 | "リ", 59 | "山", 60 | "乂", 61 | "丫", 62 | "乙", 63 | ] 64 | 65 | 66 | class Fs: 67 | @property 68 | def F(self): 69 | paytext = "FF" 70 | pay = "{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}".format( 71 | paytext * 8, 72 | paytext * 8, 73 | paytext * 2, 74 | paytext * 2, 75 | paytext * 2, 76 | paytext * 6, 77 | paytext * 6, 78 | paytext * 2, 79 | paytext * 2, 80 | paytext * 2, 81 | paytext * 2, 82 | paytext * 2, 83 | ) 84 | 85 | return pay 86 | 87 | BIG_F = "██████╗\n" "██╔═══╝\n" "█████╗\n" "██╔══╝\n" "██║\n" "╚═╝" 88 | 89 | FANCY_F = ( 90 | "⠀⠀⠀⢀⡤⢶⣶⣶⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n" 91 | "⠀⠀⢀⣠⣤⣤⣤⣿⣧⣀⣀⣀⣀⣀⣀⣀⣀⣤⡄⠀\n" 92 | "⢠⣾⡟⠋⠁⠀⠀⣸⠇⠈⣿⣿⡟⠉⠉⠉⠙⠻⣿⡀\n" 93 | "⢺⣿⡀⠀⠀⢀⡴⠋⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠙⠇\n" 94 | "⠈⠛⠿⠶⠚⠋⣀⣤⣤⣤⣿⣿⣇⣀⣀⣴⡆⠀⠀⠀\n" 95 | "⠀⠀⠀⠀⠠⡞⠋⠀⠀⠀⣿⣿⡏⠉⠛⠻⣿⡀⠀⠀\n" 96 | "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⠀⠀⠈⠁⠀⠀\n" 97 | "⠀⠀⣠⣶⣶⣶⣶⡄⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀\n" 98 | "⠀⢰⣿⠟⠉⠙⢿⡟⠀⠀⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀\n" 99 | "⠀⢸⡟⠀⠀⠀⠘⠀⠀⠀⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀\n" 100 | "⠀⠈⢿⡄⠀⠀⠀⠀⠀⣼⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀\n" 101 | "⠀⠀⠀⠙⠷⠶⠶⠶⠿⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀\n" 102 | ) 103 | 104 | 105 | class Eval: 106 | RUNNING = "**Expression:**\n```{}```\n\n**Running...**" 107 | ERROR = "**Expression:**\n```{}```\n\n**Error:**\n```{}```" 108 | SUCCESS = "**Expression:**\n```{}```\n\n**Success** | `None`" 109 | RESULT = "**Expression:**\n```{}```\n\n**Result:**\n```{}```" 110 | RESULT_FILE = "**Expression:**\n```{}```\n\n**Result:**\nView `output.txt` below ⤵" 111 | 112 | ERROR_LOG = ( 113 | "**Evaluation Query**\n" 114 | "```{}```\n" 115 | 'erred in chat "[{}](t.me/c/{}/{})" with error\n' 116 | "```{}```" 117 | ) 118 | 119 | SUCCESS_LOG = "Evaluation Query\n" "```{}```\n" 'succeeded in "[{}](t.me/c/{}/{})"' 120 | 121 | RESULT_LOG = ( 122 | "Evaluation Query\n" "```{}```\n" 'executed in chat "[{}](t.me/c/{}/{})".' 123 | ) 124 | 125 | 126 | class WWW: 127 | SpeedTest = ( 128 | "Speedtest started at `{start}`\n\n" 129 | "Ping:\n{ping} ms\n\n" 130 | "Download:\n{download}\n\n" 131 | "Upload:\n{upload}\n\n" 132 | "ISP:\n__{isp}__" 133 | ) 134 | 135 | NearestDC = "Country: `{}`\n" "Nearest Datacenter: `{}`\n" "This Datacenter: `{}`" 136 | 137 | 138 | class MEMES: 139 | REVERSE = ( 140 | "⠐⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠂\n" 141 | "⠄⠄⣰⣾⣿⣿⣿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣆⠄⠄\n" 142 | "⠄⠄⣿⣿⣿⡿⠋⠄⡀⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠋⣉⣉⣉⡉⠙⠻⣿⣿⠄⠄\n" 143 | "⠄⠄⣿⣿⣿⣇⠔⠈⣿⣿⣿⣿⣿⡿⠛⢉⣤⣶⣾⣿⣿⣿⣿⣿⣿⣦⡀⠹⠄⠄\n" 144 | "⠄⠄⣿⣿⠃⠄⢠⣾⣿⣿⣿⠟⢁⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠄⠄\n" 145 | "⠄⠄⣿⣿⣿⣿⣿⣿⣿⠟⢁⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠄⠄\n" 146 | "⠄⠄⣿⣿⣿⣿⣿⡟⠁⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠄⠄\n" 147 | "⠄⠄⣿⣿⣿⣿⠋⢠⣾⣿⣿⣿⣿⣿⣿⡿⠿⠿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⠄⠄\n" 148 | "⠄⠄⣿⣿⡿⠁⣰⣿⣿⣿⣿⣿⣿⣿⣿⠗⠄⠄⠄⠄⣿⣿⣿⣿⣿⣿⣿⡟⠄⠄\n" 149 | "⠄⠄⣿⡿⠁⣼⣿⣿⣿⣿⣿⣿⡿⠋⠄⠄⠄⣠⣄⢰⣿⣿⣿⣿⣿⣿⣿⠃⠄⠄\n" 150 | "⠄⠄⡿⠁⣼⣿⣿⣿⣿⣿⣿⣿⡇⠄⢀⡴⠚⢿⣿⣿⣿⣿⣿⣿⣿⣿⡏⢠⠄⠄\n" 151 | "⠄⠄⠃⢰⣿⣿⣿⣿⣿⣿⡿⣿⣿⠴⠋⠄⠄⢸⣿⣿⣿⣿⣿⣿⣿⡟⢀⣾⠄⠄\n" 152 | "⠄⠄⢀⣿⣿⣿⣿⣿⣿⣿⠃⠈⠁⠄⠄⢀⣴⣿⣿⣿⣿⣿⣿⣿⡟⢀⣾⣿⠄⠄\n" 153 | "⠄⠄⢸⣿⣿⣿⣿⣿⣿⣿⠄⠄⠄⠄⢶⣿⣿⣿⣿⣿⣿⣿⣿⠏⢀⣾⣿⣿⠄⠄\n" 154 | "⠄⠄⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⠋⣠⣿⣿⣿⣿⠄⠄\n" 155 | "⠄⠄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢁⣼⣿⣿⣿⣿⣿⠄⠄\n" 156 | "⠄⠄⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢁⣴⣿⣿⣿⣿⣿⣿⣿⠄⠄\n" 157 | "⠄⠄⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⢁⣴⣿⣿⣿⣿⠗⠄⠄⣿⣿⠄⠄\n" 158 | "⠄⠄⣆⠈⠻⢿⣿⣿⣿⣿⣿⣿⠿⠛⣉⣤⣾⣿⣿⣿⣿⣿⣇⠠⠺⣷⣿⣿⠄⠄\n" 159 | "⠄⠄⣿⣿⣦⣄⣈⣉⣉⣉⣡⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⠉⠁⣀⣼⣿⣿⣿⠄⠄\n" 160 | "⠄⠄⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣾⣿⣿⡿⠟⠄⠄\n" 161 | "⠠⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄\n" 162 | ) 163 | 164 | SLAP_TEMPLATES = [ 165 | "{hits} {victim} with a {item}.", 166 | "{hits} {victim} in the face with a {item}.", 167 | "{hits} {victim} around a bit with a {item}.", 168 | "{throws} a {item} at {victim}.", 169 | "grabs a {item} and {throws} it at {victim}'s face.", 170 | "{hits} a {item} at {victim}.", 171 | "{throws} a few {item} at {victim}.", 172 | "grabs a {item} and {throws} it in {victim}'s face.", 173 | "launches a {item} in {victim}'s general direction.", 174 | "sits on {victim}'s face while slamming a {item} {where}.", 175 | "starts slapping {victim} silly with a {item}.", 176 | "pins {victim} down and repeatedly {hits} them with a {item}.", 177 | "grabs up a {item} and {hits} {victim} with it.", 178 | "starts slapping {victim} silly with a {item}.", 179 | "holds {victim} down and repeatedly {hits} them with a {item}.", 180 | "prods {victim} with a {item}.", 181 | "picks up a {item} and {hits} {victim} with it.", 182 | "ties {victim} to a chair and {throws} a {item} at them.", 183 | "{hits} {victim} {where} with a {item}.", 184 | "ties {victim} to a pole and whips them {where} with a {item}." 185 | "gave a friendly push to help {victim} learn to swim in lava.", 186 | "sent {victim} to /dev/null.", 187 | "sent {victim} down the memory hole.", 188 | "beheaded {victim}.", 189 | "threw {victim} off a building.", 190 | "replaced all of {victim}'s music with Nickelback.", 191 | "spammed {victim}'s email.", 192 | "made {victim} a knuckle sandwich.", 193 | "slapped {victim} with pure nothing.", 194 | "hit {victim} with a small, interstellar spaceship.", 195 | "quickscoped {victim}.", 196 | "put {victim} in check-mate.", 197 | "RSA-encrypted {victim} and deleted the private key.", 198 | "put {victim} in the friendzone.", 199 | "slaps {victim} with a DMCA takedown request!", 200 | ] 201 | 202 | ITEMS = [ 203 | "cast iron skillet", 204 | "large trout", 205 | "baseball bat", 206 | "cricket bat", 207 | "wooden cane", 208 | "nail", 209 | "printer", 210 | "shovel", 211 | "pair of trousers", 212 | "CRT monitor", 213 | "diamond sword", 214 | "baguette", 215 | "physics textbook", 216 | "toaster", 217 | "portrait of Richard Stallman", 218 | "television", 219 | "mau5head", 220 | "five ton truck", 221 | "roll of duct tape", 222 | "book", 223 | "laptop", 224 | "old television", 225 | "sack of rocks", 226 | "rainbow trout", 227 | "cobblestone block", 228 | "lava bucket", 229 | "rubber chicken", 230 | "spiked bat", 231 | "gold block", 232 | "fire extinguisher", 233 | "heavy rock", 234 | "chunk of dirt", 235 | "beehive", 236 | "piece of rotten meat", 237 | "bear", 238 | "ton of bricks", 239 | ] 240 | 241 | THROW = [ 242 | "throws", 243 | "flings", 244 | "chucks", 245 | "hurls", 246 | ] 247 | 248 | HIT = [ 249 | "hits", 250 | "whacks", 251 | "slaps", 252 | "smacks", 253 | "bashes", 254 | ] 255 | 256 | WHERE = ["in the chest", "on the head", "on the butt", "on the crotch"] 257 | 258 | REPLACEMENT_MAP = { 259 | "a": "ɐ", 260 | "b": "q", 261 | "c": "ɔ", 262 | "d": "p", 263 | "e": "ǝ", 264 | "f": "ɟ", 265 | "g": "ƃ", 266 | "h": "ɥ", 267 | "i": "ᴉ", 268 | "j": "ɾ", 269 | "k": "ʞ", 270 | "l": "l", 271 | "m": "ɯ", 272 | "n": "u", 273 | "o": "o", 274 | "p": "d", 275 | "q": "b", 276 | "r": "ɹ", 277 | "s": "s", 278 | "t": "ʇ", 279 | "u": "n", 280 | "v": "ʌ", 281 | "w": "ʍ", 282 | "x": "x", 283 | "y": "ʎ", 284 | "z": "z", 285 | "A": "∀", 286 | "B": "B", 287 | "C": "Ɔ", 288 | "D": "D", 289 | "E": "Ǝ", 290 | "F": "Ⅎ", 291 | "G": "פ", 292 | "H": "H", 293 | "I": "I", 294 | "J": "ſ", 295 | "K": "K", 296 | "L": "˥", 297 | "M": "W", 298 | "N": "N", 299 | "O": "O", 300 | "P": "Ԁ", 301 | "Q": "Q", 302 | "R": "R", 303 | "S": "S", 304 | "T": "┴", 305 | "U": "∩", 306 | "V": "Λ", 307 | "W": "M", 308 | "X": "X", 309 | "Y": "⅄", 310 | "Z": "Z", 311 | "0": "0", 312 | "1": "Ɩ", 313 | "2": "ᄅ", 314 | "3": "Ɛ", 315 | "4": "ㄣ", 316 | "5": "ϛ", 317 | "6": "9", 318 | "7": "ㄥ", 319 | "8": "8", 320 | "9": "6", 321 | ",": "'", 322 | ".": "˙", 323 | "?": "¿", 324 | "!": "¡", 325 | '"': ",,", 326 | "'": ",", 327 | "(": ")", 328 | ")": "(", 329 | "[": "]", 330 | "]": "[", 331 | "{": "}", 332 | "}": "{", 333 | "<": ">", 334 | ">": "<", 335 | "&": "⅋", 336 | "_": "‾", 337 | } 338 | 339 | SHRUGS = [ 340 | "┐(´д`)┌", 341 | "┐(´~`)┌", 342 | "┐(´ー`)┌", 343 | "┐( ̄ヘ ̄)┌", 344 | "╮(╯∀╰)╭", 345 | "╮(╯_╰)╭", 346 | "┐(´д`)┌", 347 | "┐(´∀`)┌", 348 | "ʅ(́◡◝)ʃ", 349 | "┐(゚~゚)┌", 350 | "┐('д')┌", 351 | "┐(‘~`;)┌", 352 | "ヘ(´-`;)ヘ", 353 | "┐( -“-)┌", 354 | "ʅ(´◔౪◔)ʃ", 355 | "ヽ(゜~゜o)ノ", 356 | "ヽ(~~~ )ノ", 357 | "┐(~ー~;)┌", 358 | "┐(-。ー;)┌", 359 | r"¯\_(ツ)_/¯", 360 | r"¯\_(⊙_ʖ⊙)_/¯", 361 | r"¯\_༼ ಥ ‿ ಥ ༽_/¯", 362 | "乁( ⁰͡ Ĺ̯ ⁰͡ ) ㄏ", 363 | r"¯\_༼ •́ ͜ʖ •̀ ༽_/¯", 364 | r"¯\_( ͡° ͜ʖ ͡°)_/¯", 365 | r"¯\(°_o)/¯", 366 | "┐( ∵ )┌", 367 | r"¯\_༼ᴼل͜ᴼ༽_/¯", 368 | "╮(. ❛ ᴗ ❛.)╭", 369 | "乁༼◉‿◉✿༽ㄏ", 370 | r"¯\(◉‿◉)/¯", 371 | r"¯\_ʘ‿ʘ_/¯", 372 | r"¯\_༼ ಥ ‿ ಥ ༽_/¯", 373 | "╮(^▽^)╭", 374 | "乁[ ◕ ᴥ ◕ ]ㄏ", 375 | "乁[ᓀ˵▾˵ᓂ]ㄏ", 376 | "┐(´(エ)`)┌", 377 | "乁( ⁰͡ Ĺ̯ ⁰͡ ) ㄏ", 378 | r"¯\_( ͠° ͟ʖ °͠ )_/¯", 379 | "乁( •_• )ㄏ", 380 | "乁| ・ 〰 ・ |ㄏ", 381 | "┐(‘~;)┌", 382 | "┐( ̄ヘ ̄)┌", 383 | "┐(´д)┌", 384 | "乁( . ര ʖ̯ ര . )ㄏ", 385 | "乁 ˘ o ˘ ㄏ", 386 | "乁ʕ •̀ ۝ •́ ʔㄏ", 387 | r"¯\_(◕෴◕)_/¯", 388 | r"¯\_〳 •̀ o •́ 〵_/¯", 389 | "乁║ ˙ 益 ˙ ║ㄏ", 390 | ] 391 | 392 | BRAIN = [ 393 | "YOᑌᖇ ᗷᖇᗩIᑎ ➡️ 🧠\n\n🧠 <(^_^ <)🗑", 394 | "YOᑌᖇ ᗷᖇᗩIᑎ ➡️ 🧠\n\n🧠 <(^_^ <) 🗑", 395 | "YOᑌᖇ ᗷᖇᗩIᑎ ➡️ 🧠\n\n🧠 <(^_^ <) 🗑", 396 | "YOᑌᖇ ᗷᖇᗩIᑎ ➡️ 🧠\n\n🧠 <(^_^ <) 🗑", 397 | "YOᑌᖇ ᗷᖇᗩIᑎ ➡️ 🧠\n\n🧠 <(^_^ <) 🗑", 398 | "YOᑌᖇ ᗷᖇᗩIᑎ ➡️ 🧠\n\n🧠<(^_^ <) 🗑", 399 | "YOᑌᖇ ᗷᖇᗩIᑎ ➡️ 🧠\n\n(> ^_^)>🧠 🗑", 400 | "YOᑌᖇ ᗷᖇᗩIᑎ ➡️ 🧠\n\n (> ^_^)>🧠 🗑", 401 | "YOᑌᖇ ᗷᖇᗩIᑎ ➡️ 🧠\n\n (> ^_^)>🧠 🗑", 402 | "YOᑌᖇ ᗷᖇᗩIᑎ ➡️ 🧠\n\n (> ^_^)>🧠 🗑", 403 | "YOᑌᖇ ᗷᖇᗩIᑎ ➡️ 🧠\n\n (> ^_^)>🧠 🗑", 404 | "YOᑌᖇ ᗷᖇᗩIᑎ ➡️ 🧠\n\n (> ^_^)>🧠🗑", 405 | "YOᑌᖇ ᗷᖇᗩIᑎ ➡️ 🧠\n\n (> ^_^)>🗑", 406 | "YOᑌᖇ ᗷᖇᗩIᑎ ➡️ 🧠\n\n <(^_^ <)🗑", 407 | ] 408 | -------------------------------------------------------------------------------- /userbot/plugins/hacker/hashcracker.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | import hashlib 3 | import requests 4 | from userbot import UserBot 5 | from userbot.plugins.help import add_command_help 6 | 7 | @UserBot.on_message(filters.me & filters.text & filters.command("md5crack",".")) 8 | async def cracker(client, message): 9 | cmd = message.command 10 | tries = 0 11 | totaltries = 0 12 | hashtocrack = cmd[1] 13 | try: 14 | wordlistpath = cmd[2] 15 | except Exception as error: 16 | if "list index out of range" in str(error): 17 | wordlistpath = "plugins/wordlist/commonpasswordlist.txt" 18 | else: 19 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Error : " + str(error)) 20 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Cracking started...") 21 | # await d.edit_text("changes") 22 | try: 23 | if (wordlistpath[:7] == "http://") or (wordlistpath[:8] == "https://"): 24 | wordlist = requests.get(wordlistpath).content.decode("utf-8").split() 25 | else: 26 | try: 27 | wordlistpath = "./userbot/" + wordlistpath 28 | with open(wordlistpath,"r") as f: 29 | wordlist = f.read().splitlines() 30 | except Exception as error: 31 | e = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Error : " + str(error)) 32 | # await d.edit_text("Error : " + str(error)) 33 | countword = len(wordlist) 34 | try: 35 | cracked = False 36 | for password in wordlist: 37 | # print("in for looop") 38 | # print("tried : " + str(totaltries)) 39 | hashofpassword = hashlib.md5(password.encode("UTF-8")).hexdigest() 40 | if hashtocrack == hashofpassword: 41 | try: 42 | await d.edit_text("cracked : `" + str(password) + "`") 43 | cracked = True 44 | break 45 | except Exception as error: 46 | if "A wait of" in str(error): 47 | e = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="cracked : `" + str(password) + "`") 48 | cracked = True 49 | break 50 | else: 51 | e = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Error : " + str(error)) 52 | break 53 | else: 54 | if tries == 50: 55 | try: 56 | await d.edit_text("Tried : " + str(totaltries) + "/" + str(countword)) 57 | timewaitrequire = False 58 | tries = 0 59 | except Exception as error: 60 | if timewaitrequire: 61 | continue 62 | if 'A wait of 1665 seconds is required (caused by "messages.EditMessage")' in str(error): 63 | q = await client.send_message(chat_id=d.chat["id"], reply_to_message_id=int(d.message_id), text="Wait regiure to edit message due to large number of editing in message...") 64 | timewaitrequire = True 65 | continue 66 | tries += 1 67 | totaltries += 1 68 | try: 69 | if not cracked: 70 | await d.edit_text("END of File all passwords are tried not Found") 71 | except Exception as error: 72 | if "The message id is invalid" in str(error): 73 | e = await client.send_message(chat_id=d.chat["id"], reply_to_message_id=int(d.message_id), text="Cracking stopped...") 74 | except Exception as error: 75 | await d.edit_text("Error : " + str(error)) 76 | except Exception as error: 77 | if "'utf-8' codec can't decode byte" in str(error): 78 | await d.text("Error : The wordlist contain some non-ascii character Use correct wordlist") 79 | elif "The message id is invalid" in str(error): 80 | e = await client.send_message(chat_id=d.chat["id"], reply_to_message_id=int(d.message_id), text="Cracking stopped...") 81 | 82 | else: 83 | await d.edit_text("Error : " + str(error)) 84 | 85 | 86 | 87 | @UserBot.on_message(filters.me & filters.text & filters.command("sha1crack",".")) 88 | async def cracker(client, message): 89 | cmd = message.command 90 | tries = 0 91 | totaltries = 0 92 | hashtocrack = cmd[1] 93 | try: 94 | wordlistpath = cmd[2] 95 | except Exception as error: 96 | if "list index out of range" in str(error): 97 | wordlistpath = "plugins/wordlist/commonpasswordlist.txt" 98 | else: 99 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Error : " + str(error)) 100 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Cracking started...") 101 | # await d.edit_text("changes") 102 | try: 103 | if (wordlistpath[:7] == "http://") or (wordlistpath[:8] == "https://"): 104 | wordlist = requests.get(wordlistpath).content.decode("utf-8").split() 105 | else: 106 | try: 107 | wordlistpath = "./userbot/" + wordlistpath 108 | with open(wordlistpath,"r") as f: 109 | wordlist = f.read().splitlines() 110 | except Exception as error: 111 | e = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Error : " + str(error)) 112 | # await d.edit_text("Error : " + str(error)) 113 | countword = len(wordlist) 114 | try: 115 | cracked = False 116 | for password in wordlist: 117 | # print("in for looop") 118 | # print("tried : " + str(totaltries)) 119 | hashofpassword = hashlib.sha1(password.encode("UTF-8")).hexdigest() 120 | if hashtocrack == hashofpassword: 121 | try: 122 | await d.edit_text("cracked : `" + str(password) + "`") 123 | cracked = True 124 | break 125 | except Exception as error: 126 | if "A wait of" in str(error): 127 | e = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="cracked : `" + str(password) + "`") 128 | cracked = True 129 | break 130 | else: 131 | e = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Error : " + str(error)) 132 | break 133 | else: 134 | if tries == 50: 135 | try: 136 | await d.edit_text("Tried : " + str(totaltries) + "/" + str(countword)) 137 | timewaitrequire = False 138 | tries = 0 139 | except Exception as error: 140 | if timewaitrequire: 141 | continue 142 | if 'A wait of 1665 seconds is required (caused by "messages.EditMessage")' in str(error): 143 | q = await client.send_message(chat_id=d.chat["id"], reply_to_message_id=int(d.message_id), text="Wait regiure to edit message due to large number of editing in message...") 144 | timewaitrequire = True 145 | continue 146 | tries += 1 147 | totaltries += 1 148 | try: 149 | if not cracked: 150 | await d.edit_text("END of File all passwords are tried not Found") 151 | except Exception as error: 152 | print(error) 153 | except Exception as error: 154 | await d.edit_text("Error : " + str(error)) 155 | except Exception as error: 156 | if "'utf-8' codec can't decode byte" in str(error): 157 | await d.text("Error : The wordlist contain some non-ascii character Use correct wordlist") 158 | elif "The message id is invalid" in str(error): 159 | e = await client.send_message(chat_id=d.chat["id"], reply_to_message_id=int(d.message_id), text="Cracking stopped...") 160 | 161 | else: 162 | await d.edit_text("Error : " + str(error)) 163 | 164 | @UserBot.on_message(filters.me & filters.text & filters.command("sha256crack",".")) 165 | async def cracker(client, message): 166 | cmd = message.command 167 | tries = 0 168 | totaltries = 0 169 | hashtocrack = cmd[1] 170 | try: 171 | wordlistpath = cmd[2] 172 | except Exception as error: 173 | if "list index out of range" in str(error): 174 | wordlistpath = "plugins/wordlist/commonpasswordlist.txt" 175 | else: 176 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Error : " + str(error)) 177 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Cracking started...") 178 | # await d.edit_text("changes") 179 | try: 180 | if (wordlistpath[:7] == "http://") or (wordlistpath[:8] == "https://"): 181 | wordlist = requests.get(wordlistpath).content.decode("utf-8").split() 182 | else: 183 | try: 184 | wordlistpath = "./userbot/" + wordlistpath 185 | with open(wordlistpath,"r") as f: 186 | wordlist = f.read().splitlines() 187 | except Exception as error: 188 | e = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Error : " + str(error)) 189 | # await d.edit_text("Error : " + str(error)) 190 | countword = len(wordlist) 191 | try: 192 | cracked = False 193 | for password in wordlist: 194 | # print("in for looop") 195 | # print("tried : " + str(totaltries)) 196 | hashofpassword = hashlib.sha256(password.encode("UTF-8")).hexdigest() 197 | if hashtocrack == hashofpassword: 198 | try: 199 | await d.edit_text("cracked : `" + str(password) + "`") 200 | cracked = True 201 | break 202 | except Exception as error: 203 | if "A wait of" in str(error): 204 | e = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="cracked : `" + str(password) + "`") 205 | cracked = True 206 | break 207 | else: 208 | e = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Error : " + str(error)) 209 | break 210 | elif password == wordlist[-1]: 211 | await d.edit_text("End OF file NO password cracked") 212 | else: 213 | if tries == 50: 214 | try: 215 | await d.edit_text("Tried : " + str(totaltries) + "/" + str(countword)) 216 | timewaitrequire = False 217 | tries = 0 218 | except Exception as error: 219 | if timewaitrequire: 220 | continue 221 | if 'A wait of 1665 seconds is required (caused by "messages.EditMessage")' in str(error): 222 | q = await client.send_message(chat_id=d.chat["id"], reply_to_message_id=int(d.message_id), text="Wait regiure to edit message due to large number of editing in message...") 223 | timewaitrequire = True 224 | continue 225 | tries += 1 226 | totaltries += 1 227 | try: 228 | if not cracked: 229 | await d.edit_text("END of File all passwords are tried not Found") 230 | except Exception as error: 231 | print(error) 232 | except Exception as error: 233 | await d.edit_text("Error : " + str(error)) 234 | except Exception as error: 235 | if "'utf-8' codec can't decode byte" in str(error): 236 | await d.text("Error : The wordlist contain some non-ascii character Use correct wordlist") 237 | elif "The message id is invalid" in str(error): 238 | e = await client.send_message(chat_id=d.chat["id"], reply_to_message_id=int(d.message_id), text="Cracking stopped...") 239 | 240 | else: 241 | await d.edit_text("Error : " + str(error)) 242 | 243 | @UserBot.on_message(filters.me & filters.text & filters.command("md5hash",".")) 244 | async def hasher(client, message): 245 | cmd = message.command 246 | word = cmd[1] 247 | try: 248 | wordhash = hashlib.md5(word.encode("utf-8")).hexdigest() 249 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="md5hash of " + str(word) + " : `" + str(wordhash) + "`") 250 | except Exception as error: 251 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Error : " + str(error)) 252 | 253 | @UserBot.on_message(filters.me & filters.text & filters.command("sha1hash",".")) 254 | async def hasher(client, message): 255 | cmd = message.command 256 | word = cmd[1] 257 | try: 258 | wordhash = hashlib.sha1(word.encode("utf-8")).hexdigest() 259 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="sha1hash of " + str(word) + " : `" + str(wordhash) + "`") 260 | except Exception as error: 261 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Error : " + str(error)) 262 | 263 | @UserBot.on_message(filters.me & filters.text & filters.command("sha256hash",".")) 264 | async def hasher(client, message): 265 | cmd = message.command 266 | word = cmd[1] 267 | try: 268 | wordhash = hashlib.sha256(word.encode("utf-8")).hexdigest() 269 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="sha256hash of " + str(word) + " : `" + str(wordhash) + "`") 270 | except Exception as error: 271 | d = await client.send_message(chat_id=message.chat["id"], reply_to_message_id=int(message.message_id), text="Error : " + str(error)) 272 | 273 | 274 | add_command_help( 275 | "hackers", 276 | [ 277 | [ 278 | ".md5hash", 279 | "Make md5 hash of a word\nUsage: ``.md5hash ``", 280 | ], 281 | [ 282 | ".md5crack", 283 | "Brute force md5 hash\nUsage: ``.md5crack ``", 284 | ], 285 | [ 286 | ".sha1hash", 287 | "Make sha1 hash of a word\nUsage: ``.sha1hash ``", 288 | ], 289 | [ 290 | ".sha1crack", 291 | "Brute force sha1 hash\nUsage: ``.sha1crack ``", 292 | ], 293 | [ 294 | ".sha256hash", 295 | "Make sha256 hash of a word\nUsage: ``.sha256hash ``", 296 | ], 297 | [ 298 | ".sha256crack", 299 | "Brute force sha256 hash\nUsage: ``.sha256crack ``", 300 | ], 301 | ], 302 | ) 303 | -------------------------------------------------------------------------------- /userbot/utils.py: -------------------------------------------------------------------------------- 1 | # Devil 2 | 3 | import asyncio 4 | import datetime 5 | import importlib 6 | import inspect 7 | import logging 8 | import math 9 | import os 10 | import re 11 | import sys 12 | import time 13 | import traceback 14 | from pathlib import Path 15 | from time import gmtime, strftime 16 | 17 | from telethon import events 18 | from telethon.tl.functions.channels import GetParticipantRequest 19 | from telethon.tl.types import ChannelParticipantAdmin, ChannelParticipantCreator 20 | 21 | from var import Var 22 | 23 | from userbot import CMD_LIST, LOAD_PLUG, LOGS, SUDO_LIST, bot 24 | from userbot.helpers.exceptions import CancelProcess 25 | 26 | ENV = bool(os.environ.get("ENV", False)) 27 | if ENV: 28 | from userbot.uniborgConfig import Config 29 | else: 30 | if os.path.exists("config.py"): 31 | from config import Development as Config 32 | 33 | 34 | 35 | def load_module(shortname): 36 | if shortname.startswith("__"): 37 | pass 38 | elif shortname.endswith("_"): 39 | import userbot.utils 40 | 41 | path = Path(f"userbot/plugins/{shortname}.py") 42 | name = "userbot.plugins.{}".format(shortname) 43 | spec = importlib.util.spec_from_file_location(name, path) 44 | mod = importlib.util.module_from_spec(spec) 45 | spec.loader.exec_module(mod) 46 | LOGS.info("Successfully imported " + shortname) 47 | else: 48 | import userbot.utils 49 | 50 | path = Path(f"userbot/plugins/{shortname}.py") 51 | name = "userbot.plugins.{}".format(shortname) 52 | spec = importlib.util.spec_from_file_location(name, path) 53 | mod = importlib.util.module_from_spec(spec) 54 | mod.bot = bot 55 | mod.tgbot = bot.tgbot 56 | mod.Var = Var 57 | mod.command = command 58 | mod.logger = logging.getLogger(shortname) 59 | # support for uniborg 60 | sys.modules["uniborg.util"] = userbot.utils 61 | mod.Config = Config 62 | mod.borg = bot 63 | mod.edit_or_reply = edit_or_reply 64 | # support for paperplaneextended 65 | sys.modules["userbot.events"] = userbot.utils 66 | spec.loader.exec_module(mod) 67 | # for imports 68 | sys.modules["userbot.plugins." + shortname] = mod 69 | LOGS.info("Successfully imported " + shortname) 70 | 71 | 72 | def remove_plugin(shortname): 73 | try: 74 | try: 75 | for i in LOAD_PLUG[shortname]: 76 | bot.remove_event_handler(i) 77 | del LOAD_PLUG[shortname] 78 | 79 | except BaseException: 80 | name = f"userbot.plugins.{shortname}" 81 | 82 | for i in reversed(range(len(bot._event_builders))): 83 | ev, cb = bot._event_builders[i] 84 | if cb.__module__ == name: 85 | del bot._event_builders[i] 86 | except BaseException: 87 | raise ValueError 88 | 89 | 90 | def admin_cmd(pattern=None, command=None, **args): 91 | args["func"] = lambda e: e.via_bot_id is None 92 | stack = inspect.stack() 93 | previous_stack_frame = stack[1] 94 | file_test = Path(previous_stack_frame.filename) 95 | file_test = file_test.stem.replace(".py", "") 96 | allow_sudo = args.get("allow_sudo", False) 97 | # get the pattern from the decorator 98 | if pattern is not None: 99 | if pattern.startswith(r"\#"): 100 | # special fix for snip.py 101 | args["pattern"] = re.compile(pattern) 102 | elif pattern.startswith(r"^"): 103 | args["pattern"] = re.compile(pattern) 104 | cmd = pattern.replace("$", "").replace("^", "").replace("\\", "") 105 | try: 106 | CMD_LIST[file_test].append(cmd) 107 | except BaseException: 108 | CMD_LIST.update({file_test: [cmd]}) 109 | else: 110 | if len(Config.COMMAND_HAND_LER) == 2: 111 | catreg = "^" + Config.COMMAND_HAND_LER 112 | reg = Config.COMMAND_HAND_LER[1] 113 | elif len(Config.COMMAND_HAND_LER) == 1: 114 | catreg = "^\\" + Config.COMMAND_HAND_LER 115 | reg = Config.COMMAND_HAND_LER 116 | args["pattern"] = re.compile(catreg + pattern) 117 | if command is not None: 118 | cmd = reg + command 119 | else: 120 | cmd = ( 121 | (reg + pattern).replace("$", "").replace("\\", "").replace("^", "") 122 | ) 123 | try: 124 | CMD_LIST[file_test].append(cmd) 125 | except BaseException: 126 | CMD_LIST.update({file_test: [cmd]}) 127 | 128 | args["outgoing"] = True 129 | # should this command be available for other users? 130 | if allow_sudo: 131 | args["from_users"] = list(Config.SUDO_USERS) 132 | # Mutually exclusive with outgoing (can only set one of either). 133 | args["incoming"] = True 134 | del args["allow_sudo"] 135 | 136 | # error handling condition check 137 | elif "incoming" in args and not args["incoming"]: 138 | args["outgoing"] = True 139 | 140 | # add blacklist chats, UB should not respond in these chats 141 | args["blacklist_chats"] = True 142 | black_list_chats = list(Config.UB_BLACK_LIST_CHAT) 143 | if len(black_list_chats) > 0: 144 | args["chats"] = black_list_chats 145 | 146 | # add blacklist chats, UB should not respond in these chats 147 | if "allow_edited_updates" in args and args["allow_edited_updates"]: 148 | args["allow_edited_updates"] 149 | del args["allow_edited_updates"] 150 | 151 | # check if the plugin should listen for outgoing 'messages' 152 | 153 | return events.NewMessage(**args) 154 | 155 | 156 | def sudo_cmd(pattern=None, command=None, **args): 157 | args["func"] = lambda e: e.via_bot_id is None 158 | stack = inspect.stack() 159 | previous_stack_frame = stack[1] 160 | file_test = Path(previous_stack_frame.filename) 161 | file_test = file_test.stem.replace(".py", "") 162 | allow_sudo = args.get("allow_sudo", False) 163 | # get the pattern from the decorator 164 | if pattern is not None: 165 | if pattern.startswith(r"\#"): 166 | # special fix for snip.py 167 | args["pattern"] = re.compile(pattern) 168 | elif pattern.startswith(r"^"): 169 | args["pattern"] = re.compile(pattern) 170 | cmd = pattern.replace("$", "").replace("^", "").replace("\\", "") 171 | try: 172 | SUDO_LIST[file_test].append(cmd) 173 | except BaseException: 174 | SUDO_LIST.update({file_test: [cmd]}) 175 | else: 176 | if len(Config.SUDO_COMMAND_HAND_LER) == 2: 177 | catreg = "^" + Config.SUDO_COMMAND_HAND_LER 178 | reg = Config.SUDO_COMMAND_HAND_LER[1] 179 | elif len(Config.SUDO_COMMAND_HAND_LER) == 1: 180 | catreg = "^\\" + Config.SUDO_COMMAND_HAND_LER 181 | reg = Config.COMMAND_HAND_LER 182 | args["pattern"] = re.compile(catreg + pattern) 183 | if command is not None: 184 | cmd = reg + command 185 | else: 186 | cmd = ( 187 | (reg + pattern).replace("$", "").replace("\\", "").replace("^", "") 188 | ) 189 | try: 190 | SUDO_LIST[file_test].append(cmd) 191 | except BaseException: 192 | SUDO_LIST.update({file_test: [cmd]}) 193 | args["outgoing"] = True 194 | # should this command be available for other users? 195 | if allow_sudo: 196 | args["from_users"] = list(Config.SUDO_USERS) 197 | # Mutually exclusive with outgoing (can only set one of either). 198 | args["incoming"] = True 199 | del args["allow_sudo"] 200 | # error handling condition check 201 | elif "incoming" in args and not args["incoming"]: 202 | args["outgoing"] = True 203 | # add blacklist chats, UB should not respond in these chats 204 | args["blacklist_chats"] = True 205 | black_list_chats = list(Config.UB_BLACK_LIST_CHAT) 206 | if black_list_chats: 207 | args["chats"] = black_list_chats 208 | # add blacklist chats, UB should not respond in these chats 209 | if "allow_edited_updates" in args and args["allow_edited_updates"]: 210 | args["allow_edited_updates"] 211 | del args["allow_edited_updates"] 212 | # check if the plugin should listen for outgoing 'messages' 213 | return events.NewMessage(**args) 214 | 215 | 216 | # https://t.me/c/1220993104/623253 217 | # https://docs.telethon.dev/en/latest/misc/changelog.html#breaking-changes 218 | async def edit_or_reply(event, text, parse_mode=None, link_preview=None): 219 | link_preview = link_preview or False 220 | parse_mode = parse_mode or "md" 221 | if event.sender_id in Config.SUDO_USERS: 222 | reply_to = await event.get_reply_message() 223 | if reply_to: 224 | return await reply_to.reply( 225 | text, parse_mode=parse_mode, link_preview=link_preview 226 | ) 227 | return await event.reply(text, parse_mode=parse_mode, link_preview=link_preview) 228 | return await event.edit(text, parse_mode=parse_mode, link_preview=link_preview) 229 | 230 | 231 | # from paperplaneextended 232 | on = bot.on 233 | 234 | 235 | def on(**args): 236 | def decorator(func): 237 | async def wrapper(event): 238 | # do things like check if sudo 239 | await func(event) 240 | 241 | client.add_event_handler(wrapper, events.NewMessage(**args)) 242 | return wrapper 243 | 244 | return decorater 245 | 246 | 247 | def errors_handler(func): 248 | async def wrapper(errors): 249 | try: 250 | await func(errors) 251 | except BaseException: 252 | 253 | date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) 254 | new = { 255 | 'error': str(sys.exc_info()[1]), 256 | 'date': datetime.datetime.now() 257 | } 258 | 259 | text = "**USERBOT CRASH REPORT**\n\n" 260 | 261 | link = "[here](https://t.me/sn12384)" 262 | text += "If you wanna you can report it" 263 | text += f"- just forward this message {link}.\n" 264 | text += "Nothing is logged except the fact of error and date\n" 265 | 266 | ftext = "\nDisclaimer:\nThis file uploaded ONLY here," 267 | ftext += "\nwe logged only fact of error and date," 268 | ftext += "\nwe respect your privacy," 269 | ftext += "\nyou may not report this error if you've" 270 | ftext += "\nany confidential data here, no one will see your data\n\n" 271 | 272 | ftext += "--------BEGIN USERBOT TRACEBACK LOG--------" 273 | ftext += "\nDate: " + date 274 | ftext += "\nGroup ID: " + str(errors.chat_id) 275 | ftext += "\nSender ID: " + str(errors.sender_id) 276 | ftext += "\n\nEvent Trigger:\n" 277 | ftext += str(errors.text) 278 | ftext += "\n\nTraceback info:\n" 279 | ftext += str(traceback.format_exc()) 280 | ftext += "\n\nError text:\n" 281 | ftext += str(sys.exc_info()[1]) 282 | ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" 283 | 284 | command = "git log --pretty=format:\"%an: %s\" -5" 285 | 286 | ftext += "\n\n\nLast 5 commits:\n" 287 | 288 | process = await asyncio.create_subprocess_shell( 289 | command, 290 | stdout=asyncio.subprocess.PIPE, 291 | stderr=asyncio.subprocess.PIPE) 292 | stdout, stderr = await process.communicate() 293 | result = str(stdout.decode().strip()) \ 294 | + str(stderr.decode().strip()) 295 | 296 | ftext += result 297 | 298 | return wrapper 299 | 300 | 301 | async def progress( 302 | current, total, event, start, type_of_ps, file_name=None, is_cancelled=None 303 | ): 304 | """Generic progress_callback for uploads and downloads.""" 305 | now = time.time() 306 | diff = now - start 307 | if is_cancelled is True: 308 | raise CancelProcess 309 | if round(diff % 10.00) == 0 or current == total: 310 | percentage = current * 100 / total 311 | speed = current / diff 312 | elapsed_time = round(diff) * 1000 313 | time_to_completion = round((total - current) / speed) * 1000 314 | estimated_total_time = elapsed_time + time_to_completion 315 | progress_str = "[{0}{1}] {2}%\n".format( 316 | "".join(["▰" for i in range(math.floor(percentage / 10))]), 317 | "".join(["▱" for i in range(10 - math.floor(percentage / 10))]), 318 | round(percentage, 2), 319 | ) 320 | tmp = progress_str + "{0} of {1}\nETA: {2}".format( 321 | humanbytes(current), humanbytes(total), time_formatter(estimated_total_time) 322 | ) 323 | if file_name: 324 | await event.edit( 325 | "{}\nFile Name: `{}`\n{}".format(type_of_ps, file_name, tmp) 326 | ) 327 | else: 328 | await event.edit("{}\n{}".format(type_of_ps, tmp)) 329 | 330 | 331 | def humanbytes(size): 332 | """Input size in bytes, 333 | outputs in a human readable format""" 334 | # https://stackoverflow.com/a/49361727/4723940 335 | if not size: 336 | return "" 337 | # 2 ** 10 = 1024 338 | power = 2 ** 10 339 | raised_to_pow = 0 340 | dict_power_n = {0: "", 1: "Ki", 2: "Mi", 3: "Gi", 4: "Ti"} 341 | while size > power: 342 | size /= power 343 | raised_to_pow += 1 344 | return str(round(size, 2)) + " " + dict_power_n[raised_to_pow] + "B" 345 | 346 | 347 | def human_to_bytes(size: str) -> int: 348 | units = { 349 | "M": 2 ** 20, 350 | "MB": 2 ** 20, 351 | "G": 2 ** 30, 352 | "GB": 2 ** 30, 353 | "T": 2 ** 40, 354 | "TB": 2 ** 40, 355 | } 356 | 357 | size = size.upper() 358 | if not re.match(r" ", size): 359 | size = re.sub(r"([KMGT])", r" \1", size) 360 | number, unit = [string.strip() for string in size.split()] 361 | return int(float(number) * units[unit]) 362 | 363 | 364 | # Inputs time in milliseconds, to get beautified time, as string 365 | def time_formatter(milliseconds: int) -> str: 366 | seconds, milliseconds = divmod(int(milliseconds), 1000) 367 | minutes, seconds = divmod(seconds, 60) 368 | hours, minutes = divmod(minutes, 60) 369 | days, hours = divmod(hours, 24) 370 | tmp = ( 371 | ((str(days) + " day(s), ") if days else "") 372 | + ((str(hours) + " hour(s), ") if hours else "") 373 | + ((str(minutes) + " minute(s), ") if minutes else "") 374 | + ((str(seconds) + " second(s), ") if seconds else "") 375 | + ((str(milliseconds) + " millisecond(s), ") if milliseconds else "") 376 | ) 377 | return tmp[:-2] 378 | 379 | 380 | class Loader: 381 | def __init__(self, func=None, **args): 382 | self.Var = Var 383 | bot.add_event_handler(func, events.NewMessage(**args)) 384 | 385 | 386 | # Admin checker by uniborg 387 | async def is_admin(client, chat_id, user_id): 388 | if not str(chat_id).startswith("-100"): 389 | return False 390 | try: 391 | req_jo = await client(GetParticipantRequest(channel=chat_id, user_id=user_id)) 392 | chat_participant = req_jo.participant 393 | if isinstance( 394 | chat_participant, (ChannelParticipantCreator, ChannelParticipantAdmin) 395 | ): 396 | return True 397 | except Exception: 398 | return False 399 | else: 400 | return False 401 | 402 | 403 | def register(**args): 404 | args["func"] = lambda e: e.via_bot_id is None 405 | stack = inspect.stack() 406 | previous_stack_frame = stack[1] 407 | file_test = Path(previous_stack_frame.filename) 408 | file_test = file_test.stem.replace(".py", "") 409 | pattern = args.get("pattern", None) 410 | disable_edited = args.get("disable_edited", True) 411 | allow_sudo = args.get("allow_sudo", False) 412 | 413 | if pattern is not None and not pattern.startswith("(?i)"): 414 | args["pattern"] = "(?i)" + pattern 415 | 416 | if "disable_edited" in args: 417 | del args["disable_edited"] 418 | 419 | reg = re.compile("(.*)") 420 | if pattern is not None: 421 | try: 422 | cmd = re.search(reg, pattern) 423 | try: 424 | cmd = cmd.group(1).replace("$", "").replace("\\", "").replace("^", "") 425 | except BaseException: 426 | pass 427 | 428 | try: 429 | CMD_LIST[file_test].append(cmd) 430 | except BaseException: 431 | CMD_LIST.update({file_test: [cmd]}) 432 | except BaseException: 433 | pass 434 | 435 | if allow_sudo: 436 | args["from_users"] = list(Config.SUDO_USERS) 437 | # Mutually exclusive with outgoing (can only set one of either). 438 | args["incoming"] = True 439 | del args["allow_sudo"] 440 | 441 | # error handling condition check 442 | elif "incoming" in args and not args["incoming"]: 443 | args["outgoing"] = True 444 | 445 | # add blacklist chats, UB should not respond in these chats 446 | args["blacklist_chats"] = True 447 | black_list_chats = list(Config.UB_BLACK_LIST_CHAT) 448 | if len(black_list_chats) > 0: 449 | args["chats"] = black_list_chats 450 | 451 | def decorator(func): 452 | if not disable_edited: 453 | bot.add_event_handler(func, events.MessageEdited(**args)) 454 | bot.add_event_handler(func, events.NewMessage(**args)) 455 | try: 456 | LOAD_PLUG[file_test].append(func) 457 | except Exception: 458 | LOAD_PLUG.update({file_test: [func]}) 459 | return func 460 | 461 | return decorator 462 | 463 | 464 | def command(**args): 465 | args["func"] = lambda e: e.via_bot_id is None 466 | 467 | stack = inspect.stack() 468 | previous_stack_frame = stack[1] 469 | file_test = Path(previous_stack_frame.filename) 470 | file_test = file_test.stem.replace(".py", "") 471 | 472 | pattern = args.get("pattern", None) 473 | allow_sudo = args.get("allow_sudo", None) 474 | allow_edited_updates = args.get("allow_edited_updates", False) 475 | args["incoming"] = args.get("incoming", False) 476 | args["outgoing"] = True 477 | if bool(args["incoming"]): 478 | args["outgoing"] = False 479 | 480 | try: 481 | if pattern is not None and not pattern.startswith("(?i)"): 482 | args["pattern"] = "(?i)" + pattern 483 | except BaseException: 484 | pass 485 | 486 | reg = re.compile("(.*)") 487 | if pattern is not None: 488 | try: 489 | cmd = re.search(reg, pattern) 490 | try: 491 | cmd = cmd.group(1).replace("$", "").replace("\\", "").replace("^", "") 492 | except BaseException: 493 | pass 494 | try: 495 | CMD_LIST[file_test].append(cmd) 496 | except BaseException: 497 | CMD_LIST.update({file_test: [cmd]}) 498 | except BaseException: 499 | pass 500 | if allow_sudo: 501 | args["from_users"] = list(Config.SUDO_USERS) 502 | # Mutually exclusive with outgoing (can only set one of either). 503 | args["incoming"] = True 504 | del allow_sudo 505 | try: 506 | del args["allow_sudo"] 507 | except BaseException: 508 | pass 509 | 510 | args["blacklist_chats"] = True 511 | black_list_chats = list(Config.UB_BLACK_LIST_CHAT) 512 | if len(black_list_chats) > 0: 513 | args["chats"] = black_list_chats 514 | 515 | if "allow_edited_updates" in args: 516 | del args["allow_edited_updates"] 517 | 518 | def decorator(func): 519 | if allow_edited_updates: 520 | bot.add_event_handler(func, events.MessageEdited(**args)) 521 | bot.add_event_handler(func, events.NewMessage(**args)) 522 | try: 523 | LOAD_PLUG[file_test].append(func) 524 | except BaseException: 525 | LOAD_PLUG.update({file_test: [func]}) 526 | return func 527 | 528 | return decorator 529 | --------------------------------------------------------------------------------