├── string-requirements.txt ├── telepyrobot ├── __main__.py ├── utils │ ├── cust_p_filters.py │ ├── clear_string.py │ ├── run_shell_cmnd.py │ ├── parser.py │ ├── admin_check.py │ ├── check_size.py │ ├── pyrohelpers.py │ ├── check_if_thumb_exists.py │ ├── dl_helpers.py │ ├── string.py │ └── msg_types.py ├── db │ ├── __init__.py │ ├── gDrive_db.py │ ├── afk_db.py │ ├── gmute_db.py │ ├── my_chats_db.py │ ├── antiservice_db.py │ ├── pmpermit_db.py │ └── notes_db.py ├── plugins │ ├── __init__.py │ ├── google.py │ ├── self_destruct.py │ ├── weather.py │ ├── mention.py │ ├── cas.py │ ├── typewriter.py │ ├── speedtest.py │ ├── antiservice.py │ ├── fileext.py │ ├── neofetch.py │ ├── whois.py │ ├── create_group.py │ ├── help.py │ ├── url_shortner.py │ ├── figlet.py │ ├── quotly.py │ ├── covid.py │ ├── weebify.py │ ├── translate.py │ ├── zipunzip.py │ ├── my_chats.py │ ├── carbon.py │ ├── list_directory.py │ ├── torrent_search.py │ ├── fun.py │ ├── telegraph.py │ ├── rembg.py │ ├── github.py │ ├── zombies.py │ ├── pin.py │ ├── purge.py │ ├── plugin_manager.py │ ├── paste.py │ ├── gmute.py │ ├── deepfry.py │ ├── pmpermit.py │ ├── reverse.py │ ├── dev.py │ ├── heroku.py │ ├── tagppl.py │ ├── chat.py │ ├── basic_ping.py │ ├── notes.py │ ├── updater.py.bk │ ├── manage_self.py │ ├── meganz.py.bk │ ├── admin.py │ ├── afk.py │ └── download_upload.py ├── setclient.py ├── sample_config.py └── __init__.py ├── .dockerignore ├── heroku.yml ├── .github └── workflows │ └── Docker-CI.yml ├── requirements.txt ├── GenerateStringSession.py ├── Dockerfile ├── .gitignore ├── app.json └── README.md /string-requirements.txt: -------------------------------------------------------------------------------- 1 | pyrogram 2 | asyncio 3 | tgcrypto 4 | -------------------------------------------------------------------------------- /telepyrobot/__main__.py: -------------------------------------------------------------------------------- 1 | from .setclient import TelePyroBot 2 | 3 | 4 | if __name__ == "__main__": 5 | TelePyroBot().run() 6 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .git/ 2 | .gitignore 3 | .github/ 4 | GenerateStringSession.py 5 | *.md 6 | string-requirements.txt 7 | app.json 8 | heroku.yml 9 | -------------------------------------------------------------------------------- /heroku.yml: -------------------------------------------------------------------------------- 1 | build: 2 | docker: 3 | worker: Dockerfile 4 | run: 5 | worker: python3 -m telepyrobot 6 | 7 | setup: 8 | addons: 9 | - plan: heroku-postgresql 10 | as: DATABASE -------------------------------------------------------------------------------- /telepyrobot/utils/cust_p_filters.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters 2 | from telepyrobot import SUDO_USERS, OWNER_ID 3 | 4 | 5 | def f_sudo_filter(_, __, m): 6 | return bool(m.from_user.id in SUDO_USERS or m.from_user.id == OWNER_ID) 7 | 8 | 9 | sudo_filter = filters.create(f_sudo_filter) 10 | -------------------------------------------------------------------------------- /.github/workflows/Docker-CI.yml: -------------------------------------------------------------------------------- 1 | name: Docker Image CI 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | 11 | build: 12 | 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v2 17 | - name: Build the Docker image 18 | run: docker build . --file Dockerfile --tag telepyrobot:$(date +%s) 19 | -------------------------------------------------------------------------------- /telepyrobot/utils/clear_string.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | def clear_string(msg: str): 5 | msg = re.sub(r"\(.*)\<\/code\>", "\g<1>", msg) 6 | msg = re.sub(r"\(.*)\<\/i\>", "\g<1>", msg) 7 | msg = re.sub(r"\(.*)\<\/b\>", "\g<1>", msg) 8 | msg = re.sub(r"\(.*)\<\/u\>", "\g<1>", msg) 9 | msg = re.sub(r"\*\*(.*)\*\*", "\g<1>", msg) 10 | msg = re.sub(r"\_\_(.*)\_\_", "\g<1>", msg) 11 | msg = re.sub(r"\`(.*)\`", "\g<1>", msg) 12 | return msg 13 | -------------------------------------------------------------------------------- /telepyrobot/utils/run_shell_cmnd.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from typing import List 3 | 4 | 5 | async def run_command(shell_command: List) -> (str, str): 6 | process = await asyncio.create_subprocess_exec( 7 | *shell_command, 8 | stdout=asyncio.subprocess.PIPE, 9 | stderr=asyncio.subprocess.PIPE, 10 | ) 11 | stdout, stderr = await process.communicate() 12 | e_response = stderr.decode().strip() 13 | t_response = stdout.decode().strip() 14 | return t_response, e_response 15 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pyrogram 2 | psutil 3 | tgcrypto 4 | asyncio 5 | aiofiles 6 | aiohttp 7 | beautifulsoup4 8 | emoji 9 | gitpython 10 | heroku3 11 | hachoir 12 | Pillow 13 | psycopg2-binary 14 | sqlalchemy 15 | youtube-dl 16 | pySmartDL 17 | requests 18 | google-api-python-client 19 | google-auth-httplib2 20 | google-auth-oauthlib 21 | oauth2client 22 | speedtest-cli 23 | prettytable 24 | gtts 25 | telegraph 26 | heroku3 27 | pafy 28 | pyDownload 29 | pyfiglet 30 | bs4 31 | lxml 32 | googletrans 33 | selenium 34 | removebg 35 | mega.py -------------------------------------------------------------------------------- /telepyrobot/db/__init__.py: -------------------------------------------------------------------------------- 1 | from sqlalchemy import create_engine 2 | from sqlalchemy.ext.declarative import declarative_base 3 | from sqlalchemy.orm import sessionmaker, scoped_session 4 | from telepyrobot import DATABASE_URL 5 | 6 | 7 | def start() -> scoped_session: 8 | engine = create_engine(DATABASE_URL) 9 | BASE.metadata.bind = engine 10 | BASE.metadata.create_all(engine) 11 | return scoped_session(sessionmaker(bind=engine, autoflush=False)) 12 | 13 | 14 | BASE = declarative_base() 15 | SESSION = start() 16 | -------------------------------------------------------------------------------- /telepyrobot/utils/parser.py: -------------------------------------------------------------------------------- 1 | import html 2 | import re 3 | 4 | 5 | def cleanhtml(raw_html): 6 | cleanr = re.compile("<.*?>") 7 | cleantext = re.sub(cleanr, "", raw_html) 8 | return cleantext 9 | 10 | 11 | def escape_markdown(text): 12 | escape_chars = r"\*_`\[" 13 | return re.sub(r"([%s])" % escape_chars, r"\\\1", text) 14 | 15 | 16 | def mention_html(user_id, name): 17 | return f'{html.escape(name)}' 18 | 19 | 20 | def mention_markdown(name, user_id): 21 | return f"[{escape_markdown(name)}](tg://user?id={user_id})" 22 | -------------------------------------------------------------------------------- /telepyrobot/utils/admin_check.py: -------------------------------------------------------------------------------- 1 | from telepyrobot.setclient import TelePyroBot 2 | from pyrogram.types import Message 3 | import asyncio 4 | 5 | 6 | async def admin_check(c: TelePyroBot, m: Message): 7 | chat_id = m.chat.id 8 | user_id = m.from_user.id 9 | 10 | check_status = await c.get_chat_member(chat_id=chat_id, user_id=user_id) 11 | admin_strings = ["creator", "administrator"] 12 | if check_status.status not in admin_strings: 13 | await m.edit_text("`I'm not admin nub nibba!`") 14 | await asyncio.sleep(2) 15 | await m.delete() 16 | return False 17 | 18 | return True 19 | -------------------------------------------------------------------------------- /telepyrobot/plugins/__init__.py: -------------------------------------------------------------------------------- 1 | from telepyrobot import LOGGER 2 | 3 | 4 | def __list_all_plugins(): 5 | from os.path import dirname, basename, isfile 6 | import glob 7 | 8 | # This generates a list of plugins in this folder for the * in __main__ to work. 9 | mod_paths = glob.glob(dirname(__file__) + "/*.py") 10 | all_plugins = [ 11 | basename(f)[:-3] 12 | for f in mod_paths 13 | if isfile(f) and f.endswith(".py") and not f.endswith("__init__.py") 14 | ] 15 | return all_plugins 16 | 17 | 18 | ALL_PLUGINS = sorted(__list_all_plugins()) 19 | __all__ = ALL_PLUGINS + ["ALL_PLUGINS"] 20 | -------------------------------------------------------------------------------- /GenerateStringSession.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from pyrogram import Client 3 | 4 | 5 | try: 6 | from telepyrobot import APP_ID, API_HASH 7 | except ModuleNotFoundError: 8 | APP_ID = int(input("Enter Telegram APP ID: ")) 9 | API_HASH = input("Enter Telegram API HASH: ") 10 | 11 | 12 | async def main(api_id, api_hash): 13 | """ Generate String Session for the current Memory Session""" 14 | async with Client(":memory:", api_id=api_id, api_hash=api_hash) as app: 15 | print(await app.export_session_string()) 16 | 17 | 18 | if __name__ == "__main__": 19 | loop = asyncio.get_event_loop() 20 | loop.run_until_complete(main(APP_ID, API_HASH)) 21 | -------------------------------------------------------------------------------- /telepyrobot/plugins/google.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | import asyncio 4 | import requests 5 | from telepyrobot.setclient import TelePyroBot 6 | from pyrogram import filters 7 | from pyrogram.types import Message 8 | from telepyrobot import COMMAND_HAND_LER 9 | 10 | __PLUGIN__ = os.path.basename(__file__.replace(".py", "")) 11 | 12 | __help__ = f""" 13 | Search for a query on google using userbot! 14 | 15 | `{COMMAND_HAND_LER}gs ` 16 | """ 17 | 18 | 19 | @TelePyroBot.on_message(filters.command("gs", COMMAND_HAND_LER) & filters.me) 20 | async def google_s(c: TelePyroBot, m: Message): 21 | input_str = m.text.split(None, 1)[1] 22 | sample_url = "https://da.gd/s?url=https://lmgtfy.com/?q={}%26iie=1".format( 23 | input_str.replace(" ", "+") 24 | ) 25 | response_api = requests.get(sample_url).text 26 | if response_api: 27 | await m.edit_text( 28 | f"[{input_str}]({response_api.rstrip()})\n`Thank me Later 🙃` " 29 | ) 30 | else: 31 | await m.edit_text("`Something is wrong. please try again later.``") 32 | return 33 | -------------------------------------------------------------------------------- /telepyrobot/setclient.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, __version__ 2 | from pyrogram.raw.all import layer 3 | from telepyrobot.plugins import ALL_PLUGINS 4 | from telepyrobot import APP_ID, API_HASH, STRING_SESSION, LOGGER, load_cmds 5 | 6 | 7 | class TelePyroBot(Client): 8 | def __init__(self): 9 | name = self.__class__.__name__.lower() 10 | 11 | super().__init__( 12 | STRING_SESSION, 13 | plugins=dict(root=f"{name}/plugins"), 14 | workdir=f"{name}/session", 15 | api_id=APP_ID, 16 | api_hash=API_HASH, 17 | ) 18 | 19 | async def start(self): 20 | await super().start() 21 | result = load_cmds(ALL_PLUGINS) 22 | LOGGER.info(result) 23 | 24 | me = await self.get_me() 25 | LOGGER.info( 26 | f"TelePyroBot based on Pyrogram v{__version__} " 27 | f"(Layer {layer}) started...\n" 28 | f"Hey {me.first_name}!" 29 | ) 30 | 31 | async def stop(self, *args): 32 | await super().stop() 33 | LOGGER.info("TelePyroBot stopped. Bye.") -------------------------------------------------------------------------------- /telepyrobot/utils/check_size.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | 4 | def get_size_recursive(directory): 5 | """Returns the `directory` size in bytes.""" 6 | total = 0 7 | try: 8 | # print("[+] Getting the size of", directory) 9 | for entry in os.scandir(directory): 10 | if entry.is_file(): 11 | # if it's a file, use stat() function 12 | total += entry.stat().st_size 13 | elif entry.is_dir(): 14 | # if it's a directory, recursively call this function 15 | total += get_size_recursive(entry.path) 16 | except NotADirectoryError: 17 | # if `directory` isn't a directory, get the file size then 18 | return os.path.getsize(directory) 19 | except PermissionError: 20 | # if for whatever reason we can't open the folder, return 0 21 | return 0 22 | return total 23 | 24 | 25 | def get_directory_size(location): 26 | size = get_size_recursive(location) 27 | return get_size_format(size) 28 | 29 | 30 | def get_size_format(b, factor=1024, suffix="B"): 31 | for unit in ["", "K", "M", "G", "T", "P", "E", "Z"]: 32 | if b < factor: 33 | return f"{b:.2f}{unit}{suffix}" 34 | b /= factor 35 | return f"{b:.2f}Y{suffix}" 36 | -------------------------------------------------------------------------------- /telepyrobot/plugins/self_destruct.py: -------------------------------------------------------------------------------- 1 | import os 2 | import asyncio 3 | from telepyrobot.setclient import TelePyroBot 4 | from pyrogram import filters 5 | from pyrogram.types import Message 6 | from telepyrobot import COMMAND_HAND_LER 7 | from telepyrobot.utils.pyrohelpers import ReplyCheck 8 | 9 | __PLUGIN__ = os.path.basename(__file__.replace(".py", "")) 10 | 11 | __help__ = f""" 12 | `{COMMAND_HAND_LER}sdmsg |