├── Config.txt ├── Dockerfile ├── LICENSE ├── Procfile ├── README.md ├── Zaid ├── __init__.py ├── __main__.py ├── database │ ├── __init__.py │ ├── gbandb.py │ ├── gmutedb.py │ ├── pmpermitdb.py │ └── rraid.py ├── helper │ ├── PyroHelpers.py │ ├── __init__.py │ ├── adminHelpers.py │ ├── aiohttp_helper.py │ ├── basic.py │ ├── constants.py │ ├── data.py │ ├── inline.py │ ├── interval.py │ ├── parser.py │ └── utility.py └── modules │ ├── __init__.py │ ├── basic │ ├── __init__.py │ ├── administrator.py │ ├── adminlist.py │ ├── afk.py │ ├── animation.py │ ├── autoscroll.py │ ├── broadcast.py │ ├── carbon.py │ ├── clone.py │ ├── create.py │ ├── define.py │ ├── eval_exec.py │ ├── git_commands.py │ ├── google.py │ ├── hentai_api.py │ ├── invite.py │ ├── joinleave.py │ ├── locks.py │ ├── lyrics.py │ ├── mention.py │ ├── metrics.py │ ├── misc.py │ ├── music.py │ ├── nekobin.py │ ├── pats.py │ ├── ping.py │ ├── profile.py │ ├── purge.py │ ├── quote.py │ ├── sangmata.py │ ├── screenshot.py │ ├── stats.py │ ├── stickers.py │ ├── tagalert.py │ ├── tagall.py │ ├── telegraph.py │ ├── translate.py │ ├── ud.py │ ├── unsplash.py │ ├── upload_files.py │ ├── vctools.py │ ├── vulgar.py │ ├── weather.py │ └── whois.py │ ├── bot │ ├── __init__.py │ ├── bot.py │ ├── inline.py │ └── start.py │ ├── cctools │ └── scraper.py │ ├── fun │ ├── __init__.py │ ├── autopic.py │ ├── emoji.py │ ├── stickers.py │ ├── text_api.py │ └── texts.py │ ├── globals │ └── global.py │ ├── help │ ├── __init__.py │ └── help.py │ ├── private │ ├── __init__.py │ ├── apmguarde.py │ └── pmguard.py │ ├── spam │ ├── Spam.py │ ├── __init__.py │ ├── areplyraid.py │ ├── dmspam.py │ ├── replyraid.py │ └── watcher.py │ ├── sudo │ ├── __init__.py │ └── sudos.py │ └── updater │ ├── __init__.py │ └── update.py ├── app.json ├── cache ├── __init__.py ├── autopic-font-ubuntu.ttf ├── autopic-template.jpg ├── blank.png ├── data.py └── default.ttf ├── config.py ├── heroku.yml ├── render.yaml ├── requirements.txt ├── sample.env ├── server.py └── start.sh /Config.txt: -------------------------------------------------------------------------------- 1 | import os 2 | from os import getenv 3 | from dotenv import load_dotenv 4 | 5 | 6 | API_ID = int(6435225) #optional 7 | API_HASH = "4e984ea35f854762dcde906dce426c2d" #optional 8 | 9 | SUDO_USERS = list(map(int, ("").split())) 10 | OWNER_ID = int(1234567890) 11 | MONGO_URL = "MONGO_URL" 12 | BOT_TOKEN = "BOT_TOKEN" 13 | ALIVE_PIC = 'https://telegra.ph/file/3c52a01057865f7511168.jpg' 14 | ALIVE_TEXT = None 15 | PM_LOGGER = None 16 | LOG_GROUP = None 17 | GIT_TOKEN = None #personal access token 18 | REPO_URL = "https://github.com/ITZ-ZAID/ZAID-USERBOT" 19 | BRANCH = "master" #don't change 20 | 21 | STRING_SESSION1 = "" 22 | STRING_SESSION2 = "" 23 | STRING_SESSION3 = "" 24 | STRING_SESSION4 = "" 25 | STRING_SESSION5 = "" 26 | STRING_SESSION6 = "" 27 | STRING_SESSION7 = "" 28 | STRING_SESSION8 = "" 29 | STRING_SESSION9 = "" 30 | STRING_SESSION10 = "" 31 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.9.7-slim-buster 2 | RUN apt-get update && apt-get upgrade -y 3 | RUN apt-get install git curl python3-pip ffmpeg -y 4 | RUN pip3 install -U pip 5 | RUN python3 -m pip install --upgrade pip 6 | COPY . /app/ 7 | WORKDIR /app/ 8 | RUN pip3 install -U -r requirements.txt 9 | CMD ["bash","start.sh"] 10 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | worker: python3 -m Zaid 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 |

𝐙𝐚𝐢𝐝 𝐔𝐬𝐞𝐫𝐛𝐨𝐭 🔥

4 | 5 | - A First Telegram Userbot Project With Multi Clients Based On PyroGram 6 | 7 |

8 |

9 | 10 | 11 | ## Repo Stats 12 | 13 | ![github card](https://github-readme-stats.vercel.app/api/pin/?username=ITZ-ZAID&repo=ZAID-USERBOT&theme=dark) 14 | 15 | 16 | ## Requirements 17 | 18 | - PyroGram Session 19 | - Dummy account 20 | - Python 3.8+ or 3.7 21 | - [Mongo Db](https://youtu.be/mnvjt_a5JYA) 22 | 23 | ## String Session 24 | 25 |

26 | 27 | 28 | ## 𝐃𝐄𝐏𝐋𝐎𝐘𝐌𝐄𝐍𝐓𝐒 29 | 30 | ᴛᴏ ʙᴇ ꜱᴀꜰᴇ ꜰᴏʀᴋ ᴛʜɪꜱ ʀᴇᴘᴏ ᴀɴᴅ ᴛʜᴇɴ ᴘʀᴇꜱꜱ ᴅᴇᴘʟᴏʏ ʙᴜᴛᴛᴏɴ ꜰʀᴏᴍ ᴛʜᴇ ꜰᴏʀᴋᴇᴅ ʀᴇᴘᴏ 31 | 32 | [ꜰᴏʀᴋ ᴅᴇᴘʟᴏʏ ɪꜱ ʜɪɢʜʟʏ ʀᴇᴄᴏᴍᴍᴇɴᴅᴇᴅ](https://telegra.ph/file/5bcf79f948ca06030640c.mp4) 33 | 34 |

35 | 36 | ## Features 37 | 38 | - **Spamming!** 39 | - **You Can deploy Upto 10 Clients At a Same Time** 40 | - **Almost 90+ Plugins There adding more Plugins Soon** 41 | - **Id Safety Specially For Fake accounts** 42 | 43 | 44 | ## Deploy To Render 45 | 46 | [![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/ITZ-ZAID/ZAID-USERBOT) 47 | 48 | ## Hosting With Mogenius 49 | 50 | I will suggest to host on mogenius if uh don't know what is this then 51 | Checkout Tutorial! 52 |

53 | 54 | 55 | ## VPS/Locally deploy! 56 | ```console 57 | Zaid@Debian~ $ apt-get -y update 58 | Zaid@Debian~ $ apt-get -y install git gcc python3-pip -y 59 | Zaid@Debian~ $ git clone https://github.com/ITZ-ZAID/ZAID-USERBOT 60 | Zaid@Debian~ $ cd ZAID-USERBOT 61 | Zaid@Debian~ $ pip3 install -U -r requirements.txt 62 | Zaid@Debian~ $ cp sample.env .env 63 | Zaid@Debian~ $ nano .env 64 | ``` 65 | 66 |

67 | Edit .env with your own values and Run Bot 68 |

69 | 70 | ```console 71 | Zaid@Debian~ $ screen 72 | Zaid@Debian~ $ python3 -m Zaid 73 | ``` 74 | 75 | ## Disclaimer 76 | 77 | 78 | ```console 79 | ⚠️ WARNING FOR YOU ⚠️ 80 | Your Telegram account may get banned. 81 | I am not responsible for any improper use of this bot 82 | This bot is intended for the purpose of having fun with memes, 83 | as well as efficiently managing groups. 84 | You ended up spamming groups, getting reported left and right, 85 | and you ended up in a Finale Battle with Telegram and at the end 86 | Telegram Team deleted your account? 87 | And after that, then you pointed your fingers at us 88 | for getting your acoount deleted? 89 | I will be rolling on the floor laughing at you. 90 | ``` 91 | 92 | ## Credits 💖 93 | - Zect Userbot 94 | - Man 95 | - pyrogram 96 | - xyz ⚡ 97 | 98 | ## Support / Channel 99 | 100 |

𝐒𝐮𝐩𝐩𝐨𝐫𝐭 / 𝐂𝐡𝐚𝐧𝐧𝐞𝐥 ---->

101 | 102 |

103 |

104 | -------------------------------------------------------------------------------- /Zaid/__init__.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client 2 | from config import API_ID, API_HASH, SUDO_USERS, OWNER_ID, BOT_TOKEN, STRING_SESSION1, STRING_SESSION2, STRING_SESSION3, STRING_SESSION4, STRING_SESSION5, STRING_SESSION6, STRING_SESSION7, STRING_SESSION8, STRING_SESSION9, STRING_SESSION10 3 | from datetime import datetime 4 | import time 5 | from aiohttp import ClientSession 6 | 7 | StartTime = time.time() 8 | START_TIME = datetime.now() 9 | CMD_HELP = {} 10 | SUDO_USER = SUDO_USERS 11 | clients = [] 12 | ids = [] 13 | 14 | SUDO_USERS.append(OWNER_ID) 15 | aiosession = ClientSession() 16 | 17 | if API_ID: 18 | API_ID = API_ID 19 | else: 20 | print("WARNING: API ID NOT FOUND USING ZAID API ⚡") 21 | API_ID = "6435225" 22 | 23 | if API_HASH: 24 | API_HASH = API_HASH 25 | else: 26 | print("WARNING: API HASH NOT FOUND USING ZAID API ⚡") 27 | API_HASH = "4e984ea35f854762dcde906dce426c2d" 28 | 29 | if not BOT_TOKEN: 30 | print("WARNING: BOT TOKEN NOT FOUND PLZ ADD ⚡") 31 | 32 | app = Client( 33 | name="app", 34 | api_id=API_ID, 35 | api_hash=API_HASH, 36 | bot_token=BOT_TOKEN, 37 | plugins=dict(root="Zaid/modules/bot"), 38 | in_memory=True, 39 | ) 40 | 41 | if STRING_SESSION1: 42 | print("Client1: Found.. Starting..📳") 43 | client1 = Client(name="one", api_id=API_ID, api_hash=API_HASH, session_string=STRING_SESSION1, plugins=dict(root="Zaid/modules")) 44 | clients.append(client1) 45 | 46 | if STRING_SESSION2: 47 | print("Client2: Found.. Starting.. 📳") 48 | client2 = Client(name="two", api_id=API_ID, api_hash=API_HASH, session_string=STRING_SESSION2, plugins=dict(root="Zaid/modules")) 49 | clients.append(client2) 50 | 51 | if STRING_SESSION3: 52 | print("Client3: Found.. Starting.. 📳") 53 | client3 = Client(name="three", api_id=API_ID, api_hash=API_HASH, session_string=STRING_SESSION3, plugins=dict(root="Zaid/modules")) 54 | clients.append(client3) 55 | 56 | if STRING_SESSION4: 57 | print("Client4: Found.. Starting.. 📳") 58 | client4 = Client(name="four", api_id=API_ID, api_hash=API_HASH, session_string=STRING_SESSION4, plugins=dict(root="Zaid/modules")) 59 | clients.append(client4) 60 | 61 | if STRING_SESSION5: 62 | print("Client5: Found.. Starting.. 📳") 63 | client5 = Client(name="five", api_id=API_ID, api_hash=API_HASH, session_string=STRING_SESSION5, plugins=dict(root="Zaid/modules")) 64 | clients.append(client5) 65 | 66 | if STRING_SESSION6: 67 | print("Client6: Found.. Starting.. 📳") 68 | client6 = Client(name="six", api_id=API_ID, api_hash=API_HASH, session_string=STRING_SESSION6, plugins=dict(root="Zaid/modules")) 69 | clients.append(client6) 70 | 71 | if STRING_SESSION7: 72 | print("Client7: Found.. Starting.. 📳") 73 | client7 = Client(name="seven", api_id=API_ID, api_hash=API_HASH, session_string=STRING_SESSION7, plugins=dict(root="Zaid/modules")) 74 | clients.append(client7) 75 | 76 | if STRING_SESSION8: 77 | print("Client8: Found.. Starting.. 📳") 78 | client8 = Client(name="eight", api_id=API_ID, api_hash=API_HASH, session_string=STRING_SESSION8, plugins=dict(root="Zaid/modules")) 79 | clients.append(client8) 80 | 81 | if STRING_SESSION9: 82 | print("Client9: Found.. Starting.. 📳") 83 | client9 = Client(name="nine", api_id=API_ID, api_hash=API_HASH, session_string=STRING_SESSION9, plugins=dict(root="Zaid/modules")) 84 | clients.append(client9) 85 | 86 | if STRING_SESSION10: 87 | print("Client10: Found.. Starting.. 📳") 88 | client10 = Client(name="ten", api_id=API_ID, api_hash=API_HASH, session_string=STRING_SESSION10, plugins=dict(root="Zaid/modules")) 89 | clients.append(client10) 90 | -------------------------------------------------------------------------------- /Zaid/__main__.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import importlib 3 | from pyrogram import Client, idle 4 | from Zaid.helper import join 5 | from Zaid.modules import ALL_MODULES 6 | from Zaid import clients, app, ids 7 | 8 | async def start_bot(): 9 | await app.start() 10 | print("LOG: Founded Bot token Booting..") 11 | for all_module in ALL_MODULES: 12 | importlib.import_module("Zaid.modules" + all_module) 13 | print(f"Successfully Imported {all_module} 💥") 14 | for cli in clients: 15 | try: 16 | await cli.start() 17 | ex = await cli.get_me() 18 | await join(cli) 19 | print(f"Started {ex.first_name} 🔥") 20 | ids.append(ex.id) 21 | except Exception as e: 22 | print(f"{e}") 23 | await idle() 24 | 25 | loop = asyncio.get_event_loop() 26 | loop.run_until_complete(start_bot()) 27 | -------------------------------------------------------------------------------- /Zaid/database/__init__.py: -------------------------------------------------------------------------------- 1 | import motor.motor_asyncio 2 | 3 | from config import MONGO_URL 4 | cli = motor.motor_asyncio.AsyncIOMotorClient(MONGO_URL) 5 | 6 | dbb = cli.program 7 | -------------------------------------------------------------------------------- /Zaid/database/gbandb.py: -------------------------------------------------------------------------------- 1 | from typing import Dict, List, Union 2 | 3 | from Zaid.database import dbb as db 4 | 5 | gbansdb = db.gban 6 | 7 | 8 | async def gban_list() -> list: 9 | users = gbansdb.find({"user_id": {"$gt": 0}}) 10 | users = await users.to_list(length=100000) 11 | return users 12 | 13 | async def gban_count() -> int: 14 | users = gbansdb.find({"user_id": {"$gt": 0}}) 15 | users = await users.to_list(length=100000) 16 | return len(users) 17 | 18 | async def gban_info(user_id: int) -> bool: 19 | user = await gbansdb.find_one({"user_id": user_id}) 20 | if not user: 21 | return False 22 | return True 23 | 24 | async def gban_user(user_id: int): 25 | is_gbanned = await gban_info(user_id) 26 | if is_gbanned: 27 | return 28 | return await gbansdb.insert_one({"user_id": user_id}) 29 | 30 | async def ungban_user(user_id: int): 31 | is_gbanned = await gban_info(user_id) 32 | if not is_gbanned: 33 | return 34 | return await gbansdb.delete_one({"user_id": user_id}) 35 | -------------------------------------------------------------------------------- /Zaid/database/gmutedb.py: -------------------------------------------------------------------------------- 1 | from Zaid.database import cli 2 | 3 | gmuteh = cli["GMUTE"] 4 | 5 | 6 | async def is_gmuted(sender_id): 7 | kk = await gmuteh.find_one({"sender_id": sender_id}) 8 | return bool(kk) 9 | 10 | 11 | async def gmute(sender_id, reason="#GMuted"): 12 | await gmuteh.insert_one({"sender_id": sender_id, "reason": reason}) 13 | 14 | 15 | async def ungmute(sender_id): 16 | await gmuteh.delete_one({"sender_id": sender_id}) 17 | -------------------------------------------------------------------------------- /Zaid/database/pmpermitdb.py: -------------------------------------------------------------------------------- 1 | from Zaid.database import cli 2 | import asyncio 3 | 4 | collection = cli["Zaid"]["pmpermit"] 5 | 6 | PMPERMIT_MESSAGE = ( 7 | "**ᴡᴀʀɴɪɴɢ!⚠️ ᴘʟᴢ ʀᴇᴀᴅ ᴛʜɪꜱ ᴍᴇꜱꜱᴀɢᴇ ᴄᴀʀᴇꜰᴜʟʟʏ..\n\n**" 8 | "**ɪ'ᴍ ᴢᴀɪᴅ ᴜꜱᴇʀʙᴏᴛ ɪ'ᴍ ʜᴇʀᴇ ᴛᴏ ᴘʀᴏᴛᴇᴄᴛ ᴍʏ ᴍᴀꜱᴛᴇʀ ꜰʀᴏᴍ ꜱᴘᴀᴍᴍᴇʀꜱ.**" 9 | "**ɪꜰ ʏᴏᴜ ᴀʀᴇ ɴᴏᴛ ᴀ ꜱᴘᴀᴍᴍᴇʀ ᴛʜᴇɴ ᴘʟᴢ ᴡᴀɪᴛ!.\n\n**" 10 | "**ᴜɴᴛɪʟ ᴛʜᴇɴ, ᴅᴏɴ'ᴛ ꜱᴘᴀᴍ, ᴏʀ ʏᴏᴜ'ʟʟ ɢᴇᴛ ʙʟᴏᴄᴋᴇᴅ ᴀɴᴅ ʀᴇᴘᴏʀᴛᴇᴅ ʙʏ ᴍᴇ, ꜱᴏ ʙᴇ ᴄᴀʀᴇꜰᴜʟʟ ᴛᴏ ꜱᴇɴᴅ ᴀɴʏ ᴍᴇꜱꜱᴀɢᴇꜱ!**" 11 | ) 12 | 13 | BLOCKED = "**ʙᴇᴇᴘ ʙᴏᴏᴘ ꜰᴏᴜɴᴅᴇᴅ ᴀ ꜱᴘᴀᴍᴍᴇʀ!, ʙʟᴏᴄᴋᴇᴅ ꜱᴜᴄᴄᴇꜱꜱꜰᴜʟʟʏ!**" 14 | 15 | LIMIT = 5 16 | 17 | 18 | async def set_pm(value: bool): 19 | doc = {"_id": 1, "pmpermit": value} 20 | doc2 = {"_id": "Approved", "users": []} 21 | r = await collection.find_one({"_id": 1}) 22 | r2 = await collection.find_one({"_id": "Approved"}) 23 | if r: 24 | await collection.update_one({"_id": 1}, {"$set": {"pmpermit": value}}) 25 | else: 26 | await collection.insert_one(doc) 27 | if not r2: 28 | await collection.insert_one(doc2) 29 | 30 | 31 | async def set_permit_message(text): 32 | await collection.update_one({"_id": 1}, {"$set": {"pmpermit_message": text}}) 33 | 34 | 35 | async def set_block_message(text): 36 | await collection.update_one({"_id": 1}, {"$set": {"block_message": text}}) 37 | 38 | 39 | async def set_limit(limit): 40 | await collection.update_one({"_id": 1}, {"$set": {"limit": limit}}) 41 | 42 | 43 | async def get_pm_settings(): 44 | result = await collection.find_one({"_id": 1}) 45 | if not result: 46 | return False 47 | pmpermit = result["pmpermit"] 48 | pm_message = result.get("pmpermit_message", PMPERMIT_MESSAGE) 49 | block_message = result.get("block_message", BLOCKED) 50 | limit = result.get("limit", LIMIT) 51 | return pmpermit, pm_message, limit, block_message 52 | 53 | 54 | async def allow_user(chat): 55 | doc = {"_id": "Approved", "users": [chat]} 56 | r = await collection.find_one({"_id": "Approved"}) 57 | if r: 58 | await collection.update_one({"_id": "Approved"}, {"$push": {"users": chat}}) 59 | else: 60 | await collection.insert_one(doc) 61 | 62 | 63 | async def get_approved_users(): 64 | results = await collection.find_one({"_id": "Approved"}) 65 | if results: 66 | return results["users"] 67 | else: 68 | return [] 69 | 70 | 71 | async def deny_user(chat): 72 | await collection.update_one({"_id": "Approved"}, {"$pull": {"users": chat}}) 73 | 74 | 75 | async def pm_guard(): 76 | result = await collection.find_one({"_id": 1}) 77 | if not result: 78 | return False 79 | if not result["pmpermit"]: 80 | return False 81 | else: 82 | return True 83 | -------------------------------------------------------------------------------- /Zaid/database/rraid.py: -------------------------------------------------------------------------------- 1 | from Zaid.database import cli 2 | 3 | collection = cli["Zaid"]["rraid"] 4 | 5 | 6 | async def rraid_user(chat): 7 | doc = {"_id": "Rraid", "users": [chat]} 8 | r = await collection.find_one({"_id": "Rraid"}) 9 | if r: 10 | await collection.update_one({"_id": "Rraid"}, {"$push": {"users": chat}}) 11 | else: 12 | await collection.insert_one(doc) 13 | 14 | 15 | async def get_rraid_users(): 16 | results = await collection.find_one({"_id": "Rraid"}) 17 | if results: 18 | return results["users"] 19 | else: 20 | return [] 21 | 22 | 23 | async def unrraid_user(chat): 24 | await collection.update_one({"_id": "Rraid"}, {"$pull": {"users": chat}}) 25 | -------------------------------------------------------------------------------- /Zaid/helper/PyroHelpers.py: -------------------------------------------------------------------------------- 1 | from pyrogram.types import Message, User 2 | from pyrogram import Client, enums 3 | 4 | async def get_ub_chats( 5 | client: Client, 6 | chat_types: list = [ 7 | enums.ChatType.GROUP, 8 | enums.ChatType.SUPERGROUP, 9 | enums.ChatType.CHANNEL, 10 | ], 11 | is_id_only=True, 12 | ): 13 | ub_chats = [] 14 | async for dialog in client.get_dialogs(): 15 | if dialog.chat.type in chat_types: 16 | if is_id_only: 17 | ub_chats.append(dialog.chat.id) 18 | else: 19 | ub_chats.append(dialog.chat) 20 | else: 21 | continue 22 | return ub_chats 23 | 24 | def ReplyCheck(message: Message): 25 | reply_id = None 26 | 27 | if message.reply_to_message: 28 | reply_id = message.reply_to_message.id 29 | 30 | elif not message.from_user.is_self: 31 | reply_id = message.id 32 | 33 | return reply_id 34 | 35 | 36 | def SpeedConvert(size): 37 | power = 2 ** 10 38 | zero = 0 39 | units = {0: "", 1: "Kbit/s", 2: "Mbit/s", 3: "Gbit/s", 4: "Tbit/s"} 40 | while size > power: 41 | size /= power 42 | zero += 1 43 | return f"{round(size, 2)} {units[zero]}" 44 | 45 | 46 | def GetFromUserID(message: Message): 47 | return message.from_user.id 48 | 49 | 50 | def GetChatID(message: Message): 51 | return message.chat.id 52 | 53 | 54 | def GetUserMentionable(user: User): 55 | if user.username: 56 | username = "@{}".format(user.username) 57 | else: 58 | if user.last_name: 59 | name_string = "{} {}".format(user.first_name, user.last_name) 60 | else: 61 | name_string = "{}".format(user.first_name) 62 | 63 | username = "{}".format(user.id, name_string) 64 | 65 | return username 66 | -------------------------------------------------------------------------------- /Zaid/helper/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | from pyrogram import Client 4 | 5 | 6 | 7 | def restart(): 8 | os.execvp(sys.executable, [sys.executable, "-m", "Zaid"]) 9 | 10 | async def join(client): 11 | try: 12 | await client.join_chat("TheUpdatesChannel") 13 | except BaseException: 14 | pass 15 | -------------------------------------------------------------------------------- /Zaid/helper/adminHelpers.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from time import time 3 | 4 | from pyrogram.types import Message 5 | 6 | from pyrogram import Client 7 | from Zaid.helper.interval import IntervalHelper 8 | 9 | 10 | async def CheckAdmin(message: Message): 11 | """Check if we are an admin.""" 12 | admin = "administrator" 13 | creator = "creator" 14 | ranks = [admin, creator] 15 | 16 | SELF = await Client.get_chat_member( 17 | chat_id=message.chat.id, user_id=message.from_user.id 18 | ) 19 | 20 | if SELF.status not in ranks: 21 | await message.edit("__I'm not Admin!__") 22 | await asyncio.sleep(2) 23 | await message.delete() 24 | 25 | else: 26 | if SELF.status is not admin: 27 | return True 28 | elif SELF.can_restrict_members: 29 | return True 30 | else: 31 | await message.edit("__No Permissions to restrict Members__") 32 | await asyncio.sleep(2) 33 | await message.delete() 34 | 35 | 36 | async def CheckReplyAdmin(message: Message): 37 | """Check if the message is a reply to another user.""" 38 | if not message.reply_to_message: 39 | await message.edit("The command needs to be a reply") 40 | await asyncio.sleep(2) 41 | await message.delete() 42 | elif message.reply_to_message.from_user.is_self: 43 | await message.edit(f"I can't {message.command[0]} myself.") 44 | await asyncio.sleep(2) 45 | await message.delete() 46 | else: 47 | return True 48 | 49 | return False 50 | 51 | 52 | async def Timer(message: Message): 53 | if len(message.command) > 1: 54 | secs = IntervalHelper(message.command[1]) 55 | return int(str(time()).split(".")[0] + secs.to_secs()[0]) 56 | else: 57 | return 0 58 | 59 | 60 | async def TimerString(message: Message): 61 | secs = IntervalHelper(message.command[1]) 62 | return f"{secs.to_secs()[1]} {secs.to_secs()[2]}" 63 | 64 | 65 | async def RestrictFailed(message: Message): 66 | await message.edit(f"I can't {message.command} this user.") 67 | await asyncio.sleep(2) 68 | await message.delete() 69 | -------------------------------------------------------------------------------- /Zaid/helper/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 | -------------------------------------------------------------------------------- /Zaid/helper/basic.py: -------------------------------------------------------------------------------- 1 | from pyrogram.types import Message 2 | 3 | 4 | def get_user(message: Message, text: str) -> [int, str, None]: 5 | """Get User From Message""" 6 | if text is None: 7 | asplit = None 8 | else: 9 | asplit = text.split(" ", 1) 10 | user_s = None 11 | reason_ = None 12 | if message.reply_to_message: 13 | user_s = message.reply_to_message.from_user.id 14 | reason_ = text if text else None 15 | elif asplit is None: 16 | return None, None 17 | elif len(asplit[0]) > 0: 18 | if message.entities: 19 | if len(message.entities) == 1: 20 | required_entity = message.entities[0] 21 | if required_entity.type == "text_mention": 22 | user_s = int(required_entity.user.id) 23 | else: 24 | user_s = int(asplit[0]) if asplit[0].isdigit() else asplit[0] 25 | else: 26 | user_s = int(asplit[0]) if asplit[0].isdigit() else asplit[0] 27 | if len(asplit) == 2: 28 | reason_ = asplit[1] 29 | return user_s, reason_ 30 | 31 | 32 | def get_text(message: Message) -> [None, str]: 33 | """Extract Text From Commands""" 34 | text_to_return = message.text 35 | if message.text is None: 36 | return None 37 | if " " in text_to_return: 38 | try: 39 | return message.text.split(None, 1)[1] 40 | except IndexError: 41 | return None 42 | else: 43 | return None 44 | 45 | 46 | async def edit_or_reply(message: Message, *args, **kwargs) -> Message: 47 | apa = ( 48 | message.edit_text 49 | if bool(message.from_user and message.from_user.is_self or message.outgoing) 50 | else (message.reply_to_message or message).reply_text 51 | ) 52 | return await apa(*args, **kwargs) 53 | 54 | 55 | eor = edit_or_reply 56 | -------------------------------------------------------------------------------- /Zaid/helper/data.py: -------------------------------------------------------------------------------- 1 | from pyrogram.types import InlineKeyboardButton, WebAppInfo 2 | 3 | class Data: 4 | 5 | text_help_menu = ( 6 | "**Command List & Help**\n**— Prefixes:** `.`" 7 | .replace(",", "") 8 | .replace("[", "") 9 | .replace("]", "") 10 | .replace("'", "") 11 | ) 12 | reopen = [[InlineKeyboardButton("Re-Open", callback_data="reopen")]] 13 | -------------------------------------------------------------------------------- /Zaid/helper/inline.py: -------------------------------------------------------------------------------- 1 | from math import ceil 2 | from traceback import format_exc 3 | 4 | from pyrogram.errors import MessageNotModified 5 | from pyrogram.types import ( 6 | InlineKeyboardButton, 7 | InlineQueryResultArticle, 8 | InputTextMessageContent, 9 | ) 10 | 11 | from Zaid import ids as list_users 12 | 13 | looters = None 14 | 15 | 16 | def paginate_help(page_number, loaded_modules, prefix): 17 | number_of_rows = 5 18 | number_of_cols = 3 19 | global looters 20 | looters = page_number 21 | helpable_modules = [p for p in loaded_modules if not p.startswith("_")] 22 | helpable_modules = sorted(helpable_modules) 23 | modules = [ 24 | InlineKeyboardButton( 25 | text="{}".format(x), 26 | callback_data=f"ub_modul_{x}", 27 | ) 28 | for x in helpable_modules 29 | ] 30 | pairs = list(zip(modules[::number_of_cols], modules[1::number_of_cols])) 31 | if len(modules) % number_of_cols == 1: 32 | pairs.append((modules[-1],)) 33 | max_num_pages = ceil(len(pairs) / number_of_rows) 34 | modulo_page = page_number % max_num_pages 35 | if len(pairs) > number_of_rows: 36 | pairs = pairs[ 37 | modulo_page * number_of_rows : number_of_rows * (modulo_page + 1) 38 | ] + [ 39 | ( 40 | InlineKeyboardButton( 41 | text="✘", callback_data=f"{prefix}_prev({modulo_page})" 42 | ), 43 | InlineKeyboardButton(text="ᴄʟᴏsᴇ", callback_data="close_help"), 44 | InlineKeyboardButton( 45 | text="✘", callback_data=f"{prefix}_next({modulo_page})" 46 | ), 47 | ) 48 | ] 49 | return pairs 50 | 51 | 52 | def cb_wrapper(func): 53 | async def wrapper(client, cb): 54 | users = list_users 55 | if cb.from_user.id not in users: 56 | await cb.answer( 57 | "Kya Hai? Kaam kar apna!", 58 | cache_time=0, 59 | show_alert=True, 60 | ) 61 | else: 62 | try: 63 | await func(client, cb) 64 | except MessageNotModified: 65 | await cb.answer("🤔🧐") 66 | except Exception: 67 | print(format_exc()) 68 | await cb.answer( 69 | f"Oh No, SomeThing Isn't Right. Please Check Logs!", 70 | cache_time=0, 71 | show_alert=True, 72 | ) 73 | 74 | return wrapper 75 | 76 | 77 | def inline_wrapper(func): 78 | async def wrapper(client, inline_query): 79 | users = list_users 80 | if inline_query.from_user.id not in users: 81 | await client.answer_inline_query( 82 | inline_query.id, 83 | cache_time=1, 84 | results=[ 85 | ( 86 | InlineQueryResultArticle( 87 | title="Sorry, Friend You Can't Use Me!", 88 | input_message_content=InputTextMessageContent( 89 | "You cannot access this Bot" 90 | ), 91 | ) 92 | ) 93 | ], 94 | ) 95 | else: 96 | await func(client, inline_query) 97 | 98 | return wrapper 99 | -------------------------------------------------------------------------------- /Zaid/helper/interval.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | class IntervalHelper: 5 | class IntervalError(Exception): 6 | pass 7 | 8 | interval_re = re.compile(r"^(\d+)(w|d|h|m)?$") 9 | 10 | def __init__(self, _interval): 11 | self._interval = _interval 12 | if not self.interval_ok(): 13 | raise Exception("Invalid interval format.") 14 | 15 | def interval_ok(self): 16 | if IntervalHelper.interval_re.match(self._interval): 17 | return True 18 | return False 19 | 20 | def to_secs(self): 21 | m = IntervalHelper.interval_re.match(self._interval) 22 | num, unit = m.groups() 23 | num = int(num) 24 | 25 | if not unit: 26 | unit = "m" 27 | 28 | if unit == "m": 29 | return [num * 60, num, "minute" if num == 1 else "minutes"] 30 | elif unit == "h": 31 | return [num * 60 * 60, num, "hour" if num == 1 else "hours"] 32 | elif unit == "d": 33 | return [num * 60 * 60 * 24, num, "day" if num == 1 else "days"] 34 | elif unit == "w": 35 | return [num * 60 * 60 * 24 * 7, num, "week" if num == 1 else "weeks"] 36 | 37 | interval = property(lambda self: self._interval) 38 | -------------------------------------------------------------------------------- /Zaid/helper/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 | """Helper function to escape telegram markup symbols.""" 13 | escape_chars = r"\*_`\[" 14 | return re.sub(r"([%s])" % escape_chars, r"\\\1", text) 15 | 16 | 17 | def mention_html(user_id, name): 18 | return '{}'.format(user_id, html.escape(name)) 19 | 20 | 21 | def mention_markdown(user_id, name): 22 | return "[{}](tg://user?id={})".format(escape_markdown(name), user_id) 23 | -------------------------------------------------------------------------------- /Zaid/helper/utility.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import math 3 | import random 4 | import time 5 | import uuid 6 | from random import randint 7 | 8 | def get_arg(message): 9 | msg = message.text 10 | msg = msg.replace(" ", "", 1) if msg[1] == " " else msg 11 | split = msg[1:].replace("\n", " \n").split(" ") 12 | if " ".join(split[1:]).strip() == "": 13 | return "" 14 | return " ".join(split[1:]) 15 | 16 | def split_list(input_list, n): 17 | n = max(1, n) 18 | return [input_list[i: i + n] for i in range(0, len(input_list), n)] 19 | 20 | 21 | def human_time(*args, **kwargs): 22 | secs = float(datetime.timedelta(*args, **kwargs).total_seconds()) 23 | units = [("day", 86400), ("hour", 3600), ("minute", 60), ("second", 1)] 24 | parts = [] 25 | for unit, mul in units: 26 | if secs / mul >= 1 or mul == 1: 27 | if mul > 1: 28 | n = int(math.floor(secs / mul)) 29 | secs -= n * mul 30 | else: 31 | n = secs if secs != int(secs) else int(secs) 32 | parts.append("%s %s%s" % (n, unit, "" if n == 1 else "s")) 33 | return ", ".join(parts) 34 | 35 | 36 | def random_interval(): 37 | rand_value = randint(14400, 43200) 38 | delta = (time.time() + rand_value) - time.time() 39 | return int(delta) 40 | 41 | 42 | def get_random_hex(chars=4): 43 | my_hex = uuid.uuid4().hex[:chars] 44 | return my_hex 45 | 46 | 47 | def get_mock_text(sentence): 48 | new_sentence = "" 49 | number = 0 50 | 51 | for letter in sentence.lower(): 52 | if len(new_sentence) < 2: 53 | random_number = random.randint( 54 | 0, 1 55 | ) 56 | if random_number == 0: 57 | new_sentence += letter.upper() 58 | else: 59 | new_sentence += letter 60 | else: 61 | if ( 62 | new_sentence[number - 2].isupper() 63 | and new_sentence[number - 1].isupper() 64 | or new_sentence[number - 2].islower() 65 | and new_sentence[number - 1].islower() 66 | ): 67 | if new_sentence[ 68 | number - 1 69 | ].isupper(): 70 | new_sentence += letter.lower() 71 | else: 72 | new_sentence += letter.upper() 73 | else: 74 | random_number = random.randint(0, 1) 75 | if random_number == 0: 76 | new_sentence += letter.upper() 77 | else: 78 | new_sentence += letter 79 | 80 | number += 1 81 | return new_sentence 82 | -------------------------------------------------------------------------------- /Zaid/modules/__init__.py: -------------------------------------------------------------------------------- 1 | import glob 2 | from os.path import dirname, isfile 3 | 4 | 5 | def __list_all_modules(): 6 | work_dir = dirname(__file__) 7 | mod_paths = glob.glob(work_dir + "/*/*.py") 8 | 9 | all_modules = [ 10 | (((f.replace(work_dir, "")).replace("/", "."))[:-3]) 11 | for f in mod_paths 12 | if isfile(f) 13 | and f.endswith(".py") 14 | and not f.endswith("__init__.py") 15 | ] 16 | 17 | return all_modules 18 | 19 | 20 | ALL_MODULES = sorted(__list_all_modules()) 21 | __all__ = ALL_MODULES + ["ALL_MODULES"] 22 | -------------------------------------------------------------------------------- /Zaid/modules/basic/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Zaid/modules/basic/adminlist.py: -------------------------------------------------------------------------------- 1 | import html 2 | 3 | from pyrogram import Client, enums, filters 4 | from pyrogram.types import Message 5 | 6 | from Zaid.helper.basic import edit_or_reply 7 | from Zaid.helper.parser import mention_html, mention_markdown 8 | from Zaid.modules.help import * 9 | 10 | 11 | @Client.on_message(filters.me & filters.command(["admins", "adminlist"], ".")) 12 | async def adminlist(client: Client, message: Message): 13 | replyid = None 14 | toolong = False 15 | if len(message.text.split()) >= 2: 16 | chat = message.text.split(None, 1)[1] 17 | grup = await client.get_chat(chat) 18 | else: 19 | chat = message.chat.id 20 | grup = await client.get_chat(chat) 21 | if message.reply_to_message: 22 | replyid = message.reply_to_message.id 23 | creator = [] 24 | admin = [] 25 | badmin = [] 26 | async for a in client.get_chat_members( 27 | message.chat.id, filter=enums.ChatMembersFilter.ADMINISTRATORS 28 | ): 29 | try: 30 | nama = a.user.first_name + " " + a.user.last_name 31 | except: 32 | nama = a.user.first_name 33 | if nama is None: 34 | nama = "☠️ Deleted account" 35 | if a.status == enums.ChatMemberStatus.ADMINISTRATOR: 36 | if a.user.is_bot: 37 | badmin.append(mention_markdown(a.user.id, nama)) 38 | else: 39 | admin.append(mention_markdown(a.user.id, nama)) 40 | elif a.status == enums.ChatMemberStatus.OWNER: 41 | creator.append(mention_markdown(a.user.id, nama)) 42 | admin.sort() 43 | badmin.sort() 44 | totaladmins = len(creator) + len(admin) + len(badmin) 45 | teks = "**Admins in {}**\n".format(grup.title) 46 | teks += "╒═══「 Creator 」\n" 47 | for x in creator: 48 | teks += "│ • {}\n".format(x) 49 | if len(teks) >= 4096: 50 | await message.reply(message.chat.id, teks, reply_to_message_id=replyid) 51 | teks = "" 52 | toolong = True 53 | teks += "╞══「 {} Human Administrator 」\n".format(len(admin)) 54 | for x in admin: 55 | teks += "│ • {}\n".format(x) 56 | if len(teks) >= 4096: 57 | await message.reply(message.chat.id, teks, reply_to_message_id=replyid) 58 | teks = "" 59 | toolong = True 60 | teks += "╞══「 {} Bot Administrator 」\n".format(len(badmin)) 61 | for x in badmin: 62 | teks += "│ • {}\n".format(x) 63 | if len(teks) >= 4096: 64 | await message.reply(message.chat.id, teks, reply_to_message_id=replyid) 65 | teks = "" 66 | toolong = True 67 | teks += "╘══「 Total {} Admins 」".format(totaladmins) 68 | if toolong: 69 | await message.reply(message.chat.id, teks, reply_to_message_id=replyid) 70 | else: 71 | await message.edit(teks) 72 | 73 | 74 | @Client.on_message( 75 | filters.me & filters.command(["reportadmin", "reportadmins", "report"], ".") 76 | ) 77 | async def report_admin(client: Client, message: Message): 78 | await message.delete() 79 | if len(message.text.split()) >= 2: 80 | text = message.text.split(None, 1)[1] 81 | else: 82 | text = None 83 | grup = await client.get_chat(message.chat.id) 84 | admin = [] 85 | async for a in client.get_chat_members( 86 | message.chat.id, filter=enums.ChatMembersFilter.ADMINISTRATORS 87 | ): 88 | if ( 89 | a.status == enums.ChatMemberStatus.ADMINISTRATOR 90 | or a.status == enums.ChatMemberStatus.OWNER 91 | ): 92 | if not a.user.is_bot: 93 | admin.append(mention_html(a.user.id, "\u200b")) 94 | if message.reply_to_message: 95 | if text: 96 | teks = "{}".format(text) 97 | else: 98 | teks = "{} reported to admins.".format( 99 | mention_html( 100 | message.reply_to_message.from_user.id, 101 | message.reply_to_message.from_user.first_name, 102 | ) 103 | ) 104 | else: 105 | if text: 106 | teks = "{}".format(html.escape(text)) 107 | else: 108 | teks = "Calling admins in {}.".format(grup.title) 109 | teks += "".join(admin) 110 | if message.reply_to_message: 111 | await client.send_message( 112 | message.chat.id, 113 | teks, 114 | reply_to_message_id=message.reply_to_message.id, 115 | parse_mode=enums.ParseMode.HTML, 116 | ) 117 | else: 118 | await client.send_message( 119 | message.chat.id, teks, parse_mode=enums.ParseMode.HTML 120 | ) 121 | 122 | 123 | @Client.on_message(filters.me & filters.command(["everyone", "mentionall"], ".")) 124 | async def tag_all_users(client: Client, message: Message): 125 | await message.delete() 126 | if len(message.text.split()) >= 2: 127 | text = message.text.split(None, 1)[1] 128 | else: 129 | text = "Hi all 🙃" 130 | kek = client.get_chat_members(message.chat.id) 131 | async for a in kek: 132 | if not a.user.is_bot: 133 | text += mention_html(a.user.id, "\u200b") 134 | if message.reply_to_message: 135 | await client.send_message( 136 | message.chat.id, 137 | text, 138 | reply_to_message_id=message.reply_to_message.id, 139 | parse_mode=enums.ParseMode.HTML, 140 | ) 141 | else: 142 | await client.send_message( 143 | message.chat.id, text, parse_mode=enums.ParseMode.HTML 144 | ) 145 | 146 | 147 | @Client.on_message(filters.me & filters.command(["botlist", "bots"], ".")) 148 | async def get_list_bots(client: Client, message: Message): 149 | replyid = None 150 | if len(message.text.split()) >= 2: 151 | chat = message.text.split(None, 1)[1] 152 | grup = await client.get_chat(chat) 153 | else: 154 | chat = message.chat.id 155 | grup = await client.get_chat(chat) 156 | if message.reply_to_message: 157 | replyid = message.reply_to_message.id 158 | getbots = client.get_chat_members(chat) 159 | bots = [] 160 | async for a in getbots: 161 | try: 162 | nama = a.user.first_name + " " + a.user.last_name 163 | except: 164 | nama = a.user.first_name 165 | if nama is None: 166 | nama = "☠️ Deleted account" 167 | if a.user.is_bot: 168 | bots.append(mention_markdown(a.user.id, nama)) 169 | teks = "**All bots in group {}**\n".format(grup.title) 170 | teks += "╒═══「 Bots 」\n" 171 | for x in bots: 172 | teks += "│ • {}\n".format(x) 173 | teks += "╘══「 Total {} Bots 」".format(len(bots)) 174 | if replyid: 175 | await client.send_message(message.chat.id, teks, reply_to_message_id=replyid) 176 | else: 177 | await message.edit(teks) 178 | 179 | 180 | add_command_help( 181 | "tag", 182 | [ 183 | [f".admins", "Get chats Admins list."], 184 | [f".kickdel or .zombies", "To Kick deleted Accounts."], 185 | [ 186 | f".everyone `or` .mentionall", 187 | "to mention Everyone ", 188 | ], 189 | [ 190 | f".botlist", 191 | "To get Chats Bots list", 192 | ], 193 | ], 194 | ) 195 | -------------------------------------------------------------------------------- /Zaid/modules/basic/afk.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from datetime import datetime 3 | 4 | import humanize 5 | from pyrogram import filters, Client 6 | from pyrogram.types import Message 7 | 8 | from Zaid.helper.PyroHelpers import GetChatID, ReplyCheck 9 | from Zaid.modules.help import add_command_help 10 | 11 | AFK = False 12 | AFK_REASON = "" 13 | AFK_TIME = "" 14 | USERS = {} 15 | GROUPS = {} 16 | 17 | 18 | def subtract_time(start, end): 19 | subtracted = humanize.naturaltime(start - end) 20 | return str(subtracted) 21 | 22 | 23 | @Client.on_message( 24 | ((filters.group & filters.mentioned) | filters.private) & ~filters.me & ~filters.service, group=3 25 | ) 26 | async def collect_afk_messages(bot: Client, message: Message): 27 | if AFK: 28 | last_seen = subtract_time(datetime.now(), AFK_TIME) 29 | is_group = True if message.chat.type in ["supergroup", "group"] else False 30 | CHAT_TYPE = GROUPS if is_group else USERS 31 | 32 | if GetChatID(message) not in CHAT_TYPE: 33 | text = ( 34 | f"`Beep boop. This is an automated message.\n" 35 | f"I am not available right now.\n" 36 | f"Last seen: {last_seen}\n" 37 | f"Reason: ```{AFK_REASON.upper()}```\n" 38 | f"See you after I'm done doing whatever I'm doing.`" 39 | ) 40 | await bot.send_message( 41 | chat_id=GetChatID(message), 42 | text=text, 43 | reply_to_message_id=ReplyCheck(message), 44 | ) 45 | CHAT_TYPE[GetChatID(message)] = 1 46 | return 47 | elif GetChatID(message) in CHAT_TYPE: 48 | if CHAT_TYPE[GetChatID(message)] == 50: 49 | text = ( 50 | f"`This is an automated message\n" 51 | f"Last seen: {last_seen}\n" 52 | f"This is the 10th time I've told you I'm AFK right now..\n" 53 | f"I'll get to you when I get to you.\n" 54 | f"No more auto messages for you`" 55 | ) 56 | await bot.send_message( 57 | chat_id=GetChatID(message), 58 | text=text, 59 | reply_to_message_id=ReplyCheck(message), 60 | ) 61 | elif CHAT_TYPE[GetChatID(message)] > 50: 62 | return 63 | elif CHAT_TYPE[GetChatID(message)] % 5 == 0: 64 | text = ( 65 | f"`Hey I'm still not back yet.\n" 66 | f"Last seen: {last_seen}\n" 67 | f"Still busy: ```{AFK_REASON.upper()}```\n" 68 | f"Try pinging a bit later.`" 69 | ) 70 | await bot.send_message( 71 | chat_id=GetChatID(message), 72 | text=text, 73 | reply_to_message_id=ReplyCheck(message), 74 | ) 75 | 76 | CHAT_TYPE[GetChatID(message)] += 1 77 | 78 | 79 | @Client.on_message(filters.command("afk", ".") & filters.me, group=3) 80 | async def afk_set(bot: Client, message: Message): 81 | global AFK_REASON, AFK, AFK_TIME 82 | 83 | cmd = message.command 84 | afk_text = "" 85 | 86 | if len(cmd) > 1: 87 | afk_text = " ".join(cmd[1:]) 88 | 89 | if isinstance(afk_text, str): 90 | AFK_REASON = afk_text 91 | 92 | AFK = True 93 | AFK_TIME = datetime.now() 94 | 95 | await message.delete() 96 | 97 | 98 | @Client.on_message(filters.command("afk", "!") & filters.me, group=3) 99 | async def afk_unset(bot: Client, message: Message): 100 | global AFK, AFK_TIME, AFK_REASON, USERS, GROUPS 101 | 102 | if AFK: 103 | last_seen = subtract_time(datetime.now(), AFK_TIME).replace("ago", "").strip() 104 | await message.edit( 105 | f"`While you were away (for {last_seen}), you received {sum(USERS.values()) + sum(GROUPS.values())} " 106 | f"messages from {len(USERS) + len(GROUPS)} chats`" 107 | ) 108 | AFK = False 109 | AFK_TIME = "" 110 | AFK_REASON = "" 111 | USERS = {} 112 | GROUPS = {} 113 | await asyncio.sleep(5) 114 | 115 | await message.delete() 116 | 117 | if AFK: 118 | @Client.on_message(filters.me, group=3) 119 | async def auto_afk_unset(bot: Client, message: Message): 120 | global AFK, AFK_TIME, AFK_REASON, USERS, GROUPS 121 | 122 | if AFK: 123 | last_seen = subtract_time(datetime.now(), AFK_TIME).replace("ago", "").strip() 124 | reply = await message.reply( 125 | f"`While you were away (for {last_seen}), you received {sum(USERS.values()) + sum(GROUPS.values())} " 126 | f"messages from {len(USERS) + len(GROUPS)} chats`" 127 | ) 128 | AFK = False 129 | AFK_TIME = "" 130 | AFK_REASON = "" 131 | USERS = {} 132 | GROUPS = {} 133 | await asyncio.sleep(5) 134 | await reply.delete() 135 | 136 | 137 | add_command_help( 138 | "afk", 139 | [ 140 | [".afk", "Activates AFK mode with reason as anything after .afk\nUsage: ```.afk ```"], 141 | ["!afk", "Deactivates AFK mode."], 142 | ], 143 | ) 144 | -------------------------------------------------------------------------------- /Zaid/modules/basic/autoscroll.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters, Client 2 | from pyrogram.types import Message 3 | 4 | from Zaid.modules.help import add_command_help 5 | 6 | the_regex = r"^r\/([^\s\/])+" 7 | 8 | f = filters.chat([]) 9 | 10 | if f: 11 | @Client.on_message(f) 12 | async def auto_read(bot: Client, message: Message): 13 | await bot.read_history(message.chat.id) 14 | message.continue_propagation() 15 | 16 | 17 | @Client.on_message(filters.command("autoscroll", ".") & filters.me) 18 | async def add_to_auto_read(bot: Client, message: Message): 19 | if message.chat.id in f: 20 | f.remove(message.chat.id) 21 | await message.edit("Autoscroll deactivated") 22 | else: 23 | f.add(message.chat.id) 24 | await message.edit("Autoscroll activated") 25 | 26 | 27 | add_command_help( 28 | "autoscroll", 29 | [ 30 | [ 31 | ".autoscroll", 32 | "Send .autoscroll in any chat to automatically read all sent messages until you call " 33 | "autoscroll again. This is useful if you have Telegram open on another screen.", 34 | ], 35 | ], 36 | ) 37 | -------------------------------------------------------------------------------- /Zaid/modules/basic/broadcast.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import Client, enums, filters 4 | from pyrogram.types import Message 5 | from requests import get 6 | 7 | 8 | from Zaid import SUDO_USER 9 | 10 | from Zaid.modules.help import add_command_help 11 | from cache.data import GROUP, VERIFIED_USERS 12 | NB = GROUP 13 | DEVS = VERIFIED_USERS 14 | 15 | def get_arg(message: Message): 16 | msg = message.text 17 | msg = msg.replace(" ", "", 1) if msg[1] == " " else msg 18 | split = msg[1:].replace("\n", " \n").split(" ") 19 | if " ".join(split[1:]).strip() == "": 20 | return "" 21 | return " ".join(split[1:]) 22 | 23 | @Client.on_message( 24 | filters.command(["gcast"], ".") & (filters.me | filters.user(SUDO_USER)) 25 | ) 26 | async def gcast_cmd(client: Client, message: Message): 27 | if message.reply_to_message or get_arg(message): 28 | tex = await message.reply_text("`Started global broadcast...`") 29 | else: 30 | return await message.edit_text("**Give A Message or Reply**") 31 | done = 0 32 | error = 0 33 | async for dialog in client.get_dialogs(): 34 | if dialog.chat.type in (enums.ChatType.GROUP, enums.ChatType.SUPERGROUP): 35 | if message.reply_to_message: 36 | msg = message.reply_to_message 37 | elif get_arg: 38 | msg = get_arg(message) 39 | chat = dialog.chat.id 40 | if chat not in NB: 41 | try: 42 | if message.reply_to_message: 43 | await msg.copy(chat) 44 | elif get_arg: 45 | await client.send_message(chat, msg) 46 | done += 1 47 | await asyncio.sleep(0.3) 48 | except Exception: 49 | error += 1 50 | await asyncio.sleep(0.3) 51 | await tex.edit_text( 52 | f"**Successfully Sent Message To** `{done}` **Groups, chat, Failed to Send Message To** `{error}` **Groups**" 53 | ) 54 | 55 | 56 | @Client.on_message( 57 | filters.command(["gucast"], ".") & (filters.me | filters.user(SUDO_USER)) 58 | ) 59 | async def gucast(client: Client, message: Message): 60 | if message.reply_to_message or get_arg(message): 61 | tex = await message.reply_text("`Started global broadcast...`") 62 | else: 63 | return await message.edit_text("**Give A Message or Reply**") 64 | done = 0 65 | error = 0 66 | async for dialog in client.get_dialogs(): 67 | if dialog.chat.type == enums.ChatType.PRIVATE and not dialog.chat.is_verified: 68 | if message.reply_to_message: 69 | msg = message.reply_to_message 70 | elif get_arg: 71 | msg = get_arg(message) 72 | chat = dialog.chat.id 73 | if chat not in DEVS: 74 | try: 75 | if message.reply_to_message: 76 | await msg.copy(chat) 77 | elif get_arg: 78 | await client.send_message(chat, msg) 79 | done += 1 80 | await asyncio.sleep(0.3) 81 | except Exception: 82 | error += 1 83 | await asyncio.sleep(0.3) 84 | await text.edit_text( 85 | f"**Successfully Sent Message To** `{done}` **chat, Failed to Send Message To** `{error}` **chat**" 86 | ) 87 | 88 | 89 | add_command_help( 90 | "broadcast", 91 | [ 92 | [ 93 | "gcast [text/reply]", 94 | "Sending Global Broadcast messages to all groups you are logged into. (Can Send Media/Sticker)", 95 | ], 96 | [ 97 | "gucast [text/reply]", 98 | "Sending Global Broadcast messages to all incoming Private Massages / PCs. (Can Send Media/Sticker)", 99 | ], 100 | ], 101 | ) 102 | -------------------------------------------------------------------------------- /Zaid/modules/basic/carbon.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from io import BytesIO 3 | 4 | from pyrogram import Client, filters 5 | from pyrogram.types import Message 6 | 7 | from Zaid import aiosession 8 | 9 | from Zaid.helper.PyroHelpers import ReplyCheck 10 | 11 | from Zaid.modules.help import add_command_help 12 | 13 | 14 | async def make_carbon(code): 15 | url = "https://carbonara.vercel.app/api/cook" 16 | async with aiosession.post(url, json={"code": code}) as resp: 17 | image = BytesIO(await resp.read()) 18 | image.name = "carbon.png" 19 | return image 20 | 21 | 22 | @Client.on_message(filters.command("carbon", ".") & filters.me) 23 | async def carbon_func(client: Client, message: Message): 24 | text = ( 25 | message.text.split(None, 1)[1] 26 | if len( 27 | message.command, 28 | ) 29 | != 1 30 | else None 31 | ) 32 | if message.reply_to_message: 33 | text = message.reply_to_message.text or message.reply_to_message.caption 34 | if not text: 35 | return await message.delete() 36 | ex = await message.edit_text("`Preparing Carbon . . .`") 37 | carbon = await make_carbon(text) 38 | await ex.edit("`Uploading . . .`") 39 | await asyncio.gather( 40 | ex.delete(), 41 | client.send_photo( 42 | message.chat.id, 43 | carbon, 44 | caption=f"**Carbonised by** {client.me.mention}", 45 | reply_to_message_id=ReplyCheck(message), 46 | ), 47 | ) 48 | carbon.close() 49 | 50 | 51 | add_command_help( 52 | "carbon", 53 | [ 54 | ["carbon ", "Carbonize text with default settings."], 55 | ], 56 | ) 57 | -------------------------------------------------------------------------------- /Zaid/modules/basic/clone.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from pyrogram import * 4 | from pyrogram.types import * 5 | 6 | 7 | from Zaid.helper.basic import edit_or_reply, get_text, get_user 8 | 9 | from Zaid.modules.help import * 10 | 11 | OWNER = os.environ.get("OWNER", None) 12 | BIO = os.environ.get("BIO", "404 : Bio Lost") 13 | 14 | 15 | @Client.on_message(filters.command("clone", ".") & filters.me) 16 | async def clone(client: Client, message: Message): 17 | text = get_text(message) 18 | op = await message.edit_text("`Cloning`") 19 | userk = get_user(message, text)[0] 20 | user_ = await client.get_users(userk) 21 | if not user_: 22 | await op.edit("`Whom i should clone:(`") 23 | return 24 | 25 | get_bio = await client.get_chat(user_.id) 26 | f_name = user_.first_name 27 | c_bio = get_bio.bio 28 | pic = user_.photo.big_file_id 29 | poto = await client.download_media(pic) 30 | 31 | await client.set_profile_photo(photo=poto) 32 | await client.update_profile( 33 | first_name=f_name, 34 | bio=c_bio, 35 | ) 36 | await message.edit(f"**From now I'm** __{f_name}__") 37 | 38 | 39 | @Client.on_message(filters.command("revert", ".") & filters.me) 40 | async def revert(client: Client, message: Message): 41 | await message.edit("`Reverting`") 42 | r_bio = BIO 43 | 44 | # Get ur Name back 45 | await client.update_profile( 46 | first_name=OWNER, 47 | bio=r_bio, 48 | ) 49 | # Delte first photo to get ur identify 50 | photos = [p async for p in client.get_chat_photos("me")] 51 | await client.delete_profile_photos(photos[0].file_id) 52 | await message.edit("`I am back!`") 53 | 54 | 55 | add_command_help( 56 | "clone", 57 | [ 58 | ["clone", "To Clone someone Profile."], 59 | ["revert", "To Get Your Account Back."], 60 | ], 61 | ) 62 | -------------------------------------------------------------------------------- /Zaid/modules/basic/create.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters 2 | from pyrogram.types import Message 3 | 4 | from Zaid.modules.help import add_command_help 5 | 6 | 7 | @Client.on_message(filters.command("create", ".") & filters.me) 8 | async def create(client: Client, message: Message): 9 | if len(message.command) < 3: 10 | return await message.edit_text( 11 | message, f"**Type .help create if you need help**" 12 | ) 13 | group_type = message.command[1] 14 | split = message.command[2:] 15 | group_name = " ".join(split) 16 | xd = await message.edit_text("`Processing...`") 17 | desc = "Welcome To My " + ("Group" if group_type == "gc" else "Channel") 18 | if group_type == "gc": # for supergroup 19 | _id = await client.create_supergroup(group_name, desc) 20 | link = await client.get_chat(_id["id"]) 21 | await xd.edit( 22 | f"**Successfully Created Telegram Group: [{group_name}]({link['invite_link']})**", 23 | disable_web_page_preview=True, 24 | ) 25 | elif group_type == "ch": # for channel 26 | _id = await client.create_channel(group_name, desc) 27 | link = await client.get_chat(_id["id"]) 28 | await xd.edit( 29 | f"**Successfully Created Telegram Channel: [{group_name}]({link['invite_link']})**", 30 | disable_web_page_preview=True, 31 | ) 32 | 33 | 34 | add_command_help( 35 | "create", 36 | [ 37 | ["create ch", "create an channel"], 38 | ["create gc", "create an group"], 39 | ], 40 | ) 41 | -------------------------------------------------------------------------------- /Zaid/modules/basic/define.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import filters, Client 4 | from pyrogram.types import Message 5 | 6 | from Zaid.helper.aiohttp_helper import AioHttp 7 | from Zaid.modules.help import add_command_help 8 | 9 | 10 | @Client.on_message(filters.command(["define", "dict"], ".") & filters.me) 11 | async def define(bot: Client, message: Message): 12 | cmd = message.command 13 | 14 | input_string = "" 15 | if len(cmd) > 1: 16 | input_string = " ".join(cmd[1:]) 17 | elif message.reply_to_message and len(cmd) == 1: 18 | input_string = message.reply_to_message.text 19 | elif not message.reply_to_message and len(cmd) == 1: 20 | await message.edit("`Can't pass to the void.`") 21 | await asyncio.sleep(2) 22 | await message.delete() 23 | return 24 | 25 | def combine(s_word, name): 26 | w_word = f"**__{name.title()}__**\n" 27 | for i in s_word: 28 | if "definition" in i: 29 | if "example" in i: 30 | w_word += ( 31 | "\n**Definition**\n
"
 32 |                             + i["definition"]
 33 |                             + "
\nExample\n
"
 34 |                             + i["example"]
 35 |                             + "
" 36 | ) 37 | else: 38 | w_word += ( 39 | "\n**Definition**\n" + "
" + i["definition"] + "
" 40 | ) 41 | w_word += "\n\n" 42 | return w_word 43 | 44 | def out_print(word1): 45 | out = "" 46 | if "meaning" in list(word1): 47 | meaning = word1["meaning"] 48 | if "noun" in list(meaning): 49 | noun = meaning["noun"] 50 | out += combine(noun, "noun") 51 | if "verb" in list(meaning): 52 | verb = meaning["verb"] 53 | out += combine(verb, "verb") 54 | if "preposition" in list(meaning): 55 | preposition = meaning["preposition"] 56 | out += combine(preposition, "preposition") 57 | if "adverb" in list(meaning): 58 | adverb = meaning["adverb"] 59 | out += combine(adverb, "adverb") 60 | if "adjective" in list(meaning): 61 | adjec = meaning["adjective"] 62 | out += combine(adjec, "adjective") 63 | if "abbreviation" in list(meaning): 64 | abbr = meaning["abbreviation"] 65 | out += combine(abbr, "abbreviation") 66 | if "exclamation" in list(meaning): 67 | exclamation = meaning["exclamation"] 68 | out += combine(exclamation, "exclamation") 69 | if "transitive verb" in list(meaning): 70 | transitive_verb = meaning["transitive verb"] 71 | out += combine(transitive_verb, "transitive verb") 72 | if "determiner" in list(meaning): 73 | determiner = meaning["determiner"] 74 | out += combine(determiner, "determiner") 75 | # print(determiner) 76 | if "crossReference" in list(meaning): 77 | crosref = meaning["crossReference"] 78 | out += combine(crosref, "crossReference") 79 | if "title" in list(word1): 80 | out += ( 81 | "**__Error Note__**\n\n▪️`" 82 | + word1["title"] 83 | + "\n\n▪️" 84 | + word1["message"] 85 | + "\n\n▪️" 86 | + word1["resolution"] 87 | + "`" 88 | ) 89 | return out 90 | 91 | if not input_string: 92 | await message.edit("`Plz enter word to search‼️`") 93 | else: 94 | word = input_string 95 | r_dec = await AioHttp().get_json( 96 | f"https://api.dictionaryapi.dev/api/v1/entries/en/{word}" 97 | ) 98 | 99 | v_word = input_string 100 | if isinstance(r_dec, list): 101 | r_dec = r_dec[0] 102 | v_word = r_dec["word"] 103 | last_output = out_print(r_dec) 104 | if last_output: 105 | await message.edit( 106 | "`Search result for `" + f" {v_word}\n\n" + last_output 107 | ) 108 | else: 109 | await message.edit("`No result found from the database.`") 110 | 111 | 112 | add_command_help( 113 | "dictionary", 114 | [ 115 | [".define | .dict", "Define the word you send or reply to."], 116 | ], 117 | ) 118 | -------------------------------------------------------------------------------- /Zaid/modules/basic/eval_exec.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import io 3 | import os 4 | import sys 5 | import traceback 6 | 7 | from pyrogram import filters, Client 8 | from pyrogram.types import Message 9 | 10 | from Zaid.database import cli as database 11 | from Zaid.helper.PyroHelpers import ReplyCheck 12 | 13 | 14 | @Client.on_message( 15 | filters.command("eval", ".") 16 | & filters.me 17 | & ~filters.forwarded 18 | & ~filters.via_bot 19 | ) 20 | async def eval_func_init(bot, message): 21 | await evaluation_func(bot, message) 22 | 23 | 24 | @Client.on_edited_message( 25 | filters.command("eval", ".") 26 | & filters.me 27 | & ~filters.forwarded 28 | & ~filters.via_bot 29 | ) 30 | async def eval_func_edited(bot, message): 31 | await evaluation_func(bot, message) 32 | 33 | 34 | async def evaluation_func(bot: Client, message: Message): 35 | status_message = await message.reply_text("Processing ...") 36 | cmd = message.text.split(" ", maxsplit=1)[1] 37 | 38 | reply_to_id = message.id 39 | if message.reply_to_message: 40 | reply_to_id = message.reply_to_message.id 41 | 42 | old_stderr = sys.stderr 43 | old_stdout = sys.stdout 44 | redirected_output = sys.stdout = io.StringIO() 45 | redirected_error = sys.stderr = io.StringIO() 46 | stdout, stderr, exc = None, None, None 47 | 48 | try: 49 | reply = message.reply_to_message or None 50 | await aexec(cmd, bot, message, reply, database) 51 | except Exception: 52 | exc = traceback.format_exc() 53 | 54 | stdout = redirected_output.getvalue() 55 | stderr = redirected_error.getvalue() 56 | sys.stdout = old_stdout 57 | sys.stderr = old_stderr 58 | 59 | if exc: 60 | evaluation = exc 61 | elif stderr: 62 | evaluation = stderr 63 | elif stdout: 64 | evaluation = stdout 65 | else: 66 | evaluation = "Success" 67 | 68 | final_output = "Expression:\n{}\n\nResult:\n{} \n".format( 69 | cmd, evaluation.strip() 70 | ) 71 | 72 | if len(final_output) > 4096: 73 | with open("eval.txt", "w", encoding="utf8") as out_file: 74 | out_file.write(str(final_output)) 75 | 76 | await message.reply_document( 77 | "eval.txt", 78 | caption=cmd, 79 | disable_notification=True, 80 | reply_to_message_id=ReplyCheck(message), 81 | ) 82 | os.remove("eval.txt") 83 | await status_message.delete() 84 | else: 85 | await status_message.edit(final_output) 86 | 87 | 88 | async def aexec(code, b, m, r, d): 89 | sys.tracebacklimit = 0 90 | exec( 91 | "async def __aexec(b, m, r, d): " 92 | + "".join(f"\n {line}" for line in code.split("\n")) 93 | ) 94 | return await locals()["__aexec"](b, m, r, d) 95 | 96 | 97 | @Client.on_edited_message( 98 | filters.command("exec", ".") 99 | & filters.me 100 | & ~filters.forwarded 101 | & ~filters.via_bot 102 | ) 103 | async def execution_func_edited(bot, message): 104 | await execution(bot, message) 105 | 106 | 107 | @Client.on_message( 108 | filters.command("exec", ".") 109 | & filters.me 110 | & ~filters.forwarded 111 | & ~filters.via_bot 112 | ) 113 | async def execution_func(bot, message): 114 | await execution(bot, message) 115 | 116 | 117 | async def execution(bot: Client, message: Message): 118 | cmd = message.text.split(" ", maxsplit=1)[1] 119 | 120 | reply_to_id = message.id 121 | if message.reply_to_message: 122 | reply_to_id = message.reply_to_message.id 123 | 124 | process = await asyncio.create_subprocess_shell( 125 | cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE 126 | ) 127 | stdout, stderr = await process.communicate() 128 | e = stderr.decode() 129 | if not e: 130 | e = "No errors" 131 | o = stdout.decode() 132 | if not o: 133 | o = "No output" 134 | 135 | OUTPUT = "" 136 | OUTPUT += f"Command:\n{cmd}\n\n" 137 | OUTPUT += f"Output: \n{o}\n" 138 | OUTPUT += f"Errors: \n{e}" 139 | 140 | if len(OUTPUT) > 4096: 141 | with open("exec.text", "w+", encoding="utf8") as out_file: 142 | out_file.write(str(OUTPUT)) 143 | await message.reply_document( 144 | document="exec.text", 145 | caption=cmd, 146 | disable_notification=True, 147 | reply_to_message_id=ReplyCheck(message), 148 | ) 149 | os.remove("exec.text") 150 | else: 151 | await message.reply_text(OUTPUT) 152 | -------------------------------------------------------------------------------- /Zaid/modules/basic/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 | from pyrogram import filters, Client 10 | from pyrogram.types import Message 11 | from reportlab.graphics import renderPM 12 | from svglib.svglib import svg2rlg 13 | 14 | from Zaid.helper.PyroHelpers import ReplyCheck 15 | from Zaid.helper.aiohttp_helper import AioHttp 16 | from Zaid.modules.help import add_command_help 17 | 18 | 19 | @Client.on_message(filters.command(["ggraph", "commitgraph"], ".") & filters.me) 20 | async def commit_graph(bot: Client, message: Message): 21 | if len(message.command) < 2: 22 | await message.edit( 23 | "Please provide a github profile username to generate the graph!" 24 | ) 25 | await sleep(2) 26 | await message.delete() 27 | return 28 | else: 29 | git_user = message.command[1] 30 | 31 | url = f"https://ghchart.rshah.org/{git_user}" 32 | file_name = f"{randint(1, 999)}{git_user}" 33 | 34 | resp = await AioHttp.get_raw(url) 35 | f = await aiofiles.open(f"{file_name}.svg", mode="wb") 36 | await f.write(resp) 37 | await f.close() 38 | 39 | try: 40 | drawing = svg2rlg(f"{file_name}.svg") 41 | renderPM.drawToFile(drawing, f"{file_name}.png") 42 | except UnboundLocalError: 43 | await message.edit("Username does not exist!") 44 | await sleep(2) 45 | await message.delete() 46 | return 47 | 48 | await asyncio.gather( 49 | bot.send_photo( 50 | chat_id=message.chat.id, 51 | photo=f"{file_name}.png", 52 | caption=git_user, 53 | reply_to_message_id=ReplyCheck(message), 54 | ), 55 | message.delete(), 56 | ) 57 | 58 | for file in iglob(f"{file_name}.*"): 59 | os.remove(file) 60 | 61 | 62 | add_command_help( 63 | "git", 64 | [ 65 | [".ggraph | .commitgraph", "Gets the commit graph for a Github user."], 66 | ], 67 | ) 68 | -------------------------------------------------------------------------------- /Zaid/modules/basic/google.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from bs4 import BeautifulSoup 3 | from googlesearch import search 4 | from pyrogram import Client, filters 5 | from pyrogram.types import Message 6 | 7 | from Zaid.helper.basic import edit_or_reply 8 | 9 | from Zaid.modules.help import * 10 | 11 | 12 | def googlesearch(query): 13 | co = 1 14 | returnquery = {} 15 | for j in search(query, tld="co.in", num=10, stop=10, pause=2): 16 | url = str(j) 17 | response = requests.get(url) 18 | soup = BeautifulSoup(response.text, "html.parser") 19 | metas = soup.find_all("meta") 20 | site_title = None 21 | for title in soup.find_all("title"): 22 | site_title = title.get_text() 23 | metadeta = [ 24 | meta.attrs["content"] 25 | for meta in metas 26 | if "name" in meta.attrs and meta.attrs["name"] == "description" 27 | ] 28 | returnquery[co] = {"title": site_title, "metadata": metadeta, "url": j} 29 | co = co + 1 30 | return returnquery 31 | 32 | 33 | @Client.on_message(filters.command(["gs", "google"], ".") & filters.me) 34 | async def gs(client: Client, message: Message): 35 | Man = await edit_or_reply(message, "`Processing...`") 36 | msg_txt = message.text 37 | returnmsg = "" 38 | query = None 39 | if " " in msg_txt: 40 | query = msg_txt[msg_txt.index(" ") + 1 : len(msg_txt)] 41 | else: 42 | await Man.edit("Give a query to search") 43 | return 44 | results = googlesearch(query) 45 | for i in range(1, 10, 1): 46 | presentquery = results[i] 47 | presenttitle = presentquery["title"] 48 | presentmeta = presentquery["metadata"] 49 | presenturl = presentquery["url"] 50 | print(presentquery) 51 | print(presenttitle) 52 | print(presentmeta) 53 | print(presenturl) 54 | if not presentmeta: 55 | presentmeta = "" 56 | else: 57 | presentmeta = presentmeta[0] 58 | returnmsg = ( 59 | returnmsg 60 | + f"[{str(presenttitle)}]({str(presenturl)})\n{str(presentmeta)}\n\n" 61 | ) 62 | await Man.edit(returnmsg) 63 | 64 | 65 | add_command_help( 66 | "google", 67 | [ 68 | [ 69 | "google", 70 | "Featch Details on Google.", 71 | ], 72 | ], 73 | ) 74 | -------------------------------------------------------------------------------- /Zaid/modules/basic/hentai_api.py: -------------------------------------------------------------------------------- 1 | from aiohttp.client_exceptions import ClientError 2 | from pyrogram import filters, Client 3 | from pyrogram.types import Message 4 | 5 | 6 | from Zaid.helper.aiohttp_helper import AioHttp 7 | from Zaid.modules.help import add_command_help 8 | 9 | cf_api_data = { 10 | "anime": { 11 | "url": "https://api.computerfreaker.cf/v1/anime", 12 | "help": "It works on my machine!", 13 | }, 14 | "hentai": { 15 | "url": "https://api.computerfreaker.cf/v1/hentai", 16 | "help": "Sends a nice compliment.", 17 | }, 18 | "yuri": { 19 | "url": "https://api.computerfreaker.cf/v1/yuri", 20 | "help": "Affirmative messages", 21 | }, 22 | "dva": { 23 | "url": "https://api.computerfreaker.cf/v1/dva", 24 | "help": "Affirmative messages", 25 | }, 26 | "trap": { 27 | "url": "https://api.computerfreaker.cf/v1/trap", 28 | "help": "Affirmative messages", 29 | }, 30 | "hug": { 31 | "url": "https://api.computerfreaker.cf/v1/hug", 32 | "help": "Give it a guess dumbass!", 33 | }, 34 | "neko": { 35 | "url": "https://api.computerfreaker.cf/v1/neko", 36 | "format": "Kanye once said:\n`{}`", 37 | "help": "Kanye used to say", 38 | }, 39 | "nsfwneko": { 40 | "url": "https://api.computerfreaker.cf/v1/nsfwneko", 41 | "help": "Programmers be like.", 42 | }, 43 | "baguette": { 44 | "url": "https://api.computerfreaker.cf/v1/baguette", 45 | "help": "Affirmative messages", 46 | }, 47 | } 48 | 49 | text_api_commands = [] 50 | for x in cf_api_data: 51 | text_api_commands.append(x) 52 | if "alts" in cf_api_data[x]: 53 | for y in cf_api_data[x]["alts"]: 54 | text_api_commands.append(y) 55 | 56 | 57 | @Client.on_message( 58 | filters.command(text_api_commands, ".") & filters.me 59 | ) 60 | async def hentai_api(bot: Client, message: Message): 61 | cmd = message.command 62 | api_key = cmd[0] 63 | api = cf_api_data[api_key] 64 | 65 | try: 66 | data = await AioHttp().get_json(api["url"]) 67 | content_url: str = data['url'] 68 | await bot.send_photo(message.chat.id, content_url) 69 | except ClientError as e: 70 | print(e) 71 | 72 | await message.delete() 73 | 74 | 75 | 76 | for x in cf_api_data: 77 | add_command_help( 78 | "anime_cf", 79 | [ 80 | [f".{x}", cf_api_data[x]["help"]], 81 | ], 82 | ) 83 | -------------------------------------------------------------------------------- /Zaid/modules/basic/invite.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from pyrogram import Client, filters 3 | from pyrogram.enums import ChatType, UserStatus 4 | from pyrogram.types import Message 5 | from Zaid import SUDO_USER 6 | from pyrogram.errors.exceptions.flood_420 import FloodWait 7 | 8 | from Zaid.modules.help import add_command_help 9 | 10 | 11 | @Client.on_message( 12 | filters.command(["invite"], ".") & (filters.me | filters.user(SUDO_USER)) 13 | ) 14 | async def inviteee(client: Client, message: Message): 15 | mg = await message.reply_text("`Adding Users!`") 16 | user_s_to_add = message.text.split(" ", 1)[1] 17 | if not user_s_to_add: 18 | await mg.edit("`Give Me Users To Add! Check Help Menu For More Info!`") 19 | return 20 | user_list = user_s_to_add.split(" ") 21 | try: 22 | await client.add_chat_members(message.chat.id, user_list, forward_limit=100) 23 | except BaseException as e: 24 | await mg.edit(f"`Unable To Add Users! \nTraceBack : {e}`") 25 | return 26 | await mg.edit(f"`Sucessfully Added {len(user_list)} To This Group / Channel!`") 27 | 28 | @Client.on_message( 29 | filters.command(["inviteall"], ".") & (filters.me | filters.user(SUDO_USER)) 30 | ) 31 | async def inv(client: Client, message: Message): 32 | ex = await message.reply_text("`Processing . . .`") 33 | text = message.text.split(" ", 1) 34 | queryy = text[1] 35 | chat = await client.get_chat(queryy) 36 | tgchat = message.chat 37 | await ex.edit_text(f"inviting users from {chat.username}") 38 | async for member in client.get_chat_members(chat.id): 39 | user = member.user 40 | zxb = [ 41 | UserStatus.ONLINE, 42 | UserStatus.OFFLINE, 43 | UserStatus.RECENTLY, 44 | UserStatus.LAST_WEEK, 45 | ] 46 | if user.status in zxb: 47 | try: 48 | await client.add_chat_members(tgchat.id, user.id) 49 | except FloodWait as e: 50 | return 51 | except Exception as e: 52 | pass 53 | 54 | @Client.on_message(filters.command("invitelink", ".") & filters.me) 55 | async def invite_link(client: Client, message: Message): 56 | um = await message.edit_text("`Processing...`") 57 | if message.chat.type in [ChatType.GROUP, ChatType.SUPERGROUP]: 58 | message.chat.title 59 | try: 60 | link = await client.export_chat_invite_link(message.chat.id) 61 | await um.edit(f"**Link Invite:** {link}") 62 | except Exception: 63 | await um.edit("Denied permission") 64 | 65 | 66 | add_command_help( 67 | "invite", 68 | [ 69 | [ 70 | "invitelink", 71 | "Get your private invite link. [Need Admin]", 72 | ], 73 | ["invite @username", "to invite someone."], 74 | ["inviteall @username", "Mass adding (can affect your account)."], 75 | ], 76 | ) 77 | -------------------------------------------------------------------------------- /Zaid/modules/basic/joinleave.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, enums, filters 2 | from pyrogram.types import Message 3 | 4 | from Zaid import SUDO_USER 5 | from Zaid.modules.help import add_command_help 6 | 7 | @Client.on_message( 8 | filters.command(["join"], ".") & (filters.me | filters.user(SUDO_USER)) 9 | ) 10 | async def join(client: Client, message: Message): 11 | tex = message.command[1] if len(message.command) > 1 else message.chat.id 12 | g = await message.reply_text("`Processing...`") 13 | try: 14 | await client.join_chat(tex) 15 | await g.edit(f"**Successfully Joined Chat ID** `{tex}`") 16 | except Exception as ex: 17 | await g.edit(f"**ERROR:** \n\n{str(ex)}") 18 | 19 | 20 | @Client.on_message( 21 | filters.command(["leave"], ".") & (filters.me | filters.user(SUDO_USER)) 22 | ) 23 | async def leave(client: Client, message: Message): 24 | xd = message.command[1] if len(message.command) > 1 else message.chat.id 25 | xv = await message.reply_text("`Processing...`") 26 | try: 27 | await xv.edit_text(f"{client.me.first_name} has left this group, bye!!") 28 | await client.leave_chat(xd) 29 | except Exception as ex: 30 | await xv.edit_text(f"**ERROR:** \n\n{str(ex)}") 31 | 32 | 33 | @Client.on_message( 34 | filters.command(["leaveallgc"], ".") & (filters.me | filters.user(SUDO_USER)) 35 | ) 36 | async def kickmeall(client: Client, message: Message): 37 | tex = await message.reply_text("`Global Leave from group chats...`") 38 | er = 0 39 | done = 0 40 | async for dialog in client.get_dialogs(): 41 | if dialog.chat.type in (enums.ChatType.GROUP, enums.ChatType.SUPERGROUP): 42 | chat = dialog.chat.id 43 | try: 44 | done += 1 45 | await client.leave_chat(chat) 46 | except BaseException: 47 | er += 1 48 | await tex.edit( 49 | f"**Successfully left {done} Groups, Failed to left {er} Groups**" 50 | ) 51 | 52 | 53 | @Client.on_message(filters.command(["leaveallch"], ".") & filters.me) 54 | async def kickmeallch(client: Client, message: Message): 55 | ok = await message.reply_text("`Global Leave from group chats...`") 56 | er = 0 57 | done = 0 58 | async for dialog in client.get_dialogs(): 59 | if dialog.chat.type in (enums.ChatType.CHANNEL): 60 | chat = dialog.chat.id 61 | try: 62 | done += 1 63 | await client.leave_chat(chat) 64 | except BaseException: 65 | er += 1 66 | await ok.edit( 67 | f"**Successfully left {done} Channel, failed to left {er} Channel**" 68 | ) 69 | 70 | 71 | add_command_help( 72 | "joinleave", 73 | [ 74 | [ 75 | "kickme", 76 | "To leave!!.", 77 | ], 78 | ["leaveallgc", "to leave all groups where you joined."], 79 | ["leaveallch", "to leaveall channel where you joined."], 80 | ["join [Username]", "give an specific username to join."], 81 | ["leave [Username]", "give an specific username to leave."], 82 | ], 83 | ) 84 | -------------------------------------------------------------------------------- /Zaid/modules/basic/locks.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters 2 | from pyrogram.errors.exceptions.bad_request_400 import ( 3 | ChatAdminRequired, 4 | ChatNotModified, 5 | ) 6 | from pyrogram.types import ChatPermissions, Message 7 | 8 | from Zaid.modules.help import add_command_help 9 | 10 | incorrect_parameters = f"Parameter Wrong, Type `.help locks`" 11 | data = { 12 | "msg": "can_send_messages", 13 | "stickers": "can_send_other_messages", 14 | "gifs": "can_send_other_messages", 15 | "media": "can_send_media_messages", 16 | "games": "can_send_other_messages", 17 | "inline": "can_send_other_messages", 18 | "url": "can_add_web_page_previews", 19 | "polls": "can_send_polls", 20 | "info": "can_change_info", 21 | "invite": "can_invite_users", 22 | "pin": "can_pin_messages", 23 | } 24 | 25 | 26 | async def current_chat_permissions(client: Client, chat_id): 27 | perms = [] 28 | perm = (await client.get_chat(chat_id)).permissions 29 | if perm.can_send_messages: 30 | perms.append("can_send_messages") 31 | if perm.can_send_media_messages: 32 | perms.append("can_send_media_messages") 33 | if perm.can_send_other_messages: 34 | perms.append("can_send_other_messages") 35 | if perm.can_add_web_page_previews: 36 | perms.append("can_add_web_page_previews") 37 | if perm.can_send_polls: 38 | perms.append("can_send_polls") 39 | if perm.can_change_info: 40 | perms.append("can_change_info") 41 | if perm.can_invite_users: 42 | perms.append("can_invite_users") 43 | if perm.can_pin_messages: 44 | perms.append("can_pin_messages") 45 | return perms 46 | 47 | 48 | async def tg_lock( 49 | client: Client, 50 | message: Message, 51 | parameter, 52 | permissions: list, 53 | perm: str, 54 | lock: bool, 55 | ): 56 | if lock: 57 | if perm not in permissions: 58 | return await message.edit_text(f"🔒 `{parameter}` **is already locked!**") 59 | permissions.remove(perm) 60 | else: 61 | if perm in permissions: 62 | return await message.edit_text(f"🔓 `{parameter}` **is already Unlocked!**") 63 | permissions.append(perm) 64 | permissions = {perm: True for perm in list(set(permissions))} 65 | try: 66 | await client.set_chat_permissions( 67 | message.chat.id, ChatPermissions(**permissions) 68 | ) 69 | except ChatNotModified: 70 | return await message.edit_text( 71 | f"To unlock this, you have to `{prefix}unlock msg` first." 72 | ) 73 | except ChatAdminRequired: 74 | return await message.edit_text("`I don't have permission to do that.`") 75 | await message.edit_text( 76 | ( 77 | f"🔒 **Locked for non-admin!**\n **Type:** `{parameter}`\n **Chat:** {message.chat.title}" 78 | if lock 79 | else f"🔒 **Unlocked for non-admin!**\n **Type:** `{parameter}`\n **Chat:** {message.chat.title}" 80 | ) 81 | ) 82 | 83 | 84 | @Client.on_message(filters.command(["lock", "unlock"], ".") & filters.me) 85 | async def locks_func(client: Client, message: Message): 86 | if len(message.command) != 2: 87 | return await message.edit_text(incorrect_parameters) 88 | chat_id = message.chat.id 89 | parameter = message.text.strip().split(None, 1)[1].lower() 90 | state = message.command[0].lower() 91 | if parameter not in data and parameter != "all": 92 | return await message.edit_text(incorrect_parameters) 93 | permissions = await current_chat_permissions(client, chat_id) 94 | if parameter in data: 95 | await tg_lock( 96 | client, 97 | message, 98 | parameter, 99 | permissions, 100 | data[parameter], 101 | bool(state == "lock"), 102 | ) 103 | elif parameter == "all" and state == "lock": 104 | try: 105 | await client.set_chat_permissions(chat_id, ChatPermissions()) 106 | await message.edit_text( 107 | f"🔒 **Locked for non-admin!**\n **Type:** `{parameter}`\n **Chat:** {message.chat.title}" 108 | ) 109 | except ChatAdminRequired: 110 | return await message.edit_text("`I don't have permission to do that.`") 111 | except ChatNotModified: 112 | return await message.edit_text( 113 | f"🔒 **Already locked!**\n **Type:** `{parameter}`\n **Chat:** {message.chat.title}" 114 | ) 115 | elif parameter == "all" and state == "unlock": 116 | try: 117 | await client.set_chat_permissions( 118 | chat_id, 119 | ChatPermissions( 120 | can_send_messages=True, 121 | can_send_media_messages=True, 122 | can_send_other_messages=True, 123 | can_add_web_page_previews=True, 124 | can_send_polls=True, 125 | can_change_info=False, 126 | can_invite_users=True, 127 | can_pin_messages=False, 128 | ), 129 | ) 130 | except ChatAdminRequired: 131 | return await message.edit_text("`I don't have permission to do that.`") 132 | await message.edit( 133 | f"🔒 **Unlocked for non-admin!**\n **Type:** `{parameter}`\n **Chat:** {message.chat.title}" 134 | ) 135 | 136 | 137 | @Client.on_message(filters.command("locks", ".") & filters.me) 138 | async def locktypes(client: Client, message: Message): 139 | permissions = await current_chat_permissions(client, message.chat.id) 140 | 141 | if not permissions: 142 | return await message.edit("🔒 **Everything is locked!**") 143 | 144 | perms = "" 145 | for i in permissions: 146 | perms += f" • __**{i}**__\n" 147 | 148 | await message.edit_text(perms) 149 | 150 | 151 | add_command_help( 152 | "locks", 153 | [ 154 | ["lock [all or specific]", "restrict user to send."], 155 | [ 156 | "unlock [all or specific]", 157 | "Unrestrict\n\nSupported Locks / Unlocks:` `msg` | `media` | `stickers` | `polls` | `info` | `invite` | `webprev` |`pin` | `all`.", 158 | ], 159 | ], 160 | ) 161 | -------------------------------------------------------------------------------- /Zaid/modules/basic/lyrics.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import filters, Client 4 | from pyrogram.types import Message 5 | 6 | from Zaid import SUDO_USER 7 | from Zaid.modules.help import add_command_help 8 | 9 | 10 | @Client.on_message( 11 | filters.command(["l", "lyrics"], ".") & (filters.me | filters.user(SUDO_USER)) 12 | ) 13 | async def send_lyrics(bot: Client, 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 bot.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 bot.send_inline_bot_result( 37 | chat_id="me", 38 | query_id=lyrics_results.query_id, 39 | result_id=lyrics_results.results[0].id, 40 | ) 41 | await asyncio.sleep(3) 42 | 43 | # forward from Saved Messages 44 | await bot.copy_message( 45 | chat_id=message.chat.id, 46 | from_chat_id="me", 47 | message_id=saved.updates[1].message.id, 48 | ) 49 | 50 | # delete the message from Saved Messages 51 | await bot.delete_messages("me", saved.updates[1].message.id) 52 | except TimeoutError: 53 | await message.edit("That didn't work out") 54 | await asyncio.sleep(2) 55 | await message.delete() 56 | except Exception as e: 57 | await message.edit("`Failed to find lyrics`") 58 | await asyncio.sleep(2) 59 | await message.delete() 60 | 61 | 62 | add_command_help("lyrics", [[".l `or` .lyrics", "Search lyrics and send."]]) 63 | -------------------------------------------------------------------------------- /Zaid/modules/basic/mention.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from functools import partial 3 | 4 | from pyrogram import filters, Client 5 | from pyrogram.types import Message 6 | 7 | 8 | from Zaid.modules.help import add_command_help 9 | 10 | mention = partial("{}".format) 11 | 12 | hmention = partial("\u200B{}".format) 13 | 14 | 15 | @Client.on_message(filters.command("mention", ".") & filters.me) 16 | async def mention_user(bot: Client, 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 bot.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 | @Client.on_message(filters.command("hmention", ".") & filters.me) 35 | async def hidden_mention(bot: Client, 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 bot.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 | 54 | add_command_help( 55 | "mention", 56 | [ 57 | [ 58 | ".mention", 59 | "Mention a user with a different name\nExample: `.mention @user CTO`", 60 | ], 61 | [ 62 | ".hmention", 63 | "Mention a user with a hidden text\nExample: `.hmention @user`", 64 | ], 65 | ], 66 | ) 67 | -------------------------------------------------------------------------------- /Zaid/modules/basic/metrics.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | from pyrogram import filters, Client 4 | from pyrogram.types import Message 5 | 6 | from Zaid.modules.help import add_command_help 7 | 8 | 9 | class Custom(dict): 10 | def __missing__(self, key): 11 | return 0 12 | 13 | 14 | @Client.on_message(filters.command("wordcount", ".") & filters.me) 15 | async def word_count(bot: Client, message: Message): 16 | await message.delete() 17 | words = Custom() 18 | progress = await bot.send_message(message.chat.id, "`Processed 0 messages...`") 19 | total = 0 20 | async for msg in bot.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 | add_command_help( 40 | "metrics", 41 | [ 42 | [ 43 | ".wordcount", 44 | "Finds the 25 most used words in the last 1000 messages in a group or private chat. Use in " 45 | "chat you want to find the metric in.", 46 | ], 47 | ], 48 | ) 49 | -------------------------------------------------------------------------------- /Zaid/modules/basic/misc.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from datetime import datetime 3 | from platform import python_version 4 | 5 | from pyrogram import __version__, filters, Client 6 | from pyrogram.types import Message 7 | from config import ALIVE_PIC, ALIVE_TEXT 8 | from Zaid import START_TIME 9 | from Zaid import SUDO_USER 10 | from Zaid.helper.PyroHelpers import ReplyCheck 11 | from Zaid.modules.help import add_command_help 12 | from Zaid.modules.bot.inline import get_readable_time 13 | 14 | alive_logo = ALIVE_PIC or "https://telegra.ph/file/cc0890d0876bc18c19e05.jpg" 15 | 16 | if ALIVE_TEXT: 17 | txt = ALIVE_TEXT 18 | else: 19 | txt = ( 20 | f"** ✘ zαι∂ υѕєявσт ✘**\n\n" 21 | f"❏ **νєяѕισи**: `2.1`\n" 22 | f"├• **υρтιмє**: `{str(datetime.now() - START_TIME).split('.')[0]}`\n" 23 | f"├• **ρутнσи**: `{python_version()}`\n" 24 | f"├• **ρуяσgяαм**: `{__version__}`\n" 25 | f"├• **ѕυρρσят**: [Click](t.me/TheSupportChat)\n" 26 | f"├• **¢нαииєℓ**: [Click](t.me/TheUpdatesChannel)\n" 27 | f"└• **яєρσ**: [Click](https://GitHub.com/itz-zaid/Zaid-Userbot)" 28 | ) 29 | 30 | @Client.on_message( 31 | filters.command(["alive", "awake"], ".") & (filters.me | filters.user(SUDO_USER)) 32 | ) 33 | async def alive(client: Client, message: Message): 34 | xx = await message.reply_text("⚡️") 35 | try: 36 | await message.delete() 37 | except: 38 | pass 39 | send = client.send_video if alive_logo.endswith(".mp4") else client.send_photo 40 | xd = (f"{txt}") 41 | try: 42 | await asyncio.gather( 43 | xx.delete(), 44 | send( 45 | message.chat.id, 46 | alive_logo, 47 | caption=xd, 48 | reply_to_message_id=ReplyCheck(message), 49 | ), 50 | ) 51 | except BaseException: 52 | await xx.edit(xd, disable_web_page_preview=True) 53 | 54 | @Client.on_message(filters.command("repo", ".") & filters.me) 55 | async def repo(bot: Client, message: Message): 56 | await message.edit("⚡") 57 | await asyncio.sleep(1) 58 | await message.edit("Fetching Source Code.....") 59 | await asyncio.sleep(1) 60 | await message.edit("Here is repo: \n\n\nhttps://github.com/itz-zaid/Zaid-UserBot\nFork & Give an ⭐") 61 | 62 | 63 | @Client.on_message(filters.command("creator", ".") & filters.me) 64 | async def creator(bot: Client, message: Message): 65 | await message.edit("https://gitHub.com/itz-zaid") 66 | 67 | 68 | @Client.on_message(filters.command(["uptime", "up"], ".") & filters.me) 69 | async def uptime(bot: Client, message: Message): 70 | now = datetime.now() 71 | current_uptime = now - START_TIME 72 | await message.edit(f"Uptime ⚡\n" f"```{str(current_uptime).split('.')[0]}```") 73 | 74 | 75 | @Client.on_message(filters.command("id", ".") & filters.me) 76 | async def get_id(bot: Client, message: Message): 77 | file_id = None 78 | user_id = None 79 | 80 | if message.reply_to_message: 81 | rep = message.reply_to_message 82 | 83 | if rep.audio: 84 | file_id = f"**File ID**: `{rep.audio.file_id}`" 85 | file_id += "**File Type**: `audio`" 86 | 87 | elif rep.document: 88 | file_id = f"**File ID**: `{rep.document.file_id}`" 89 | file_id += f"**File Type**: `{rep.document.mime_type}`" 90 | 91 | elif rep.photo: 92 | file_id = f"**File ID**: `{rep.photo.file_id}`" 93 | file_id += "**File Type**: `photo`" 94 | 95 | elif rep.sticker: 96 | file_id = f"**Sicker ID**: `{rep.sticker.file_id}`\n" 97 | if rep.sticker.set_name and rep.sticker.emoji: 98 | file_id += f"**Sticker Set**: `{rep.sticker.set_name}`\n" 99 | file_id += f"**Sticker Emoji**: `{rep.sticker.emoji}`\n" 100 | if rep.sticker.is_animated: 101 | file_id += f"**Animated Sticker**: `{rep.sticker.is_animated}`\n" 102 | else: 103 | file_id += "**Animated Sticker**: `False`\n" 104 | else: 105 | file_id += "**Sticker Set**: __None__\n" 106 | file_id += "**Sticker Emoji**: __None__" 107 | 108 | elif rep.video: 109 | file_id = f"**File ID**: `{rep.video.file_id}`\n" 110 | file_id += "**File Type**: `video`" 111 | 112 | elif rep.animation: 113 | file_id = f"**File ID**: `{rep.animation.file_id}`\n" 114 | file_id += "**File Type**: `GIF`" 115 | 116 | elif rep.voice: 117 | file_id = f"**File ID**: `{rep.voice.file_id}`\n" 118 | file_id += "**File Type**: `Voice Note`" 119 | 120 | elif rep.video_note: 121 | file_id = f"**File ID**: `{rep.animation.file_id}`\n" 122 | file_id += "**File Type**: `Video Note`" 123 | 124 | elif rep.location: 125 | file_id = "**Location**:\n" 126 | file_id += f"**longitude**: `{rep.location.longitude}`\n" 127 | file_id += f"**latitude**: `{rep.location.latitude}`" 128 | 129 | elif rep.venue: 130 | file_id = "**Location**:\n" 131 | file_id += f"**longitude**: `{rep.venue.location.longitude}`\n" 132 | file_id += f"**latitude**: `{rep.venue.location.latitude}`\n\n" 133 | file_id += "**Address**:\n" 134 | file_id += f"**title**: `{rep.venue.title}`\n" 135 | file_id += f"**detailed**: `{rep.venue.address}`\n\n" 136 | 137 | elif rep.from_user: 138 | user_id = rep.from_user.id 139 | 140 | if user_id: 141 | if rep.forward_from: 142 | user_detail = ( 143 | f"**Forwarded User ID**: `{message.reply_to_message.forward_from.id}`\n" 144 | ) 145 | else: 146 | user_detail = f"**User ID**: `{message.reply_to_message.from_user.id}`\n" 147 | user_detail += f"**Message ID**: `{message.reply_to_message.id}`" 148 | await message.edit(user_detail) 149 | elif file_id: 150 | if rep.forward_from: 151 | user_detail = ( 152 | f"**Forwarded User ID**: `{message.reply_to_message.forward_from.id}`\n" 153 | ) 154 | else: 155 | user_detail = f"**User ID**: `{message.reply_to_message.from_user.id}`\n" 156 | user_detail += f"**Message ID**: `{message.reply_to_message.id}`\n\n" 157 | user_detail += file_id 158 | await message.edit(user_detail) 159 | 160 | else: 161 | await message.edit(f"**Chat ID**: `{message.chat.id}`") 162 | 163 | 164 | 165 | 166 | add_command_help( 167 | "start", 168 | [ 169 | [".alive", "Check if the bot is alive or not."], 170 | [".repo", "Display the repo of this userbot."], 171 | [".creator", "Show the creator of this userbot."], 172 | [".id", "Send id of what you replied to."], 173 | [".up `or` .uptime", "Check bot's current uptime."], 174 | ], 175 | ) 176 | 177 | add_command_help( 178 | "restart", 179 | [ 180 | [".restart", "You are retarded if you do not know what this does."], 181 | ], 182 | ) 183 | -------------------------------------------------------------------------------- /Zaid/modules/basic/music.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import filters, Client 4 | from pyrogram.types import Message 5 | 6 | from Zaid import SUDO_USER 7 | from Zaid.helper.PyroHelpers import ReplyCheck 8 | from Zaid.modules.help import add_command_help 9 | 10 | 11 | @Client.on_message( 12 | filters.command(["m", "music"], ".") & (filters.me | filters.user(SUDO_USER)) 13 | ) 14 | async def send_music(bot: Client, message: Message): 15 | try: 16 | cmd = message.command 17 | 18 | song_name = "" 19 | if len(cmd) > 1: 20 | song_name = " ".join(cmd[1:]) 21 | elif message.reply_to_message and len(cmd) == 1: 22 | song_name = ( 23 | message.reply_to_message.text or message.reply_to_message.caption 24 | ) 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 | song_results = await bot.get_inline_bot_results("deezermusicbot", song_name) 32 | 33 | try: 34 | # send to Saved Messages because hide_via doesn't work sometimes 35 | saved = await bot.send_inline_bot_result( 36 | chat_id="me", 37 | query_id=song_results.query_id, 38 | result_id=song_results.results[0].id, 39 | ) 40 | 41 | # forward as a new message from Saved Messages 42 | saved = await bot.get_messages("me", int(saved.updates[1].message.id)) 43 | reply_to = ( 44 | message.reply_to_message.id 45 | if message.reply_to_message 46 | else None 47 | ) 48 | await bot.send_audio( 49 | chat_id=message.chat.id, 50 | audio=str(saved.audio.file_id), 51 | reply_to_message_id=ReplyCheck(message), 52 | ) 53 | 54 | # delete the message from Saved Messages 55 | await bot.delete_messages("me", saved.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 | add_command_help("music", [[".m `or` .music", "Search songs and send."]]) 68 | -------------------------------------------------------------------------------- /Zaid/modules/basic/nekobin.py: -------------------------------------------------------------------------------- 1 | from Zaid.modules.help import add_command_help 2 | import asyncio 3 | import requests 4 | import aiohttp 5 | from pyrogram import filters, Client 6 | from pyrogram.types import Message 7 | 8 | import os 9 | import re 10 | 11 | from pyrogram.types import Message 12 | from httpx import AsyncClient 13 | from Zaid.helper.utility import get_arg 14 | 15 | 16 | # Pastebins 17 | class PasteBins: 18 | def __init__(self) -> None: 19 | # API Urls 20 | self.nekobin_api = "https://nekobin.com/api/documents" 21 | self.spacebin_api = "https://spaceb.in/api/v1/documents" 22 | self.hastebin_api = "https://www.toptal.com/developers/hastebin/documents" 23 | # Paste Urls 24 | self.nekobin = "https://nekobin.com" 25 | self.spacebin = "https://spaceb.in" 26 | self.hastebin = "https://www.toptal.com/developers/hastebin" 27 | 28 | async def paste_text(self, paste_bin, text): 29 | if paste_bin == "spacebin": 30 | return await self.paste_to_spacebin(text) 31 | elif paste_bin == "hastebin": 32 | return await self.paste_to_hastebin(text) 33 | elif paste_bin == "nekobin": 34 | return await self.paste_to_nekobin(text) 35 | else: 36 | return "`Invalid pastebin service selected!`" 37 | 38 | async def __check_status(self, resp_status, status_code: int = 201): 39 | if int(resp_status) != status_code: 40 | return "real shit" 41 | else: 42 | return "ok" 43 | 44 | async def paste_to_nekobin(self, text): 45 | async with AsyncClient() as nekoc: 46 | resp = await nekoc.post(self.nekobin_api, json={"content": str(text)}) 47 | chck = await self.__check_status(resp.status_code) 48 | if not chck == "ok": 49 | return None 50 | else: 51 | jsned = resp.json() 52 | return f"{self.nekobin}/{jsned['result']['key']}" 53 | 54 | async def paste_to_spacebin(self, text): 55 | async with AsyncClient() as spacbc: 56 | resp = await spacbc.post(self.spacebin_api, data={"content": str(text), "extension": "md"}) 57 | chck = await self.__check_status(resp.status_code) 58 | if not chck == "ok": 59 | return None 60 | else: 61 | jsned = resp.json() 62 | return f"{self.spacebin}/{jsned['payload']['id']}" 63 | 64 | async def paste_to_hastebin(self, text): 65 | async with AsyncClient() as spacbc: 66 | resp = await spacbc.post(self.hastebin_api, data=str(text)) 67 | chck = await self.__check_status(resp.status_code, 200) 68 | if not chck == "ok": 69 | return None 70 | else: 71 | jsned = resp.json() 72 | return f"{self.hastebin}/{jsned['key']}" 73 | 74 | 75 | async def get_pastebin_service(text: str): 76 | if re.search(r'\bhastebin\b', text): 77 | pastebin = "hastebin" 78 | elif re.search(r'\bspacebin\b', text): 79 | pastebin = "spacebin" 80 | elif re.search(r'\bnekobin\b', text): 81 | pastebin = "nekobin" 82 | else: 83 | pastebin = "spacebin" 84 | return pastebin 85 | 86 | @Client.on_message(filters.command(["paste", "nekobin", "hastebin", "spacebin"], ["."]) & filters.me) 87 | async def paste_dis_text(_, message: Message): 88 | pstbin_serv = await get_pastebin_service(message.text.split(" ")[0]) 89 | paste_msg = await message.edit(f"`Pasting to {pstbin_serv.capitalize()}...`") 90 | replied_msg = message.reply_to_message 91 | tex_t = get_arg(message) 92 | message_s = tex_t 93 | if not tex_t: 94 | if not replied_msg: 95 | return await paste_msg.edit("`Reply To File or Send This Command With Text!`") 96 | if not replied_msg.text: 97 | file = await replied_msg.download() 98 | m_list = open(file, "r").read() 99 | message_s = m_list 100 | os.remove(file) 101 | elif replied_msg.text: 102 | message_s = replied_msg.text 103 | paste_cls = PasteBins() 104 | pasted = await paste_cls.paste_text(pstbin_serv, message_s) 105 | if not pasted: 106 | return await paste_msg.edit("`Oops, Pasting failed! Please try changing the pastebin service!`") 107 | await paste_msg.edit(f"**Pasted to {pstbin_serv.capitalize()}!** \n\n**Url:** {pasted}", disable_web_page_preview=True) 108 | 109 | add_command_help( 110 | "paste", 111 | [ 112 | [ 113 | ".paste `or` .nekobin `or` .hastebin `or` .spacebin", 114 | "To Paste Text to Hastebin / Nekobin or Spacebin \n\nCreate a Nekobin paste using replied to message.", 115 | ], 116 | ], 117 | ) 118 | -------------------------------------------------------------------------------- /Zaid/modules/basic/pats.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | import aiohttp 4 | from pyrogram import filters, Client 5 | from pyrogram.types import Message 6 | 7 | 8 | from Zaid.helper.PyroHelpers import GetChatID, ReplyCheck 9 | from Zaid.modules.help import add_command_help 10 | 11 | 12 | @Client.on_message(filters.command(["pat", "pats"], ".") & filters.me) 13 | async def give_pats(bot: Client, message: Message): 14 | URL = "https://some-random-api.ml/animu/pat" 15 | async with aiohttp.ClientSession() as session: 16 | async with session.get(URL) as request: 17 | if request.status == 404: 18 | return await message.edit("`no Pats for you :c") 19 | result = await request.json() 20 | url = result.get("link", None) 21 | await asyncio.gather( 22 | message.delete(), 23 | bot.send_video( 24 | GetChatID(message), url, reply_to_message_id=ReplyCheck(message) 25 | ), 26 | ) 27 | 28 | 29 | add_command_help( 30 | "pats", 31 | [ 32 | [".pat | .pats", "Give pats."], 33 | ], 34 | ) 35 | -------------------------------------------------------------------------------- /Zaid/modules/basic/ping.py: -------------------------------------------------------------------------------- 1 | import time 2 | from datetime import datetime 3 | 4 | import speedtest 5 | from pyrogram import Client, filters 6 | from pyrogram.raw import functions 7 | from pyrogram.types import Message 8 | 9 | from Zaid import StartTime, app, SUDO_USER 10 | from Zaid.helper.PyroHelpers import SpeedConvert 11 | from Zaid.modules.bot.inline import get_readable_time 12 | 13 | from Zaid.modules.help import add_command_help 14 | 15 | class WWW: 16 | SpeedTest = ( 17 | "Speedtest started at `{start}`\n\n" 18 | "Ping:\n{ping} ms\n\n" 19 | "Download:\n{download}\n\n" 20 | "Upload:\n{upload}\n\n" 21 | "ISP:\n__{isp}__" 22 | ) 23 | 24 | NearestDC = "Country: `{}`\n" "Nearest Datacenter: `{}`\n" "This Datacenter: `{}`" 25 | 26 | @Client.on_message( 27 | filters.command(["speedtest"], ".") & (filters.me | filters.user(SUDO_USER)) 28 | ) 29 | async def speed_test(client: Client, message: Message): 30 | new_msg = await message.reply_text("`Running speed test . . .`") 31 | try: 32 | await message.delete() 33 | except: 34 | pass 35 | spd = speedtest.Speedtest() 36 | 37 | new_msg = await new_msg.edit( 38 | f"`{new_msg.text}`\n" "`Getting best server based on ping . . .`" 39 | ) 40 | spd.get_best_server() 41 | 42 | new_msg = await new_msg.edit(f"`{new_msg.text}`\n" "`Testing download speed . . .`") 43 | spd.download() 44 | 45 | new_msg = await new_msg.edit(f"`{new_msg.text}`\n" "`Testing upload speed . . .`") 46 | spd.upload() 47 | 48 | new_msg = await new_msg.edit( 49 | f"`{new_msg.text}`\n" "`Getting results and preparing formatting . . .`" 50 | ) 51 | results = spd.results.dict() 52 | 53 | await new_msg.edit( 54 | WWW.SpeedTest.format( 55 | start=results["timestamp"], 56 | ping=results["ping"], 57 | download=SpeedConvert(results["download"]), 58 | upload=SpeedConvert(results["upload"]), 59 | isp=results["client"]["isp"], 60 | ) 61 | ) 62 | 63 | 64 | 65 | @Client.on_message( 66 | filters.command(["ping"], ".") & (filters.me | filters.user(SUDO_USER)) 67 | ) 68 | async def pingme(client: Client, message: Message): 69 | uptime = await get_readable_time((time.time() - StartTime)) 70 | start = datetime.now() 71 | xx = await message.reply_text("**0% ▒▒▒▒▒▒▒▒▒▒**") 72 | try: 73 | await message.delete() 74 | except: 75 | pass 76 | await xx.edit("**20% ██▒▒▒▒▒▒▒▒**") 77 | await xx.edit("**40% ████▒▒▒▒▒▒**") 78 | await xx.edit("**60% ██████▒▒▒▒**") 79 | await xx.edit("**80% ████████▒▒**") 80 | await xx.edit("**100% ██████████**") 81 | end = datetime.now() 82 | duration = (end - start).microseconds / 1000 83 | await xx.edit( 84 | f"❏ **╰☞ 𝗣𝗢𝗡𝗚™╮**\n" 85 | f"├• **╰☞** - `%sms`\n" 86 | f"├• **╰☞ -** `{uptime}` \n" 87 | f"└• **╰☞:** {client.me.mention}" % (duration) 88 | ) 89 | 90 | 91 | add_command_help( 92 | "ping", 93 | [ 94 | ["ping", "Check bot alive or not."], 95 | ], 96 | ) 97 | -------------------------------------------------------------------------------- /Zaid/modules/basic/profile.py: -------------------------------------------------------------------------------- 1 | import os 2 | from asyncio import sleep 3 | import os 4 | import sys 5 | from re import sub 6 | from time import time 7 | 8 | 9 | from pyrogram import Client, filters, enums 10 | from pyrogram.types import Message 11 | 12 | from Zaid import SUDO_USER 13 | from Zaid.helper.PyroHelpers import ReplyCheck 14 | 15 | from Zaid.modules.help import add_command_help 16 | 17 | flood = {} 18 | profile_photo = "cache/pfp.jpg" 19 | 20 | 21 | async def extract_userid(message, text: str): 22 | def is_int(text: str): 23 | try: 24 | int(text) 25 | except ValueError: 26 | return False 27 | return True 28 | 29 | text = text.strip() 30 | 31 | if is_int(text): 32 | return int(text) 33 | 34 | entities = message.entities 35 | app = message._client 36 | if len(entities) < 2: 37 | return (await app.get_users(text)).id 38 | entity = entities[1] 39 | if entity.type == "mention": 40 | return (await app.get_users(text)).id 41 | if entity.type == "text_mention": 42 | return entity.user.id 43 | return None 44 | 45 | 46 | async def extract_user_and_reason(message, sender_chat=False): 47 | args = message.text.strip().split() 48 | text = message.text 49 | user = None 50 | reason = None 51 | if message.reply_to_message: 52 | reply = message.reply_to_message 53 | if not reply.from_user: 54 | if ( 55 | reply.sender_chat 56 | and reply.sender_chat != message.chat.id 57 | and sender_chat 58 | ): 59 | id_ = reply.sender_chat.id 60 | else: 61 | return None, None 62 | else: 63 | id_ = reply.from_user.id 64 | 65 | if len(args) < 2: 66 | reason = None 67 | else: 68 | reason = text.split(None, 1)[1] 69 | return id_, reason 70 | 71 | if len(args) == 2: 72 | user = text.split(None, 1)[1] 73 | return await extract_userid(message, user), None 74 | 75 | if len(args) > 2: 76 | user, reason = text.split(None, 2)[1:] 77 | return await extract_userid(message, user), reason 78 | 79 | return user, reason 80 | 81 | 82 | async def extract_user(message): 83 | return (await extract_user_and_reason(message))[0] 84 | 85 | @Client.on_message( 86 | filters.command(["unblock"], ".") & (filters.me | filters.user(SUDO_USER)) 87 | ) 88 | async def unblock_user_func(client: Client, message: Message): 89 | user_id = await extract_user(message) 90 | tex = await message.reply_text("`Processing . . .`") 91 | if not user_id: 92 | return await message.edit( 93 | "Provide User ID/Username or reply to user message to unblock." 94 | ) 95 | if user_id == client.me.id: 96 | return await tex.edit("Ohk done ✅.") 97 | await client.unblock_user(user_id) 98 | umention = (await client.get_users(user_id)).mention 99 | await message.edit(f"**Successfully Unblocked** {umention}") 100 | 101 | @Client.on_message( 102 | filters.command(["block"], ".") & (filters.me | filters.user(SUDO_USER)) 103 | ) 104 | async def block_user_func(client: Client, message: Message): 105 | user_id = await extract_user(message) 106 | tex = await message.reply_text("`Processing . . .`") 107 | if not user_id: 108 | return await tex.edit_text( 109 | "Provide User ID/Username or reply to user message to block." 110 | ) 111 | if user_id == client.me.id: 112 | return await tex.edit_text("ohk ✅.") 113 | await client.block_user(user_id) 114 | umention = (await client.get_users(user_id)).mention 115 | await tex.edit_text(f"**Successfully blocked** {umention}") 116 | 117 | 118 | @Client.on_message( 119 | filters.command(["setname"], ".") & (filters.me | filters.user(SUDO_USER)) 120 | ) 121 | async def setname(client: Client, message: Message): 122 | tex = await message.reply_text("`Processing . . .`") 123 | if len(message.command) == 1: 124 | return await tex.edit( 125 | "Provide a text to set as your name." 126 | ) 127 | elif len(message.command) > 1: 128 | name = message.text.split(None, 1)[1] 129 | try: 130 | await client.update_profile(first_name=name) 131 | await tex.edit(f"**Successfully Changed Your Name To** `{name}`") 132 | except Exception as e: 133 | await tex.edit(f"**ERROR:** `{e}`") 134 | else: 135 | return await tex.edit( 136 | "Provide a text to set as your name." 137 | ) 138 | 139 | @Client.on_message( 140 | filters.command(["setbio"], ".") & (filters.me | filters.user(SUDO_USER)) 141 | ) 142 | async def set_bio(client: Client, message: Message): 143 | tex = await message.edit_text("`Processing . . .`") 144 | if len(message.command) == 1: 145 | return await tex.edit("Provide text to set as bio.") 146 | elif len(message.command) > 1: 147 | bio = message.text.split(None, 1)[1] 148 | try: 149 | await client.update_profile(bio=bio) 150 | await tex.edit(f"**Successfully Change your BIO to** `{bio}`") 151 | except Exception as e: 152 | await tex.edit(f"**ERROR:** `{e}`") 153 | else: 154 | return await tex.edit("Provide text to set as bio.") 155 | 156 | 157 | @Client.on_message( 158 | filters.command(["setpfp"], ".") & (filters.me | filters.user(SUDO_USER)) 159 | ) 160 | async def set_pfp(client: Client, message: Message): 161 | replied = message.reply_to_message 162 | if ( 163 | replied 164 | and replied.media 165 | and ( 166 | replied.photo 167 | or (replied.document and "image" in replied.document.mime_type) 168 | ) 169 | ): 170 | await client.download_media(message=replied, file_name=profile_photo) 171 | await client.set_profile_photo(profile_photo) 172 | if os.path.exists(profile_photo): 173 | os.remove(profile_photo) 174 | await message.reply_text("**Your Profile Photo Changed Successfully.**") 175 | else: 176 | await message.reply_text( 177 | "Reply to any photo to set as profile photo" 178 | ) 179 | await sleep(3) 180 | await message.delete() 181 | 182 | 183 | @Client.on_message( 184 | filters.command(["vpfp"], ".") & (filters.me | filters.user(SUDO_USER)) 185 | ) 186 | async def view_pfp(client: Client, message: Message): 187 | user_id = await extract_user(message) 188 | if user_id: 189 | user = await client.get_users(user_id) 190 | else: 191 | user = await client.get_me() 192 | if not user.photo: 193 | await message.reply_text("Profile photo not found!") 194 | return 195 | await client.download_media(user.photo.big_file_id, file_name=profile_photo) 196 | await client.send_photo( 197 | message.chat.id, profile_photo, reply_to_message_id=ReplyCheck(message) 198 | ) 199 | await message.delete() 200 | if os.path.exists(profile_photo): 201 | os.remove(profile_photo) 202 | 203 | 204 | add_command_help( 205 | "profile", 206 | [ 207 | ["block", "to block someone on telegram"], 208 | ["unblock", "to unblock someone on telegram"], 209 | ["setname", "set your profile name."], 210 | ["setbio", "set an bio."], 211 | [ 212 | "setpfp", 213 | f"reply with image to set your profile pic.", 214 | ], 215 | ["vpfp", "Reply with video to set your video profile."], 216 | ], 217 | ) 218 | -------------------------------------------------------------------------------- /Zaid/modules/basic/purge.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import Client, filters 4 | from pyrogram.types import Message 5 | 6 | from Zaid.modules.help import add_command_help 7 | 8 | 9 | @Client.on_message(filters.command("del", ".") & filters.me) 10 | async def del_msg(client: Client, message: Message): 11 | msg_src = message.reply_to_message 12 | if msg_src: 13 | if msg_src.from_user.id: 14 | try: 15 | await client.delete_messages(message.chat.id, msg_src.id) 16 | await message.delete() 17 | except BaseException: 18 | pass 19 | else: 20 | await message.delete() 21 | 22 | 23 | 24 | @Client.on_message(filters.command("purge", ".") & filters.me) 25 | async def purge(client: Client, message: Message): 26 | ex = await message.edit_text("`Starting To Purge Messages!`") 27 | msg = message.reply_to_message 28 | if msg: 29 | itermsg = list(range(msg.id, message.id)) 30 | else: 31 | await ex.edit("`Reply To Message To Purge!`") 32 | return 33 | count = 0 34 | 35 | for i in itermsg: 36 | try: 37 | count = count + 1 38 | await client.delete_messages( 39 | chat_id=message.chat.id, message_ids=i, revoke=True 40 | ) 41 | except FloodWait as e: 42 | await asyncio.sleep(e.x) 43 | except Exception as e: 44 | await ex.edit(f"**ERROR:** `{e}`") 45 | return 46 | 47 | done = await ex.edit( 48 | f"**Fast Purge Completed!**\n**Successfully Delete** `{str(count)}` **Message.**" 49 | ) 50 | await asyncio.sleep(2) 51 | await done.delete() 52 | 53 | 54 | 55 | @Client.on_message(filters.command("purgeme", ".") & filters.me) 56 | async def purgeme(client: Client, message: Message): 57 | if len(message.command) != 2: 58 | return await message.delete() 59 | n = message.text.split(None, 1)[1].strip() 60 | if not n.isnumeric(): 61 | return await message.edit_text("Please enter a number") 62 | n = int(n) 63 | if n < 1: 64 | return await message.edit_text("Enter the number of messages you want to delete!") 65 | chat_id = message.chat.id 66 | message_ids = [ 67 | m.id 68 | async for m in client.search_messages( 69 | chat_id, 70 | from_user="me", 71 | limit=n, 72 | ) 73 | ] 74 | if not message_ids: 75 | return await message.edit_text("Could not find message.") 76 | to_delete = [message_ids[i : i + 99] for i in range(0, len(message_ids), 99)] 77 | for hundred_messages_or_less in to_delete: 78 | await client.delete_messages( 79 | chat_id=chat_id, 80 | message_ids=hundred_messages_or_less, 81 | revoke=True, 82 | ) 83 | await message.delete() 84 | 85 | 86 | add_command_help( 87 | "purge", 88 | [ 89 | ["del", "to delete someone's message."], 90 | ["purge", "reply to all messages from your replied."], 91 | ["purgeme [count]", "to delete your messages only."], 92 | ], 93 | ) 94 | -------------------------------------------------------------------------------- /Zaid/modules/basic/quote.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import Client, filters 4 | from pyrogram.types import Message 5 | 6 | from Zaid.helper.utility import get_arg 7 | 8 | from Zaid.modules.help import add_command_help 9 | 10 | 11 | @Client.on_message(filters.me & filters.command(["q", "quotly"], ".")) 12 | async def quotly(client: Client, message: Message): 13 | args = get_arg(message) 14 | if not message.reply_to_message and not args: 15 | return await message.edit("**Please Reply to Message**") 16 | bot = "QuotLyBot" 17 | if message.reply_to_message: 18 | await message.edit("`Making a Quote . . .`") 19 | await client.unblock_user(bot) 20 | if args: 21 | await client.send_message(bot, f"/qcolor {args}") 22 | await asyncio.sleep(1) 23 | else: 24 | pass 25 | await message.reply_to_message.forward(bot) 26 | await asyncio.sleep(5) 27 | async for quotly in client.search_messages(bot, limit=1): 28 | if quotly: 29 | await message.delete() 30 | await message.reply_sticker( 31 | sticker=quotly.sticker.file_id, 32 | reply_to_message_id=message.reply_to_message.id 33 | if message.reply_to_message 34 | else None, 35 | ) 36 | else: 37 | return await message.edit("**Failed to Create Quotly Sticker**") 38 | 39 | 40 | add_command_help( 41 | "quotly", 42 | [ 43 | [ 44 | f"q or .quotly", 45 | "To make an quote.", 46 | ], 47 | [ 48 | f"q or .quotly ", 49 | "Make a message into a sticker with the custom background color given.", 50 | ], 51 | ], 52 | ) 53 | -------------------------------------------------------------------------------- /Zaid/modules/basic/sangmata.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import * 4 | from pyrogram import filters 5 | from pyrogram.errors import YouBlockedUser 6 | from pyrogram.types import * 7 | 8 | 9 | from Zaid.modules.help import add_command_help 10 | from Zaid.modules.basic.profile import extract_user 11 | 12 | @Client.on_message(filters.command(["sg", "sa", "sangmata"], ".") & filters.me) 13 | async def sg(client: Client, message: Message): 14 | args = await extract_user(message) 15 | lol = await message.edit_text("`Processing...`") 16 | if args: 17 | try: 18 | user = await client.get_users(args) 19 | except Exception: 20 | return await lol.edit(f"`Please specify a valid user!`") 21 | bot = "SangMataInfo_bot" 22 | try: 23 | await client.send_message(bot, f"/search_id {user.id}") 24 | except YouBlockedUser: 25 | await client.unblock_user(bot) 26 | await client.send_message(bot, f"/search_id {user.id}") 27 | await asyncio.sleep(1) 28 | 29 | async for stalk in client.search_messages(bot, query="Name", limit=1): 30 | if not stalk: 31 | await message.edit_text("**Orang Ini Belum Pernah Mengganti Namanya**") 32 | return 33 | elif stalk: 34 | await message.edit(stalk.text) 35 | await stalk.delete() 36 | 37 | async for stalk in client.search_messages(bot, query="Username", limit=1): 38 | if not stalk: 39 | return 40 | elif stalk: 41 | await message.reply(stalk.text) 42 | await stalk.delete() 43 | 44 | 45 | add_command_help( 46 | "sangmata", 47 | [ 48 | [ 49 | "sg [reply/userid/username]", 50 | "Its help uh to find someone name history.", 51 | ], 52 | ], 53 | ) 54 | -------------------------------------------------------------------------------- /Zaid/modules/basic/screenshot.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import filters, Client 4 | from pyrogram.raw import functions 5 | from pyrogram.types import Message 6 | 7 | 8 | from Zaid.modules.help import add_command_help 9 | 10 | 11 | @Client.on_message( 12 | filters.command(["screenshot", "ss"], ".") & filters.private & filters.me 13 | ) 14 | async def screenshot(bot: Client, message: Message): 15 | await asyncio.gather( 16 | message.delete(), 17 | bot.send( 18 | functions.messages.SendScreenshotNotification( 19 | peer=await bot.resolve_peer(message.chat.id), 20 | reply_to_msg_id=0, 21 | random_id=bot.rnd_id(), 22 | ) 23 | ), 24 | ) 25 | 26 | 27 | add_command_help( 28 | "screenshot", 29 | [ 30 | [ 31 | ".screenshot", 32 | "Send a notification in a private chat (not secret) to annoy or troll your friends.", 33 | ], 34 | ], 35 | ) 36 | -------------------------------------------------------------------------------- /Zaid/modules/basic/stats.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | 3 | from pyrogram import Client, enums, filters 4 | from pyrogram.types import Message 5 | from Zaid.modules.help import * 6 | 7 | 8 | @Client.on_message(filters.command(["stats", "status"], ".") & filters.me) 9 | async def stats(client: Client, message: Message): 10 | Man = await message.edit_text("`Collecting stats...`") 11 | start = datetime.now() 12 | u = 0 13 | g = 0 14 | sg = 0 15 | c = 0 16 | b = 0 17 | a_chat = 0 18 | Meh = await client.get_me() 19 | async for dialog in client.get_dialogs(): 20 | if dialog.chat.type == enums.ChatType.PRIVATE: 21 | u += 1 22 | elif dialog.chat.type == enums.ChatType.BOT: 23 | b += 1 24 | elif dialog.chat.type == enums.ChatType.GROUP: 25 | g += 1 26 | elif dialog.chat.type == enums.ChatType.SUPERGROUP: 27 | sg += 1 28 | user_s = await dialog.chat.get_member(int(Meh.id)) 29 | if user_s.status in ( 30 | enums.ChatMemberStatus.OWNER, 31 | enums.ChatMemberStatus.ADMINISTRATOR, 32 | ): 33 | a_chat += 1 34 | elif dialog.chat.type == enums.ChatType.CHANNEL: 35 | c += 1 36 | 37 | end = datetime.now() 38 | ms = (end - start).seconds 39 | await Man.edit_text( 40 | """`Your Stats Obtained in {} seconds` 41 | `You have {} Private Messages.` 42 | `You are in {} Groups.` 43 | `You are in {} Super Groups.` 44 | `You Are in {} Channels.` 45 | `You Are Admin in {} Chats.` 46 | `Bots = {}`""".format( 47 | ms, u, g, sg, c, a_chat, b 48 | ) 49 | ) 50 | 51 | 52 | add_command_help( 53 | "stats", 54 | [ 55 | ["stats", "to check your account status."], 56 | ], 57 | ) 58 | -------------------------------------------------------------------------------- /Zaid/modules/basic/tagalert.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, enums, filters 2 | from pyrogram.types import Message 3 | from config import LOG_GROUP 4 | from Zaid.modules.help import add_command_help 5 | log = [] 6 | 7 | 8 | @Client.on_message(filters.command("tagalert on", ".") & filters.me) 9 | async def set_no_log_p_m(client: Client, message: Message): 10 | if LOG_GROUP != -100: 11 | if not message.chat.id in log: 12 | log.append(message.chat.id) 13 | await message.edit("**Tag alert Activated Successfully**") 14 | 15 | @Client.on_message(filters.command("tagalert off", ".") & filters.me) 16 | async def set_no_log_p_m(client: Client, message: Message): 17 | if not message.chat.id in log: 18 | log.remove(message.chat.id) 19 | await message.edit("**Tag alert DeActivated Successfully**") 20 | 21 | if log: 22 | @Client.on_message(filters.group & filters.mentioned & filters.incoming) 23 | async def log_tagged_messages(client: Client, message: Message): 24 | result = f"📨 #TAGS #MESSAGE\n • : {message.from_user.mention}" 25 | result += f"\n • Group : {message.chat.title}" 26 | result += f"\n • 👀 Lihat Pesan" 27 | result += f"\n • Message : {message.text}" 28 | await asyncio.sleep(0.5) 29 | await client.send_message( 30 | LOG_GROUP, 31 | result, 32 | parse_mode=enums.ParseMode.HTML, 33 | disable_web_page_preview=True, 34 | ) 35 | 36 | 37 | add_command_help( 38 | "tagalert", 39 | [ 40 | [ 41 | "tagalert on/off", 42 | "To activate or deactivate the group tag, which will go to the log group.", 43 | ], 44 | ], 45 | ) 46 | -------------------------------------------------------------------------------- /Zaid/modules/basic/tagall.py: -------------------------------------------------------------------------------- 1 | from asyncio import sleep 2 | 3 | from pyrogram import Client, filters 4 | from pyrogram.types import Message 5 | 6 | 7 | from Zaid.modules.help import add_command_help 8 | 9 | spam_chats = [] 10 | 11 | 12 | def get_arg(message: Message): 13 | msg = message.text 14 | msg = msg.replace(" ", "", 1) if msg[1] == " " else msg 15 | split = msg[1:].replace("\n", " \n").split(" ") 16 | if " ".join(split[1:]).strip() == "": 17 | return "" 18 | return " ".join(split[1:]) 19 | 20 | @Client.on_message(filters.command("tagall", ".") & filters.me) 21 | async def mentionall(client: Client, message: Message): 22 | chat_id = message.chat.id 23 | direp = message.reply_to_message 24 | args = get_arg(message) 25 | if not direp and not args: 26 | return await message.edit("**Send me a message or reply to a message!**") 27 | await message.delete() 28 | spam_chats.append(chat_id) 29 | usrnum = 0 30 | usrtxt = "" 31 | async for usr in client.get_chat_members(chat_id): 32 | if not chat_id in spam_chats: 33 | break 34 | usrnum += 1 35 | usrtxt += f"[{usr.user.first_name}](tg://user?id={usr.user.id}), " 36 | if usrnum == 5: 37 | if args: 38 | txt = f"{args}\n\n{usrtxt}" 39 | await client.send_message(chat_id, txt) 40 | elif direp: 41 | await direp.reply(usrtxt) 42 | await sleep(2) 43 | usrnum = 0 44 | usrtxt = "" 45 | try: 46 | spam_chats.remove(chat_id) 47 | except: 48 | pass 49 | 50 | 51 | @Client.on_message(filters.command("cancel", ".") & filters.me) 52 | async def cancel_spam(client: Client, message: Message): 53 | if not message.chat.id in spam_chats: 54 | return await message.edit("**It seems there is no tagall here.**") 55 | else: 56 | try: 57 | spam_chats.remove(message.chat.id) 58 | except: 59 | pass 60 | return await message.edit("**Cancelled.**") 61 | 62 | 63 | add_command_help( 64 | "tagall", 65 | [ 66 | [ 67 | "tagall [text/reply ke chat]", 68 | "Tag all the members one by one", 69 | ], 70 | [ 71 | "cancel", 72 | f"to stop .tagall", 73 | ], 74 | ], 75 | ) 76 | -------------------------------------------------------------------------------- /Zaid/modules/basic/telegraph.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters 2 | from pyrogram.types import Message 3 | from telegraph import Telegraph, exceptions, upload_file 4 | import os 5 | 6 | 7 | from Zaid.modules.help import * 8 | 9 | telegraph = Telegraph() 10 | r = telegraph.create_account(short_name="telegram") 11 | auth_url = r["auth_url"] 12 | 13 | 14 | 15 | def get_text(message: Message) -> [None, str]: 16 | """Extract Text From Commands""" 17 | text_to_return = message.text 18 | if message.text is None: 19 | return None 20 | if " " in text_to_return: 21 | try: 22 | return message.text.split(None, 1)[1] 23 | except IndexError: 24 | return None 25 | else: 26 | return None 27 | 28 | @Client.on_message(filters.command(["tg", "telegraph", "tm", "tgt"], ".") & filters.me) 29 | async def uptotelegraph(client: Client, message: Message): 30 | tex = await message.edit_text("`Processing . . .`") 31 | if not message.reply_to_message: 32 | await tex.edit( 33 | "**Reply to an Image or text.**" 34 | ) 35 | return 36 | if message.reply_to_message.media: 37 | if message.reply_to_message.sticker: 38 | m_d = await convert_to_image(message, client) 39 | else: 40 | m_d = await message.reply_to_message.download() 41 | try: 42 | media_url = upload_file(m_d) 43 | except exceptions.TelegraphException as exc: 44 | await tex.edit(f"**ERROR:** `{exc}`") 45 | os.remove(m_d) 46 | return 47 | U_done = ( 48 | f"**Uploaded on ** [Telegraph](https://telegra.ph/{media_url[0]})" 49 | ) 50 | await tex.edit(U_done) 51 | os.remove(m_d) 52 | elif message.reply_to_message.text: 53 | page_title = get_text(message) if get_text(message) else client.me.first_name 54 | page_text = message.reply_to_message.text 55 | page_text = page_text.replace("\n", "
") 56 | try: 57 | response = telegraph.create_page(page_title, html_content=page_text) 58 | except exceptions.TelegraphException as exc: 59 | await tex.edit(f"**ERROR:** `{exc}`") 60 | return 61 | wow_graph = f"**Uploaded as** [Telegraph](https://telegra.ph/{response['path']})" 62 | await tex.edit(wow_graph) 63 | 64 | 65 | add_command_help( 66 | "telegraph", 67 | [ 68 | [ 69 | f"telegraph `or` .tg", 70 | "To upload on telegraph.", 71 | ], 72 | ], 73 | ) 74 | -------------------------------------------------------------------------------- /Zaid/modules/basic/translate.py: -------------------------------------------------------------------------------- 1 | from Zaid.modules.help import * 2 | import os 3 | from pyrogram import filters, Client 4 | from pyrogram.types import Message 5 | from py_trans import Async_PyTranslator 6 | from Zaid.helper.utility import get_arg 7 | 8 | 9 | 10 | @Client.on_message(filters.command(["tr", "translate"], ["."]) & filters.me) 11 | async def pytrans_tr(_, message: Message): 12 | tr_msg = await message.edit("`Processing...`") 13 | r_msg = message.reply_to_message 14 | args = get_arg(message) 15 | if r_msg: 16 | if r_msg.text: 17 | to_tr = r_msg.text 18 | else: 19 | return await tr_msg.edit("`Reply to a message that contains text!`") 20 | # Checks if dest lang is defined by the user 21 | if not args: 22 | return await tr_msg.edit(f"`Please define a destination language!` \n\n**Ex:** `{Config.CMD_PREFIX}ptr si Hey, I'm using telegram!`") 23 | # Setting translation if provided 24 | else: 25 | sp_args = args.split(" ") 26 | if len(sp_args) == 2: 27 | dest_lang = sp_args[0] 28 | tr_engine = sp_args[1] 29 | else: 30 | dest_lang = sp_args[0] 31 | tr_engine = "google" 32 | elif args: 33 | # Splitting provided arguments in to a list 34 | a_conts = args.split(None, 2) 35 | # Checks if translation engine is defined by the user 36 | if len(a_conts) == 3: 37 | dest_lang = a_conts[0] 38 | tr_engine = a_conts[1] 39 | to_tr = a_conts[2] 40 | else: 41 | dest_lang = a_conts[0] 42 | to_tr = a_conts[1] 43 | tr_engine = "google" 44 | # Translate the text 45 | py_trans = Async_PyTranslator(provider=tr_engine) 46 | translation = await py_trans.translate(to_tr, dest_lang) 47 | # Parse the translation message 48 | if translation["status"] == "success": 49 | tred_txt = f""" 50 | **Translation Engine**: `{translation["engine"]}` 51 | **Translated to:** `{translation["dest_lang"]}` 52 | **Translation:** 53 | `{translation["translation"]}` 54 | """ 55 | if len(tred_txt) > 4096: 56 | await tr_msg.edit("`Wah!! Translated Text So Long Tho!, Give me a minute, I'm sending it as a file!`") 57 | tr_txt_file = open("translated.txt", "w+") 58 | tr_txt_file.write(tred_txt) 59 | tr_txt_file.close() 60 | await tr_msg.reply_document("ptranslated_NEXAUB.txt") 61 | os.remove("ptranslated.txt") 62 | await tr_msg.delete() 63 | else: 64 | await tr_msg.edit(tred_txt) 65 | 66 | add_command_help( 67 | "translate", 68 | [ 69 | [".tr", "Translate some text by give a text or reply that text/caption."], 70 | ], 71 | ) 72 | -------------------------------------------------------------------------------- /Zaid/modules/basic/ud.py: -------------------------------------------------------------------------------- 1 | from asyncio import sleep 2 | 3 | from pyrogram import filters, Client 4 | 5 | 6 | from Zaid.helper.aiohttp_helper import AioHttp 7 | from Zaid.modules.help import add_command_help 8 | 9 | 10 | def replace_text(text): 11 | return text.replace('"', "").replace("\\r", "").replace("\\n", "").replace("\\", "") 12 | 13 | 14 | @Client.on_message(filters.me & filters.command(["ud"], ".")) 15 | async def urban_dictionary(bot, message): 16 | if len(message.text.split()) == 1: 17 | await message.edit("Usage: `ud example`") 18 | return 19 | try: 20 | text = message.text.split(None, 1)[1] 21 | response = await AioHttp().get_json( 22 | f"http://api.urbandictionary.com/v0/define?term={text}" 23 | ) 24 | word = response["list"][0]["word"] 25 | definition = response["list"][0]["definition"] 26 | example = response["list"][0]["example"] 27 | resp = ( 28 | f"**Text: {replace_text(word)}**\n" 29 | f"**Meaning:**\n`{replace_text(definition)}`\n\n" 30 | f"**Example:**\n`{replace_text(example)}` " 31 | ) 32 | await message.edit(resp) 33 | return 34 | except Exception as e: 35 | await message.edit("`The Urban Dictionary API could not be reached`") 36 | print(e) 37 | await sleep(3) 38 | await message.delete() 39 | 40 | 41 | 42 | add_command_help( 43 | "dictionary", 44 | [ 45 | [".ubran | .ud", "Define the word you send or reply to."], 46 | ], 47 | ) 48 | -------------------------------------------------------------------------------- /Zaid/modules/basic/unsplash.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pyrogram import filters, Client 4 | from pyrogram.types import Message 5 | 6 | 7 | from Zaid.helper.aiohttp_helper import AioHttp 8 | from Zaid.modules.help import add_command_help 9 | 10 | 11 | @Client.on_message(filters.command(["unsplash", "pic"], ".") & filters.me) 12 | async def unsplash_pictures(bot: Client, message: Message): 13 | cmd = message.command 14 | 15 | if len(cmd) > 1 and isinstance(cmd[1], str): 16 | keyword = cmd[1] 17 | 18 | if len(cmd) > 2 and int(cmd[2]) < 10: 19 | await message.edit("```Getting Pictures```") 20 | count = int(cmd[2]) 21 | images = [] 22 | while len(images) is not count: 23 | img = await AioHttp().get_url( 24 | f"https://source.unsplash.com/1600x900/?{keyword}" 25 | ) 26 | if img not in images: 27 | images.append(img) 28 | 29 | for img in images: 30 | await bot.send_photo(message.chat.id, str(img)) 31 | 32 | await message.delete() 33 | return 34 | else: 35 | await message.edit("```Getting Picture```") 36 | img = await AioHttp().get_url( 37 | f"https://source.unsplash.com/1600x900/?{keyword}" 38 | ) 39 | await asyncio.gather( 40 | message.delete(), 41 | bot.send_photo(message.chat.id, str(img)) 42 | ) 43 | 44 | 45 | 46 | add_command_help( 47 | "unsplash", 48 | [ 49 | [".unsplash __or__ .pic", "Send random pic of keyword first argument."], 50 | ], 51 | ) 52 | -------------------------------------------------------------------------------- /Zaid/modules/basic/upload_files.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | import humanize 4 | from pyrogram import filters, Client 5 | from pyrogram.types import Message 6 | 7 | from Zaid.modules.help import add_command_help 8 | 9 | 10 | async def progress_callback(current, total, bot: Client, message: Message): 11 | if int((current / total) * 100) % 25 == 0: 12 | await message.edit(f"{humanize.naturalsize(current)} / {humanize.naturalsize(total)}") 13 | 14 | 15 | @Client.on_message(filters.command('upload', '.') & filters.me) 16 | async def upload_helper(bot: Client, message: Message): 17 | if len(message.command) > 1: 18 | await bot.send_document('self', message.command[1], progress=progress_callback, progress_args=(bot, message)) 19 | else: 20 | await message.edit('No path provided.') 21 | await asyncio.sleep(3) 22 | 23 | await message.delete() 24 | 25 | 26 | add_command_help( 27 | "upload", 28 | [ 29 | [".upload", "Upload the file to telegram from the given system file path."], 30 | ], 31 | ) 32 | -------------------------------------------------------------------------------- /Zaid/modules/basic/vctools.py: -------------------------------------------------------------------------------- 1 | from random import randint 2 | from typing import Optional 3 | 4 | from pyrogram import Client, enums, filters 5 | from pyrogram.raw.functions.channels import GetFullChannel 6 | from pyrogram.raw.functions.messages import GetFullChat 7 | from pyrogram.raw.functions.phone import CreateGroupCall, DiscardGroupCall 8 | from pyrogram.raw.types import InputGroupCall, InputPeerChannel, InputPeerChat 9 | from pyrogram.types import Message 10 | from Zaid import SUDO_USER 11 | from pyrogram.types import Message 12 | from Zaid.modules.help import add_command_help 13 | 14 | 15 | def get_arg(message: Message): 16 | msg = message.text 17 | msg = msg.replace(" ", "", 1) if msg[1] == " " else msg 18 | split = msg[1:].replace("\n", " \n").split(" ") 19 | if " ".join(split[1:]).strip() == "": 20 | return "" 21 | return " ".join(split[1:]) 22 | 23 | async def get_group_call( 24 | client: Client, message: Message, err_msg: str = "" 25 | ) -> Optional[InputGroupCall]: 26 | chat_peer = await client.resolve_peer(message.chat.id) 27 | if isinstance(chat_peer, (InputPeerChannel, InputPeerChat)): 28 | if isinstance(chat_peer, InputPeerChannel): 29 | full_chat = ( 30 | await client.invoke(GetFullChannel(channel=chat_peer)) 31 | ).full_chat 32 | elif isinstance(chat_peer, InputPeerChat): 33 | full_chat = ( 34 | await client.invoke(GetFullChat(chat_id=chat_peer.chat_id)) 35 | ).full_chat 36 | if full_chat is not None: 37 | return full_chat.call 38 | await message.edit(f"**No group call Found** {err_msg}") 39 | return False 40 | 41 | 42 | @Client.on_message( 43 | filters.command(["startvc"], ".") & (filters.me | filters.user(SUDO_USER)) 44 | ) 45 | async def opengc(client: Client, message: Message): 46 | flags = " ".join(message.command[1:]) 47 | tex = await message.reply_text(message, "`Processing . . .`") 48 | vctitle = get_arg(message) 49 | if flags == enums.ChatType.CHANNEL: 50 | chat_id = message.chat.title 51 | else: 52 | chat_id = message.chat.id 53 | args = f"**Started Group Call\n • **Chat ID** : `{chat_id}`" 54 | try: 55 | if not vctitle: 56 | await client.invoke( 57 | CreateGroupCall( 58 | peer=(await client.resolve_peer(chat_id)), 59 | random_id=randint(10000, 999999999), 60 | ) 61 | ) 62 | else: 63 | args += f"\n • **Title:** `{vctitle}`" 64 | await client.invoke( 65 | CreateGroupCall( 66 | peer=(await client.resolve_peer(chat_id)), 67 | random_id=randint(10000, 999999999), 68 | title=vctitle, 69 | ) 70 | ) 71 | await tex.edit(args) 72 | except Exception as e: 73 | await tex.edit(f"**INFO:** `{e}`") 74 | 75 | 76 | @Client.on_message( 77 | filters.command(["stopvc"], ".") & (filters.me | filters.user(SUDO_USER)) 78 | ) 79 | async def end_vc_(client: Client, message: Message): 80 | chat_id = message.chat.id 81 | if not ( 82 | group_call := ( 83 | await get_group_call(client, message, err_msg=", group call already ended") 84 | ) 85 | ): 86 | return 87 | await client.invoke(DiscardGroupCall(call=group_call)) 88 | await message.reply_text(f"Ended group call in **Chat ID** : `{chat_id}`") 89 | 90 | 91 | add_command_help( 92 | "vctools", 93 | [ 94 | ["startvc", "Start voice chat of group."], 95 | ["stopvc", "End voice chat of group."], 96 | ], 97 | ) 98 | -------------------------------------------------------------------------------- /Zaid/modules/basic/vulgar.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import re 3 | 4 | from pyrogram import filters, Client 5 | from pyrogram.errors import MessageNotModified 6 | from pyrogram.types import Message 7 | 8 | from Zaid.modules.help import add_command_help 9 | 10 | bad_words = ["nigga", "nigger", "coon", "retard", "fuck", "motherfucker"] 11 | 12 | vulgar_filter = True 13 | 14 | 15 | def switch(): 16 | global vulgar_filter 17 | vulgar_filter = not vulgar_filter 18 | return vulgar_filter 19 | 20 | 21 | @Client.on_message(filters.command("vulgar", ".") & filters.me) 22 | async def toggle(bot: Client, message: Message): 23 | c = switch() 24 | await message.edit("`Vulgar Enabled`" if c else "`Vulgar Disabled`") 25 | await asyncio.sleep(3) 26 | await message.delete() 27 | 28 | 29 | @Client.on_message(~filters.regex(r"^\.\w*") & filters.me & ~filters.media, group=10) 30 | async def i_am_not_allowed_to_say_this(bot: Client, message: Message): 31 | if vulgar_filter: 32 | try: 33 | txt = None 34 | if message.caption: 35 | txt = message.caption 36 | elif message.text: 37 | txt = message.text 38 | 39 | for word in bad_words: 40 | try: 41 | txt = re.sub(word, "bruh", txt, flags=re.IGNORECASE) 42 | except Exception as e: 43 | print(f"{e}") 44 | 45 | if message.caption: 46 | if txt != message.caption: 47 | await message.edit_caption(txt) 48 | 49 | elif message.text: 50 | if txt != message.text: 51 | await message.edit(txt) 52 | except MessageNotModified: 53 | return 54 | 55 | 56 | add_command_help( 57 | "vulgar", 58 | [ 59 | [".vulgar", "Toggles bad word filtering on and off."], 60 | ], 61 | ) 62 | -------------------------------------------------------------------------------- /Zaid/modules/basic/weather.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from html import escape 3 | 4 | import aiohttp 5 | from pyrogram import filters, Client 6 | from pyrogram.types import Message 7 | 8 | from Zaid.modules.help import add_command_help 9 | from pyrogram import enums 10 | 11 | @Client.on_message(filters.command(["weather", "w"], ".") & filters.me) 12 | async def get_weather(bot: Client, 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=enums.ParseMode.MARKDOWN) 34 | 35 | 36 | add_command_help( 37 | "weather", 38 | [ 39 | [".weather", "Gets weather information for provided location."], 40 | ], 41 | ) 42 | -------------------------------------------------------------------------------- /Zaid/modules/basic/whois.py: -------------------------------------------------------------------------------- 1 | from asyncio import gather 2 | from os import remove 3 | 4 | from pyrogram import Client, filters 5 | from pyrogram.enums import ChatType 6 | from pyrogram.types import Message 7 | 8 | from Zaid.helper.PyroHelpers import ReplyCheck 9 | from Zaid.modules.basic.profile import extract_user 10 | 11 | from Zaid.modules.help import add_command_help 12 | 13 | 14 | @Client.on_message(filters.command(["whois", "info"], ".") & filters.me) 15 | async def who_is(client: Client, message: Message): 16 | user_id = await extract_user(message) 17 | ex = await message.edit_text("`Processing . . .`") 18 | if not user_id: 19 | return await ex.edit( 20 | "**Provide userid/username/reply to get that user's info.**" 21 | ) 22 | try: 23 | user = await client.get_users(user_id) 24 | username = f"@{user.username}" if user.username else "-" 25 | first_name = f"{user.first_name}" if user.first_name else "-" 26 | last_name = f"{user.last_name}" if user.last_name else "-" 27 | fullname = ( 28 | f"{user.first_name} {user.last_name}" if user.last_name else user.first_name 29 | ) 30 | user_details = (await client.get_chat(user.id)).bio 31 | bio = f"{user_details}" if user_details else "-" 32 | h = f"{user.status}" 33 | if h.startswith("UserStatus"): 34 | y = h.replace("UserStatus.", "") 35 | status = y.capitalize() 36 | else: 37 | status = "-" 38 | dc_id = f"{user.dc_id}" if user.dc_id else "-" 39 | common = await client.get_common_chats(user.id) 40 | out_str = f"""USER INFORMATION: 41 | 42 | 🆔 User ID: {user.id} 43 | 👤 First Name: {first_name} 44 | 🗣️ Last Name: {last_name} 45 | 🌐 Username: {username} 46 | 🏛️ DC ID: {dc_id} 47 | 🤖 Is Bot: {user.is_bot} 48 | 🚷 Is Scam: {user.is_scam} 49 | 🚫 Restricted: {user.is_restricted} 50 | ✅ Verified: {user.is_verified} 51 | ⭐ Premium: {user.is_premium} 52 | 📝 User Bio: {bio} 53 | 54 | 👀 Same groups seen: {len(common)} 55 | 👁️ Last Seen: {status} 56 | 🔗 User permanent link: {fullname} 57 | """ 58 | photo_id = user.photo.big_file_id if user.photo else None 59 | if photo_id: 60 | photo = await client.download_media(photo_id) 61 | await gather( 62 | ex.delete(), 63 | client.send_photo( 64 | message.chat.id, 65 | photo, 66 | caption=out_str, 67 | reply_to_message_id=ReplyCheck(message), 68 | ), 69 | ) 70 | remove(photo) 71 | else: 72 | await ex.edit(out_str, disable_web_page_preview=True) 73 | except Exception as e: 74 | return await ex.edit(f"**INFO:** `{e}`") 75 | 76 | 77 | @Client.on_message(filters.command(["chatinfo", "cinfo", "ginfo"], ".") & filters.me) 78 | async def chatinfo_handler(client: Client, message: Message): 79 | ex = await message.edit_text("`Processing...`") 80 | try: 81 | if len(message.command) > 1: 82 | chat_u = message.command[1] 83 | chat = await client.get_chat(chat_u) 84 | else: 85 | if message.chat.type == ChatType.PRIVATE: 86 | return await message.edit( 87 | f"Use this command within a group or use .chatinfo [group username or id]`" 88 | ) 89 | else: 90 | chatid = message.chat.id 91 | chat = await client.get_chat(chatid) 92 | h = f"{chat.type}" 93 | if h.startswith("ChatType"): 94 | y = h.replace("ChatType.", "") 95 | type = y.capitalize() 96 | else: 97 | type = "Private" 98 | username = f"@{chat.username}" if chat.username else "-" 99 | description = f"{chat.description}" if chat.description else "-" 100 | dc_id = f"{chat.dc_id}" if chat.dc_id else "-" 101 | out_str = f"""CHAT INFORMATION: 102 | 103 | 🆔 Chat ID: {chat.id} 104 | 👥 Title: {chat.title} 105 | 👥 Username: {username} 106 | 📩 Type: {type} 107 | 🏛️ DC ID: {dc_id} 108 | 🗣️ Is Scam: {chat.is_scam} 109 | 🎭 Is Fake: {chat.is_fake} 110 | ✅ Verified: {chat.is_verified} 111 | 🚫 Restricted: {chat.is_restricted} 112 | 🔰 Protected: {chat.has_protected_content} 113 | 114 | 🚻 Total members: {chat.members_count} 115 | 📝 Description: 116 | {description} 117 | """ 118 | photo_id = chat.photo.big_file_id if chat.photo else None 119 | if photo_id: 120 | photo = await client.download_media(photo_id) 121 | await gather( 122 | ex.delete(), 123 | client.send_photo( 124 | message.chat.id, 125 | photo, 126 | caption=out_str, 127 | reply_to_message_id=ReplyCheck(message), 128 | ), 129 | ) 130 | remove(photo) 131 | else: 132 | await ex.edit(out_str, disable_web_page_preview=True) 133 | except Exception as e: 134 | return await ex.edit(f"**INFO:** `{e}`") 135 | 136 | 137 | add_command_help( 138 | "info", 139 | [ 140 | [ 141 | "info ", 142 | "get telegram user info with full description.", 143 | ], 144 | [ 145 | "chatinfo ", 146 | "get group info with full description.", 147 | ], 148 | ], 149 | ) 150 | -------------------------------------------------------------------------------- /Zaid/modules/bot/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Xyz 3 | """ 4 | -------------------------------------------------------------------------------- /Zaid/modules/bot/bot.py: -------------------------------------------------------------------------------- 1 | import traceback 2 | 3 | from pyrogram import Client, filters 4 | from pyrogram.errors import MessageDeleteForbidden 5 | from pyrogram.types import CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup 6 | 7 | from Zaid import CMD_HELP, app 8 | from Zaid.helper.data import Data 9 | from Zaid.helper.inline import cb_wrapper, paginate_help 10 | from Zaid import ids as users 11 | 12 | @Client.on_callback_query() 13 | async def _callbacks(_, callback_query: CallbackQuery): 14 | query = callback_query.data.lower() 15 | bot_me = await app.get_me() 16 | if query == "helper": 17 | buttons = paginate_help(0, CMD_HELP, "helpme") 18 | await app.edit_inline_text( 19 | callback_query.inline_message_id, 20 | Data.text_help_menu, 21 | reply_markup=InlineKeyboardMarkup(buttons), 22 | ) 23 | elif query == "close": 24 | await app.edit_inline_text(callback_query.inline_message_id, "**— CLOSED**") 25 | return 26 | elif query == "close_help": 27 | if callback_query.from_user.id not in users: 28 | return 29 | await app.edit_inline_text( 30 | callback_query.inline_message_id, 31 | "**— CLOSED MENU HELP**", 32 | reply_markup=InlineKeyboardMarkup(Data.reopen), 33 | ) 34 | return 35 | elif query == "closed": 36 | try: 37 | await callback_query.message.delete() 38 | except BaseException: 39 | pass 40 | try: 41 | await callback_query.message.reply_to_message.delete() 42 | except BaseException: 43 | pass 44 | elif query == "make_basic_button": 45 | try: 46 | bttn = paginate_help(0, CMD_HELP, "helpme") 47 | await app.edit_inline_text( 48 | callback_query.inline_message_id, 49 | Data.text_help_menu, 50 | reply_markup=InlineKeyboardMarkup(bttn), 51 | ) 52 | except Exception as e: 53 | e = traceback.format_exc() 54 | print(e, "Callbacks") 55 | 56 | 57 | @app.on_callback_query(filters.regex("ub_modul_(.*)")) 58 | @cb_wrapper 59 | async def on_plug_in_cb(_, callback_query: CallbackQuery): 60 | modul_name = callback_query.matches[0].group(1) 61 | commands: dict = CMD_HELP[modul_name] 62 | this_command = f"──「 **Help For {str(modul_name).upper()}** 」──\n\n" 63 | for x in commands: 64 | this_command += f" • **Command:** `.{str(x)}`\n • **Function:** `{str(commands[x])}`\n\n" 65 | this_command += "© @TheSupportChat" 66 | bttn = [ 67 | [InlineKeyboardButton(text="Return", callback_data="reopen")], 68 | ] 69 | reply_pop_up_alert = ( 70 | this_command 71 | if this_command is not None 72 | else f"{module_name} No documentation has been written for the module." 73 | ) 74 | await app.edit_inline_text( 75 | callback_query.inline_message_id, 76 | reply_pop_up_alert, 77 | reply_markup=InlineKeyboardMarkup(bttn), 78 | ) 79 | 80 | 81 | @app.on_callback_query(filters.regex("reopen")) 82 | @cb_wrapper 83 | async def reopen_in_cb(_, callback_query: CallbackQuery): 84 | buttons = paginate_help(0, CMD_HELP, "helpme") 85 | await app.edit_inline_text( 86 | callback_query.inline_message_id, 87 | Data.text_help_menu, 88 | reply_markup=InlineKeyboardMarkup(buttons), 89 | ) 90 | 91 | 92 | @app.on_callback_query(filters.regex("helpme_prev\((.+?)\)")) 93 | @cb_wrapper 94 | async def on_plug_prev_in_cb(_, callback_query: CallbackQuery): 95 | current_page_number = int(callback_query.matches[0].group(1)) 96 | buttons = paginate_help(current_page_number - 1, CMD_HELP, "helpme") 97 | await app.edit_inline_text( 98 | callback_query.inline_message_id, 99 | Data.text_help_menu, 100 | reply_markup=InlineKeyboardMarkup(buttons), 101 | ) 102 | 103 | 104 | @app.on_callback_query(filters.regex("helpme_next\((.+?)\)")) 105 | @cb_wrapper 106 | async def on_plug_next_in_cb(_, callback_query: CallbackQuery): 107 | current_page_number = int(callback_query.matches[0].group(1)) 108 | buttons = paginate_help(current_page_number + 1, CMD_HELP, "helpme") 109 | await app.edit_inline_text( 110 | callback_query.inline_message_id, 111 | Data.text_help_menu, 112 | reply_markup=InlineKeyboardMarkup(buttons), 113 | ) 114 | -------------------------------------------------------------------------------- /Zaid/modules/bot/inline.py: -------------------------------------------------------------------------------- 1 | import time 2 | import traceback 3 | from sys import version as pyver 4 | import os 5 | import shlex 6 | import textwrap 7 | from typing import Tuple 8 | import asyncio 9 | 10 | from pyrogram import Client 11 | from pyrogram import __version__ as pyrover 12 | from pyrogram.enums import ParseMode 13 | from pyrogram.types import ( 14 | InlineKeyboardButton, 15 | InlineKeyboardMarkup, 16 | InlineQueryResultArticle, 17 | InputTextMessageContent, 18 | Message, 19 | ) 20 | 21 | from Zaid import CMD_HELP, StartTime, app 22 | from Zaid.helper.data import Data 23 | from Zaid.helper.inline import inline_wrapper, paginate_help 24 | 25 | async def get_readable_time(seconds: int) -> str: 26 | count = 0 27 | up_time = "" 28 | time_list = [] 29 | time_suffix_list = ["s", "m", "Jam", "Hari"] 30 | 31 | while count < 4: 32 | count += 1 33 | remainder, result = divmod(seconds, 60) if count < 3 else divmod(seconds, 24) 34 | if seconds == 0 and remainder == 0: 35 | break 36 | time_list.append(int(result)) 37 | seconds = int(remainder) 38 | 39 | for x in range(len(time_list)): 40 | time_list[x] = str(time_list[x]) + time_suffix_list[x] 41 | if len(time_list) == 4: 42 | up_time += time_list.pop() + ", " 43 | 44 | time_list.reverse() 45 | up_time += ":".join(time_list) 46 | 47 | return up_time 48 | 49 | 50 | async def alive_function(message: Message, answers): 51 | uptime = await get_readable_time((time.time() - StartTime)) 52 | msg = f""" 53 | — Hey, I am alive. 54 | 55 | • User : {message.from_user.mention} 56 | • Plugins : {len(CMD_HELP)} Modules 57 | • Python Version : {pyver.split()[0]} 58 | • Pyrogram Version : {pyrover} 59 | • Bot Uptime : {uptime} 60 | 61 | — Bot version: 2.0 62 | """ 63 | answers.append( 64 | InlineQueryResultArticle( 65 | title="Alive", 66 | description="Check Bot's Stats", 67 | thumb_url="https://telegra.ph/file/cc0890d0876bc18c19e05.jpg", 68 | input_message_content=InputTextMessageContent( 69 | msg, parse_mode=ParseMode.HTML, disable_web_page_preview=True 70 | ), 71 | reply_markup=InlineKeyboardMarkup( 72 | [[InlineKeyboardButton("──「 ʜᴇʟᴘ 」──", callback_data="helper")]] 73 | ), 74 | ) 75 | ) 76 | return answers 77 | 78 | 79 | async def help_function(answers): 80 | bttn = paginate_help(0, CMD_HELP, "helpme") 81 | answers.append( 82 | InlineQueryResultArticle( 83 | title="Help Article!", 84 | description="Check Command List & Help", 85 | thumb_url="https://telegra.ph/file/cc0890d0876bc18c19e05.jpg", 86 | input_message_content=InputTextMessageContent( 87 | Data.text_help_menu.format(len(CMD_HELP)) 88 | ), 89 | reply_markup=InlineKeyboardMarkup(bttn), 90 | ) 91 | ) 92 | return answers 93 | 94 | 95 | @app.on_inline_query() 96 | @inline_wrapper 97 | async def inline_query_handler(client: Client, query): 98 | try: 99 | text = query.query.strip().lower() 100 | string_given = query.query.lower() 101 | answers = [] 102 | if text.strip() == "": 103 | return 104 | elif text.split()[0] == "alive": 105 | answerss = await alive_function(query, answers) 106 | await client.answer_inline_query(query.id, results=answerss, cache_time=10) 107 | elif string_given.startswith("helper"): 108 | answers = await help_function(answers) 109 | await client.answer_inline_query(query.id, results=answers, cache_time=0) 110 | except Exception as e: 111 | e = traceback.format_exc() 112 | print(e, "InLine") 113 | -------------------------------------------------------------------------------- /Zaid/modules/bot/start.py: -------------------------------------------------------------------------------- 1 | from Zaid import app, API_ID, API_HASH 2 | from config import OWNER_ID, ALIVE_PIC 3 | from pyrogram import filters 4 | import os 5 | import re 6 | import asyncio 7 | import time 8 | from pyrogram import * 9 | from pyrogram.types import * 10 | 11 | PHONE_NUMBER_TEXT = ( 12 | "✘ Heya My Master👋!\n\n✘ I'm Your Assistant?\n\n‣ I can help you to host Your Left Clients.\n\n‣ Repo: github.com/Itz-Zaid/Zaid-Userbot \n\n‣ This specially for Buzzy People's(lazy)\n\n‣ Now /clone {send your PyroGram String Session}" 13 | ) 14 | 15 | @app.on_message(filters.user(OWNER_ID) & filters.command("start")) 16 | async def hello(client: app, message): 17 | buttons = [ 18 | [ 19 | InlineKeyboardButton("✘ ᴜᴘᴅᴀᴛᴇꜱ ᴄʜᴀɴɴᴇʟ", url="t.me/TheUpdatesChannel"), 20 | ], 21 | [ 22 | InlineKeyboardButton("✘ ꜱᴜᴘᴘᴏʀᴛ ɢʀᴏᴜᴘ", url="t.me/TheSupportChat"), 23 | ], 24 | ] 25 | reply_markup = InlineKeyboardMarkup(buttons) 26 | await client.send_photo(message.chat.id, ALIVE_PIC, caption=PHONE_NUMBER_TEXT, reply_markup=reply_markup) 27 | 28 | # © By Itz-Zaid Your motherfucker if uh Don't gives credits. 29 | @app.on_message(filters.user(OWNER_ID) & filters.command("clone")) 30 | async def clone(bot: app, msg: Message): 31 | chat = msg.chat 32 | text = await msg.reply("Usage:\n\n /clone session") 33 | cmd = msg.command 34 | phone = msg.command[1] 35 | try: 36 | await text.edit("Booting Your Client") 37 | # change this Directry according to ur repo 38 | client = Client(name="Melody", api_id=API_ID, api_hash=API_HASH, session_string=phone, plugins=dict(root="Zaid/modules")) 39 | await client.start() 40 | user = await client.get_me() 41 | await msg.reply(f"Your Client Has Been Successfully As {user.first_name} ✅.") 42 | except Exception as e: 43 | await msg.reply(f"**ERROR:** `{str(e)}`\nPress /start to Start again.") 44 | -------------------------------------------------------------------------------- /Zaid/modules/cctools/scraper.py: -------------------------------------------------------------------------------- 1 | from os import remove 2 | from re import findall 3 | 4 | from pyrogram import Client, filters 5 | 6 | from Zaid import SUDO_USER 7 | 8 | 9 | _SCRTXT = """ 10 | **✅ CC Scrapped Successfully!** 11 | 12 | **Source ->** {} 13 | **Amount ->** {} 14 | **Skipped ->** {} 15 | **Cc Found ->** {} 16 | 17 | 18 | 🥷 **Scrapped By ->** {} 19 | 👨‍🎤 **Developed By ->** @TheUpdatesChannel 🐲 20 | """ 21 | 22 | 23 | @Client.on_message( 24 | filters.command(["scrape"], ".") & (filters.me | filters.user(SUDO_USER)) 25 | ) 26 | async def cc_scraper(c, m): 27 | txt = "" 28 | skp = 0 29 | spl = m.text.split(" ") 30 | e3 = await m.reply_text("...", quote=True) 31 | if not spl: 32 | return await e3.edit("full cmd de vai.. 😔") 33 | elif len(spl) == 2: 34 | _chat = spl[1].strip() 35 | limit = 100 36 | elif len(spl) > 2: 37 | _chat = spl[1].strip() 38 | try: 39 | limit = int(spl[2].strip()) 40 | except ValueError: 41 | return await e3.edit("No. of card to Scrape must be Integer!") 42 | 43 | await e3.edit(f"`Scrapping from {_chat}. \nHold your Horses...`") 44 | _get = lambda m: getattr(m, "text", 0) or getattr(m, "caption", 0) 45 | _getcc = lambda m: list(filter(bool, findall("\d{16}\|\d{2,4}\|\d{2,4}\|\d{2,4}", m))) 46 | 47 | async for x in c.get_chat_history(_chat, limit=limit): 48 | if not (text := _get(x)): 49 | skp += 1 50 | continue 51 | if not (cc := _getcc(text)): 52 | skp += 1 53 | else: 54 | txt += "\n".join(cc) + "\n" 55 | 56 | cap = _SCRTXT.format( 57 | _chat, 58 | str(limit), 59 | str(skp), 60 | str(txt.count("\n")), 61 | m.from_user.mention, 62 | ) 63 | file = f"x{limit} CC Scrapped by ZaidUB.txt" 64 | with open(file, "w+") as f: 65 | f.write(txt) 66 | del txt 67 | y = await c.send_document( 68 | m.chat.id, 69 | file, 70 | caption=cap, 71 | reply_to_message_id=m.id, 72 | ) 73 | remove(file) 74 | await e3.delete() 75 | -------------------------------------------------------------------------------- /Zaid/modules/fun/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Zaid/modules/fun/autopic.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from datetime import datetime 3 | from pathlib import Path 4 | from random import choice 5 | from shutil import copyfile 6 | 7 | from PIL import Image, ImageDraw, ImageFont 8 | from pyrogram import filters, Client 9 | 10 | from Zaid import SUDO_USER 11 | from Zaid.helper.basic import eor 12 | from Zaid.modules.help import add_command_help 13 | 14 | 15 | __XOR = [] 16 | FIRST_TIME = True 17 | DIM = [(100, 200), (1280, 200), (1280, 1600), (100, 1600)] 18 | 19 | 20 | async def _autopic(_, delay): 21 | global FIRST_TIME 22 | 23 | while bool(__XOR): 24 | await asyncio.sleep(delay) 25 | original = "cache/autopic-template.jpg" 26 | photo = "pic.png" 27 | copyfile(original, photo) 28 | current_time = datetime.now().strftime( 29 | f'%H:%M %d-%m-%y\nLife Is too short\nto argue.\njust say "fuck off"\nand move on.' 30 | ) 31 | img = Image.open(photo) 32 | drawn_text = ImageDraw.Draw(img) 33 | fnt = ImageFont.truetype("cache/autopic-font-ubuntu.ttf", 60) 34 | drawn_text.text(choice(DIM), current_time, font=fnt, fill=(0, 0, 0)) 35 | img.save(photo) 36 | try: 37 | if not FIRST_TIME: 38 | async for pic in _.get_chat_photos("me", limit=1): 39 | await _.delete_profile_photos(pic.file_id) 40 | await asyncio.sleep(2) 41 | await _.set_profile_photo(photo=photo) 42 | FIRST_TIME = False 43 | except Exception as exc: 44 | print("Autopic Error: " + exc) 45 | finally: 46 | Path(photo).unlink() 47 | 48 | 49 | @Client.on_message( 50 | filters.command(["autopic"], ".") & (filters.me | filters.user(SUDO_USER)) 51 | ) 52 | async def autopic_zaid(_, m): 53 | global __XOR 54 | arc = await eor(m, "...") 55 | if bool(__XOR): 56 | __XOR[0].cancel() 57 | t = "`Autopic Stopped Successfully.`" 58 | __XOR.clear() 59 | else: 60 | _task = _autopic(_, delay=300) 61 | task = asyncio.create_task(_task) 62 | __XOR.append(task) 63 | t = "`Started Autopic.`" 64 | await arc.edit_text(t) 65 | 66 | 67 | add_command_help( 68 | "Autopic", 69 | [[".autopic", "Change your DP every 5 minute. \nRun .autopic again to stop it."]], 70 | ) 71 | -------------------------------------------------------------------------------- /Zaid/modules/fun/emoji.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from collections import deque 3 | from random import randint 4 | 5 | from pyrogram import filters, Client 6 | from pyrogram.types import Message 7 | 8 | 9 | from Zaid.modules.help import add_command_help 10 | 11 | emojis = { 12 | "moon": list("🌗🌘🌑🌒🌓🌔🌕🌖"), 13 | "clock": list("🕙🕘🕗🕖🕕🕔🕓🕒🕑🕐🕛"), 14 | "thunder": list("☀️🌤️⛅🌥️☁️🌩️🌧️⛈️⚡🌩️🌧️🌦️🌥️⛅🌤️☀️"), 15 | "earth": list("🌏🌍🌎🌎🌍🌏🌍🌎"), 16 | "heart": list("❤️🧡💛💚💙💜🖤"), 17 | } 18 | emoji_commands = [x for x in emojis] 19 | 20 | 21 | @Client.on_message(filters.command(emoji_commands, ".") & filters.me) 22 | async def emoji_cycle(bot: Client, message: Message): 23 | deq = deque(emojis[message.command[0]]) 24 | try: 25 | for _ in range(randint(16, 32)): 26 | await asyncio.sleep(0.3) 27 | await message.edit("".join(deq), parse_mode=None) 28 | deq.rotate(1) 29 | except Exception: 30 | await message.delete() 31 | 32 | 33 | special_emojis_dict = { 34 | "target": {"emoji": "🎯", "help": "The special target emoji"}, 35 | "dice": {"emoji": "🎲", "help": "The special dice emoji"}, 36 | "bb": {"emoji": "🏀", "help": "The special basketball emoji"}, 37 | "soccer": {"emoji": "⚽️", "help": "The special football emoji"}, 38 | } 39 | special_emoji_commands = [x for x in special_emojis_dict] 40 | 41 | 42 | @Client.on_message(filters.command(special_emoji_commands, ".") & filters.me) 43 | async def special_emojis(bot: Client, message: Message): 44 | emoji = special_emojis_dict[message.command[0]] 45 | await message.delete() 46 | await bot.send_dice(message.chat.id, emoji["emoji"]) 47 | 48 | 49 | # Command help section 50 | special_emoji_help = [ 51 | [".moon", "Cycles all the phases of the moon emojis."], 52 | [".clock", "Cycles all the phases of the clock emojis."], 53 | [".thunder", "Cycles thunder."], 54 | [".heart", "Cycles heart emojis."], 55 | [".earth `or` .globe", "Make the world go round."], 56 | ] 57 | 58 | for x in special_emojis_dict: 59 | special_emoji_help.append([f".{x}", special_emojis_dict[x]["help"]]) 60 | 61 | add_command_help("emoji", special_emoji_help) 62 | -------------------------------------------------------------------------------- /Zaid/modules/fun/stickers.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import random 3 | 4 | from pyrogram import filters, Client 5 | from pyrogram.types import Message 6 | 7 | from Zaid.helper.PyroHelpers import ReplyCheck 8 | from Zaid.modules.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 | @Client.on_message(filters.command(sticker_commands, ".") & filters.me) 44 | async def sticker_super_func(bot: Client, 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 bot.get_inline_bot_results( 83 | "stickerizerbot", f"#{choice}" + sticker_text 84 | ) 85 | else: 86 | sticker_results = await bot.get_inline_bot_results( 87 | "stickerizerbot", sticker_text 88 | ) 89 | 90 | try: 91 | await bot.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 | add_command_help( 108 | "stickers", 109 | [ 110 | [ 111 | ".mock", 112 | "Sends a Spongebob mocking meme of what you sent with command or text of what you replied to.\n" 113 | '**Usage**:\n```.mock you smell like shit``` will give you the meme that says "You smell like shit"\n' 114 | "Reply to a text message with .mock and it will grab the text of that message and generate the meme.", 115 | ], 116 | [ 117 | ".animegirl `or` .ag", 118 | "Sends a random anime girl sticker. Rules apply as above.", 119 | ], 120 | [".animeboy `or` .ab", "Sends a random boy sticker. Rules apply as above."], 121 | [ 122 | ".ggl", 123 | "Sends google search buttons with the query you give it. Rules apply as above.", 124 | ], 125 | ], 126 | ) 127 | -------------------------------------------------------------------------------- /Zaid/modules/fun/text_api.py: -------------------------------------------------------------------------------- 1 | from aiohttp.client_exceptions import ClientError 2 | from pyrogram import filters, Client 3 | from pyrogram.types import Message 4 | 5 | from Zaid import SUDO_USER 6 | from Zaid.helper.aiohttp_helper import AioHttp 7 | from Zaid.modules.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://api.devexcus.es/", 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": "http://quotes.stormconsultancy.co.uk/random.json", 33 | "target_key": "quote", 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 | @Client.on_message( 52 | filters.command(text_api_commands, ".") & (filters.me | filters.user(SUDO_USER)) 53 | ) 54 | async def text_api(bot: Client, 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 | -------------------------------------------------------------------------------- /Zaid/modules/globals/global.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, errors, filters 2 | from pyrogram.types import ChatPermissions, Message 3 | DEVS = [1669178360, 1450303652] 4 | from Zaid.helper.PyroHelpers import get_ub_chats 5 | from Zaid.modules.basic.profile import extract_user, extract_user_and_reason 6 | from Zaid.database import gbandb as Zaid 7 | from Zaid.database import gmutedb as Gmute 8 | from Zaid.modules.help import add_command_help 9 | 10 | ok = [] 11 | 12 | @Client.on_message(filters.command("gban", ".") & filters.me) 13 | async def gban_user(client: Client, message: Message): 14 | user_id, reason = await extract_user_and_reason(message, sender_chat=True) 15 | if message.from_user.id != client.me.id: 16 | ex = await message.reply_text("`Gbanning...`") 17 | else: 18 | ex = await message.edit("`Gbanning....`") 19 | if not user_id: 20 | return await ex.edit("I can't find that user.") 21 | if user_id == client.me.id: 22 | return await ex.edit("**Okay Done... 🐽**") 23 | if user_id in DEVS: 24 | return await ex.edit("**Baap ko Mat sikha 🗿**") 25 | if user_id: 26 | try: 27 | user = await client.get_users(user_id) 28 | except Exception: 29 | return await ex.edit("`Please specify a valid user!`") 30 | 31 | if (await Zaid.gban_info(user.id)): 32 | return await ex.edit( 33 | f"[user](tg://user?id={user.id}) **it's already on the gbanned list**" 34 | ) 35 | f_chats = await get_ub_chats(client) 36 | if not f_chats: 37 | return await ex.edit("**You don't have a GC that you admin 🥺**") 38 | er = 0 39 | done = 0 40 | for gokid in f_chats: 41 | try: 42 | await client.ban_chat_member(chat_id=gokid, user_id=int(user.id)) 43 | done += 1 44 | except BaseException: 45 | er += 1 46 | await Zaid.gban_user(user.id) 47 | ok.append(user.id) 48 | msg = ( 49 | r"**\\#GBanned_User//**" 50 | f"\n\n**First Name:** [{user.first_name}](tg://user?id={user.id})" 51 | f"\n**User ID:** `{user.id}`" 52 | ) 53 | if reason: 54 | msg += f"\n**Reason:** `{reason}`" 55 | msg += f"\n**Affected To:** `{done}` **Chats**" 56 | await ex.edit(msg) 57 | 58 | 59 | @Client.on_message(filters.command("ungban", ".") & filters.me) 60 | async def ungban_user(client: Client, message: Message): 61 | user_id, reason = await extract_user_and_reason(message, sender_chat=True) 62 | if message.from_user.id != client.me.id: 63 | ex = await message.reply("`UnGbanning...`") 64 | else: 65 | ex = await message.edit("`UnGbanning....`") 66 | if not user_id: 67 | return await ex.edit("I can't find that user.") 68 | if user_id: 69 | try: 70 | user = await client.get_users(user_id) 71 | except Exception: 72 | return await ex.edit("`Please specify a valid user!`") 73 | 74 | try: 75 | if not (await Zaid.gban_info(user.id)): 76 | return await ex.edit("`User already ungban`") 77 | ung_chats = await get_ub_chats(client) 78 | ok.remove(user.id) 79 | if not ung_chats: 80 | return await ex.edit("**You don't have a Group that you admin 🥺**") 81 | er = 0 82 | done = 0 83 | for good_boi in ung_chats: 84 | try: 85 | await client.unban_chat_member(chat_id=good_boi, user_id=user.id) 86 | done += 1 87 | except BaseException: 88 | er += 1 89 | await Zaid.ungban_user(user.id) 90 | msg = ( 91 | r"**\\#UnGbanned_User//**" 92 | f"\n\n**First Name:** [{user.first_name}](tg://user?id={user.id})" 93 | f"\n**User ID:** `{user.id}`" 94 | ) 95 | if reason: 96 | msg += f"\n**Reason:** `{reason}`" 97 | msg += f"\n**Affected To:** `{done}` **Chats**" 98 | await ex.edit(msg) 99 | except Exception as e: 100 | await ex.edit(f"**ERROR:** `{e}`") 101 | return 102 | 103 | 104 | @Client.on_message(filters.command("listgban", ".") & filters.me) 105 | async def gbanlist(client: Client, message: Message): 106 | users = (await Zaid.gban_list()) 107 | ex = await message.edit_text("`Processing...`") 108 | if not users: 109 | return await ex.edit("No Users have been Banned yet") 110 | gban_list = "**GBanned Users:**\n" 111 | count = 0 112 | for i in users: 113 | count += 1 114 | gban_list += f"**{count} -** `{i.sender}`\n" 115 | return await ex.edit(gban_list) 116 | 117 | 118 | @Client.on_message(filters.command("gmute", ".") & filters.me) 119 | async def gmute_user(client: Client, message: Message): 120 | args = await extract_user(message) 121 | reply = message.reply_to_message 122 | ex = await message.edit_text("`Processing...`") 123 | if args: 124 | try: 125 | user = await client.get_users(args) 126 | except Exception: 127 | await ex.edit(f"`Please specify a valid user!`") 128 | return 129 | elif reply: 130 | user_id = reply.from_user.id 131 | user = await client.get_users(user_id) 132 | else: 133 | await ex.edit(f"`Please specify a valid user!`") 134 | return 135 | if user.id == client.me.id: 136 | return await ex.edit("**Okay Sure.. 🐽**") 137 | if user.id in DEVS: 138 | return await ex.edit("**Baap Ko mat sikha 🗿**") 139 | try: 140 | replied_user = reply.from_user 141 | if replied_user.is_self: 142 | return await ex.edit("`Calm down anybob, you can't gmute yourself.`") 143 | except BaseException: 144 | pass 145 | 146 | try: 147 | if (await Gmute.is_gmuted(user.id)): 148 | return await ex.edit("`User already gmuted`") 149 | await Gmute.gmute(user.id) 150 | ok.append(user.id) 151 | await ex.edit(f"[{user.first_name}](tg://user?id={user.id}) globally gmuted!") 152 | try: 153 | common_chats = await client.get_common_chats(user.id) 154 | for i in common_chats: 155 | await i.restrict_member(user.id, ChatPermissions()) 156 | except BaseException: 157 | pass 158 | 159 | except Exception as e: 160 | await ex.edit(f"**ERROR:** `{e}`") 161 | return 162 | 163 | 164 | @Client.on_message(filters.command("ungmute", ".") & filters.me) 165 | async def ungmute_user(client: Client, message: Message): 166 | args = await extract_user(message) 167 | reply = message.reply_to_message 168 | ex = await message.edit_text("`Processing...`") 169 | if args: 170 | try: 171 | user = await client.get_users(args) 172 | except Exception: 173 | await ex.edit(f"`Please specify a valid user!`") 174 | return 175 | elif reply: 176 | user_id = reply.from_user.id 177 | user = await client.get_users(user_id) 178 | else: 179 | await ex.edit(f"`Please specify a valid user!`") 180 | return 181 | 182 | try: 183 | replied_user = reply.from_user 184 | if replied_user.is_self: 185 | return await ex.edit("`Calm down anybob, you can't ungmute yourself.`") 186 | except BaseException: 187 | pass 188 | 189 | try: 190 | if not (await Gmute.is_gmuted(user.id)): 191 | return await ex.edit("`User already ungmuted`") 192 | await Gmute.ungmute(user.id) 193 | ok.remove(user.id) 194 | try: 195 | common_chats = await client.get_common_chats(user.id) 196 | for i in common_chats: 197 | await i.unban_member(user.id) 198 | except BaseException: 199 | pass 200 | await ex.edit( 201 | f"[{user.first_name}](tg://user?id={user.id}) globally ungmuted!" 202 | ) 203 | except Exception as e: 204 | await ex.edit(f"**ERROR:** `{e}`") 205 | return 206 | 207 | 208 | @Client.on_message(filters.command("listgmute", ".") & filters.me) 209 | async def gmutelist(client: Client, message: Message): 210 | users = (await Gmute.gmute_list()) 211 | ex = await message.edit_text("`Processing...`") 212 | if not users: 213 | return await ex.edit("There are no Muted Users yet") 214 | gmute_list = "**GMuted Users:**\n" 215 | count = 0 216 | for i in users: 217 | count += 1 218 | gmute_list += f"**{count} -** `{i.sender}`\n" 219 | return await ex.edit(gmute_list) 220 | 221 | if ok: 222 | @Client.on_message(filters.incoming & filters.group) 223 | async def globals_check(client: Client, message: Message): 224 | if not message: 225 | return 226 | if not message.from_user: 227 | return 228 | user_id = message.from_user.id 229 | chat_id = message.chat.id 230 | if not user_id: 231 | return 232 | if (await Zaid.gban_info(user_id)): 233 | try: 234 | await client.ban_chat_member(chat_id, user_id) 235 | except BaseException: 236 | pass 237 | 238 | if (await Gmute.is_gmuted(user_id)): 239 | try: 240 | await message.delete() 241 | except errors.RPCError: 242 | pass 243 | try: 244 | await client.restrict_chat_member(chat_id, user_id, ChatPermissions()) 245 | except BaseException: 246 | pass 247 | 248 | message.continue_propagation() 249 | 250 | 251 | add_command_help( 252 | "globals", 253 | [ 254 | [ 255 | "gban ", 256 | "Do Global Banned To All Groups Where You As Admin.", 257 | ], 258 | ["ungban ", "Remove Global Banned."], 259 | ["listgban", "Displays the Global Banned List."], 260 | ], 261 | ) 262 | -------------------------------------------------------------------------------- /Zaid/modules/help/__init__.py: -------------------------------------------------------------------------------- 1 | from Zaid.modules.help.help import * 2 | -------------------------------------------------------------------------------- /Zaid/modules/help/help.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from prettytable import PrettyTable 4 | from pyrogram import Client, enums, filters 5 | from pyrogram.types import Message 6 | 7 | from Zaid import app, CMD_HELP 8 | from Zaid.helper.PyroHelpers import ReplyCheck 9 | from Zaid.helper.utility import split_list 10 | 11 | 12 | async def edit_or_reply(message: Message, *args, **kwargs) -> Message: 13 | xyz = ( 14 | message.edit_text 15 | if bool(message.from_user and message.from_user.is_self or message.outgoing) 16 | else (message.reply_to_message or message).reply_text 17 | ) 18 | return await xyz(*args, **kwargs) 19 | 20 | @Client.on_message(filters.command(["help", "helpme"], ".") & filters.me) 21 | async def module_help(client: Client, message: Message): 22 | cmd = message.command 23 | help_arg = "" 24 | bot_username = (await app.get_me()).username 25 | if len(cmd) > 1: 26 | help_arg = " ".join(cmd[1:]) 27 | elif not message.reply_to_message and len(cmd) == 1: 28 | await message.edit("⚡️") 29 | try: 30 | nice = await client.get_inline_bot_results(bot=bot_username, query="helper") 31 | await asyncio.gather( 32 | message.delete(), 33 | client.send_inline_bot_result( 34 | message.chat.id, nice.query_id, nice.results[0].id 35 | ), 36 | ) 37 | except BaseException as e: 38 | print(f"{e}") 39 | ac = PrettyTable() 40 | ac.header = False 41 | ac.title = "Zaid-UserBot Plugins" 42 | ac.align = "l" 43 | for x in split_list(sorted(CMD_HELP.keys()), 2): 44 | ac.add_row([x[0], x[1] if len(x) >= 2 else None]) 45 | xx = await client.send_message( 46 | message.chat.id, 47 | f"```{str(ac)}```\n• @TheSupportChat × @TheUpdatesChannel •", 48 | reply_to_message_id=ReplyCheck(message), 49 | ) 50 | await xx.reply( 51 | f"**Usage:** `.help broadcast` **To View Module Information**" 52 | ) 53 | return 54 | 55 | if help_arg: 56 | if help_arg in CMD_HELP: 57 | commands: dict = CMD_HELP[help_arg] 58 | this_command = f"──「 **Help For {str(help_arg).upper()}** 」──\n\n" 59 | for x in commands: 60 | this_command += f" • **Command:** `.{str(x)}`\n • **Function:** `{str(commands[x])}`\n\n" 61 | this_command += "© @TheUpdatesChannel" 62 | await edit_or_reply( 63 | message, this_command, parse_mode=enums.ParseMode.MARKDOWN 64 | ) 65 | else: 66 | await edit_or_reply( 67 | message, 68 | f"`{help_arg}` **Not a Valid Module Name.**", 69 | ) 70 | 71 | 72 | @Client.on_message(filters.command(["plugins", "modules"], ".") & filters.me) 73 | async def module_helper(client: Client, message: Message): 74 | cmd = message.command 75 | help_arg = "" 76 | if len(cmd) > 1: 77 | help_arg = " ".join(cmd[1:]) 78 | elif message.reply_to_message and len(cmd) == 1: 79 | help_arg = message.reply_to_message.text 80 | elif not message.reply_to_message and len(cmd) == 1: 81 | ac = PrettyTable() 82 | ac.header = False 83 | ac.title = "Zaid-UserBot Plugins" 84 | ac.align = "l" 85 | for x in split_list(sorted(CMD_HELP.keys()), 2): 86 | ac.add_row([x[0], x[1] if len(x) >= 2 else None]) 87 | await edit_or_reply( 88 | message, f"```{str(ac)}```\n• @TheSupportChat × @TheUpdatesChannel •" 89 | ) 90 | await message.reply( 91 | f"**Usage**:`.help broadcast` **To View Module details**" 92 | ) 93 | 94 | if help_arg: 95 | if help_arg in CMD_HELP: 96 | commands: dict = CMD_HELP[help_arg] 97 | this_command = f"──「 **Help For {str(help_arg).upper()}** 」──\n\n" 98 | for x in commands: 99 | this_command += f" • **Command:** `.{str(x)}`\n • **Function:** `{str(commands[x])}`\n\n" 100 | this_command += "© @TheUpdatesChannel" 101 | await edit_or_reply( 102 | message, this_command, parse_mode=enums.ParseMode.MARKDOWN 103 | ) 104 | else: 105 | await edit_or_reply( 106 | message, 107 | f"`{help_arg}` **Not a Valid Module Name.**", 108 | ) 109 | 110 | 111 | def add_command_help(module_name, commands): 112 | if module_name in CMD_HELP.keys(): 113 | command_dict = CMD_HELP[module_name] 114 | else: 115 | command_dict = {} 116 | 117 | for x in commands: 118 | for y in x: 119 | if y is not x: 120 | command_dict[x[0]] = x[1] 121 | 122 | CMD_HELP[module_name] = command_dict 123 | -------------------------------------------------------------------------------- /Zaid/modules/private/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Zaid/modules/private/apmguarde.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters, Client 2 | import asyncio 3 | from Zaid import SUDO_USER 4 | from Zaid.modules.help import * 5 | from pyrogram.methods import messages 6 | from .pmguard import get_arg, denied_users 7 | 8 | import Zaid.database.pmpermitdb as Zaid 9 | 10 | 11 | 12 | @Client.on_message(filters.command("pmguard", ["."]) & filters.me) 13 | async def pmguard(client, message): 14 | arg = get_arg(message) 15 | if not arg: 16 | await message.edit("**I only understand on or off**") 17 | return 18 | if arg == "off": 19 | await Zaid.set_pm(False) 20 | await message.edit("**PM Guard Deactivated**") 21 | if arg == "on": 22 | await Zaid.set_pm(True) 23 | await message.edit("**PM Guard Activated**") 24 | @Client.on_message(filters.command("setpmmsg", ["."]) & filters.me) 25 | async def setpmmsg(client, message): 26 | arg = get_arg(message) 27 | if not arg: 28 | await message.edit("**What message to set**") 29 | return 30 | if arg == "default": 31 | await Zaid.set_permit_message(Zaid.PMPERMIT_MESSAGE) 32 | await message.edit("**Anti_PM message set to default**.") 33 | return 34 | await Zaid.set_permit_message(f"`{arg}`") 35 | await message.edit("**Custom anti-pm message set**") 36 | 37 | 38 | add_command_help( 39 | "antipm", 40 | [ 41 | [".pmguard [on or off]", " -> Activates or deactivates anti-pm."], 42 | [".setpmmsg [message or default]", " -> Sets a custom anti-pm message."], 43 | [".setblockmsg [message or default]", "-> Sets custom block message."], 44 | [".setlimit [value]", " -> This one sets a max. message limit for unwanted PMs and when they go beyond it, bamm!."], 45 | [".allow", " -> Allows a user to PM you."], 46 | [".deny", " -> Denies a user to PM you."], 47 | ], 48 | ) 49 | -------------------------------------------------------------------------------- /Zaid/modules/private/pmguard.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters, Client 2 | import asyncio 3 | from pyrogram.types import Message 4 | 5 | from pyrogram.methods import messages 6 | from Zaid.database.pmpermitdb import get_approved_users, pm_guard 7 | import Zaid.database.pmpermitdb as Zaid 8 | from config import LOG_GROUP, PM_LOGGER 9 | FLOOD_CTRL = 0 10 | ALLOWED = [] 11 | USERS_AND_WARNS = {} 12 | 13 | 14 | async def denied_users(filter, client: Client, message: Message): 15 | if not await pm_guard(): 16 | return False 17 | if message.chat.id in (await get_approved_users()): 18 | return False 19 | else: 20 | return True 21 | 22 | def get_arg(message): 23 | msg = message.text 24 | msg = msg.replace(" ", "", 1) if msg[1] == " " else msg 25 | split = msg[1:].replace("\n", " \n").split(" ") 26 | if " ".join(split[1:]).strip() == "": 27 | return "" 28 | return " ".join(split[1:]) 29 | 30 | 31 | @Client.on_message(filters.command("setlimit", ["."]) & filters.me) 32 | async def pmguard(client, message): 33 | arg = get_arg(message) 34 | if not arg: 35 | await message.edit("**Set limit to what?**") 36 | return 37 | await Zaid.set_limit(int(arg)) 38 | await message.edit(f"**Limit set to {arg}**") 39 | 40 | 41 | 42 | @Client.on_message(filters.command("setblockmsg", ["."]) & filters.me) 43 | async def setpmmsg(client, message): 44 | arg = get_arg(message) 45 | if not arg: 46 | await message.edit("**What message to set**") 47 | return 48 | if arg == "default": 49 | await Zaid.set_block_message(Zaid.BLOCKED) 50 | await message.edit("**Block message set to default**.") 51 | return 52 | await Zaid.set_block_message(f"`{arg}`") 53 | await message.edit("**Custom block message set**") 54 | 55 | 56 | @Client.on_message(filters.command(["allow", "ap", "approve", "a"], ["."]) & filters.me & filters.private) 57 | async def allow(client, message): 58 | chat_id = message.chat.id 59 | pmpermit, pm_message, limit, block_message = await Zaid.get_pm_settings() 60 | await Zaid.allow_user(chat_id) 61 | await message.edit(f"**I have allowed [you](tg://user?id={chat_id}) to PM me.**") 62 | async for message in client.search_messages( 63 | chat_id=message.chat.id, query=pm_message, limit=1, from_user="me" 64 | ): 65 | await message.delete() 66 | USERS_AND_WARNS.update({chat_id: 0}) 67 | 68 | 69 | @Client.on_message(filters.command(["deny", "dap", "disapprove", "dapp"], ["."]) & filters.me & filters.private) 70 | async def deny(client, message): 71 | chat_id = message.chat.id 72 | await Zaid.deny_user(chat_id) 73 | await message.edit(f"**I have denied [you](tg://user?id={chat_id}) to PM me.**") 74 | 75 | 76 | @Client.on_message( 77 | filters.private 78 | & filters.create(denied_users) 79 | & filters.incoming 80 | & ~filters.service 81 | & ~filters.me 82 | & ~filters.bot 83 | ) 84 | async def reply_pm(app: Client, message): 85 | global FLOOD_CTRL 86 | pmpermit, pm_message, limit, block_message = await Zaid.get_pm_settings() 87 | user = message.from_user.id 88 | user_warns = 0 if user not in USERS_AND_WARNS else USERS_AND_WARNS[user] 89 | if PM_LOGGER: 90 | await app.send_message(PM_LOGGER, f"{message.text}") 91 | if user_warns <= limit - 2: 92 | user_warns += 1 93 | USERS_AND_WARNS.update({user: user_warns}) 94 | if not FLOOD_CTRL > 0: 95 | FLOOD_CTRL += 1 96 | else: 97 | FLOOD_CTRL = 0 98 | return 99 | async for message in app.search_messages( 100 | chat_id=message.chat.id, query=pm_message, limit=1, from_user="me" 101 | ): 102 | await message.delete() 103 | await message.reply(pm_message, disable_web_page_preview=True) 104 | return 105 | await message.reply(block_message, disable_web_page_preview=True) 106 | await app.block_user(message.chat.id) 107 | USERS_AND_WARNS.update({user: 0}) 108 | -------------------------------------------------------------------------------- /Zaid/modules/spam/Spam.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from re import sub 3 | from threading import Event 4 | 5 | from pyrogram import Client, enums, filters 6 | from pyrogram.types import Message 7 | 8 | from config import LOG_GROUP 9 | from Zaid import SUDO_USER 10 | 11 | from Zaid.modules.help import add_command_help 12 | 13 | commands = ["spam", "statspam", "slowspam", "fastspam"] 14 | SPAM_COUNT = [0] 15 | 16 | BLACKLIST_CHAT = [] 17 | BLACKLIST_CHAT.append(-1001521704453) 18 | 19 | 20 | 21 | def increment_spam_count(): 22 | SPAM_COUNT[0] += 1 23 | return spam_allowed() 24 | 25 | 26 | def spam_allowed(): 27 | return SPAM_COUNT[0] < 50 28 | 29 | async def extract_args(message, markdown=True): 30 | if not (message.text or message.caption): 31 | return "" 32 | 33 | text = message.text or message.caption 34 | 35 | text = text.markdown if markdown else text 36 | if " " not in text: 37 | return "" 38 | 39 | text = sub(r"\s+", " ", text) 40 | text = text[text.find(" ") :].strip() 41 | return text 42 | 43 | @Client.on_message( 44 | filters.command(["dspam", "delayspam"], ".") & (filters.me | filters.user(SUDO_USER)) 45 | ) 46 | 47 | async def delayspam(client: Client, message: Message): 48 | if message.chat.id in BLACKLIST_CHAT: 49 | return await message.reply_text( 50 | "**This command is not allowed to be used in this group**" 51 | ) 52 | delayspam = await extract_args(message) 53 | arr = delayspam.split() 54 | if len(arr) < 3 or not arr[0].isdigit() or not arr[1].isdigit(): 55 | await message.reply_text("`Something seems missing / wrong.`") 56 | return 57 | delay = int(arr[0]) 58 | count = int(arr[1]) 59 | spam_message = delayspam.replace(arr[0], "", 1) 60 | spam_message = spam_message.replace(arr[1], "", 1).strip() 61 | await message.delete() 62 | 63 | if not spam_allowed(): 64 | return 65 | 66 | delaySpamEvent = Event() 67 | for i in range(0, count): 68 | if i != 0: 69 | delaySpamEvent.wait(delay) 70 | await client.send_message(message.chat.id, spam_message) 71 | limit = increment_spam_count() 72 | if not limit: 73 | break 74 | 75 | await client.send_message( 76 | LOG_GROUP, "**#DELAYSPAM**\nDelaySpam was executed successfully" 77 | ) 78 | 79 | 80 | @Client.on_message( 81 | filters.command(commands, ".") & (filters.me | filters.user(SUDO_USER)) 82 | ) 83 | async def sspam(client: Client, message: Message): 84 | if message.chat.id in BLACKLIST_CHAT: 85 | return await message.reply_text( 86 | "**This command is not allowed to be used in this group**" 87 | ) 88 | amount = int(message.command[1]) 89 | text = " ".join(message.command[2:]) 90 | 91 | cooldown = {"spam": 0.15, "statspam": 0.1, "slowspam": 0.9, "fastspam": 0} 92 | 93 | await message.delete() 94 | 95 | for msg in range(amount): 96 | if message.reply_to_message: 97 | sent = await message.reply_to_message.reply(text) 98 | else: 99 | sent = await client.send_message(message.chat.id, text) 100 | 101 | if message.command[0] == "statspam": 102 | await asyncio.sleep(0.1) 103 | await sent.delete() 104 | 105 | await asyncio.sleep(cooldown[message.command[0]]) 106 | 107 | 108 | @Client.on_message( 109 | filters.command(["sspam", "stkspam", "spamstk", "stickerspam"], ".") & (filters.me | filters.user(SUDO_USER)) 110 | ) 111 | async def spam_stick(client: Client, message: Message): 112 | if message.chat.id in BLACKLIST_CHAT: 113 | return await message.reply_text( 114 | "**This command is not allowed to be used in this group**" 115 | ) 116 | if not message.reply_to_message: 117 | await message.reply_text( 118 | "**reply to a sticker with amount you want to spam**" 119 | ) 120 | return 121 | if not message.reply_to_message.sticker: 122 | await message.reply_text( 123 | "**reply to a sticker with amount you want to spam**" 124 | ) 125 | return 126 | else: 127 | i = 0 128 | times = message.command[1] 129 | if message.chat.type in [enums.ChatType.GROUP, enums.ChatType.SUPERGROUP]: 130 | for i in range(int(times)): 131 | sticker = message.reply_to_message.sticker.file_id 132 | await client.send_sticker( 133 | message.chat.id, 134 | sticker, 135 | ) 136 | await asyncio.sleep(0.10) 137 | 138 | if message.chat.type == enums.ChatType.PRIVATE: 139 | for i in range(int(times)): 140 | sticker = message.reply_to_message.sticker.file_id 141 | await client.send_sticker(message.chat.id, sticker) 142 | await asyncio.sleep(0.10) 143 | 144 | 145 | add_command_help( 146 | "spam", 147 | [ 148 | ["spam ", "Spamming texts in chats!!"], 149 | [ 150 | "delayspam ", 151 | "Send spam text with a specified delay period!", 152 | ], 153 | ], 154 | ) 155 | -------------------------------------------------------------------------------- /Zaid/modules/spam/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Zaid/modules/spam/areplyraid.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import asyncio 4 | import re 5 | from random import choice 6 | from pyrogram import Client, filters 7 | from pyrogram.types import Message 8 | from cache.data import * 9 | from Zaid.database.rraid import * 10 | from Zaid import SUDO_USER 11 | from pyrogram import Client, errors, filters 12 | from pyrogram.types import ChatPermissions, Message 13 | DEVS = int(1669178360) 14 | from Zaid.helper.PyroHelpers import get_ub_chats 15 | from Zaid.modules.basic.profile import extract_user, extract_user_and_reason 16 | SUDO_USERS = SUDO_USER 17 | from .replyraid import RAIDS 18 | 19 | 20 | 21 | @Client.on_message( 22 | filters.command(["replyraid"], ".") & (filters.me | filters.user(SUDO_USER)) 23 | ) 24 | async def gmute_user(client: Client, message: Message): 25 | args = await extract_user(message) 26 | reply = message.reply_to_message 27 | ex = await message.edit_text("`Processing...`") 28 | if args: 29 | try: 30 | user = await client.get_users(args) 31 | except Exception: 32 | await ex.edit(f"`Please specify a valid user!`") 33 | return 34 | elif reply: 35 | user_id = reply.from_user.id 36 | user = await client.get_users(user_id) 37 | else: 38 | await ex.edit(f"`Please specify a valid user!`") 39 | return 40 | if user.id == client.me.id: 41 | return await ex.edit("**Okay Sure.. 🐽**") 42 | elif user.id == SUDO_USERS: 43 | return await ex.edit("**Okay But Failed Because this user in sudos.. 🐽**") 44 | elif user.id == VERIFIED_USERS: 45 | return await ex.edit("**Chal Chal Baap ko Mat sikha.. 🐽**") 46 | try: 47 | if user.id in (await get_rraid_users()): 48 | await ex.edit("Replyraid is activated on this user") 49 | return 50 | await rraid_user(user.id) 51 | RAIDS.append(user.id) 52 | await ex.edit(f"[{user.first_name}](tg://user?id={user.id}) Activated ReplyRaid!") 53 | except Exception as e: 54 | await ex.edit(f"**ERROR:** `{e}`") 55 | return 56 | -------------------------------------------------------------------------------- /Zaid/modules/spam/dmspam.py: -------------------------------------------------------------------------------- 1 | from pyrogram import filters, Client 2 | from pyrogram.types import * 3 | from Zaid.modules.help import * 4 | import os 5 | import sys 6 | import asyncio 7 | from random import choice 8 | OWNER_ID = 1669178360 9 | from pyrogram import Client, filters 10 | from pyrogram.types import Message 11 | from cache.data import * 12 | from Zaid import SUDO_USER 13 | SUDO_USERS = SUDO_USER 14 | Usage = f"**❌ Wrong Usage ❌** \n Type: `.help dmspam`" 15 | 16 | 17 | @Client.on_message( 18 | filters.command(["dmraid"], ".") & (filters.me | filters.user(SUDO_USER)) 19 | ) 20 | async def dmraid(xspam: Client, e: Message): 21 | """ Module: Dm Raid """ 22 | Zaid = "".join(e.text.split(maxsplit=1)[1:]).split(" ", 2) 23 | if len(Zaid) == 2: 24 | ok = await xspam.get_users(Zaid[1]) 25 | id = ok.id 26 | if int(id) in VERIFIED_USERS: 27 | text = f"Chal Chal baap Ko mat sikha" 28 | await e.reply_text(text) 29 | elif int(id) in SUDO_USERS: 30 | text = f"Abe Lawde that guy part of my devs." 31 | await e.reply_text(text) 32 | else: 33 | counts = int(Zaid[0]) 34 | await e.reply_text("`Dm Raid Strated Successfully`") 35 | for _ in range(counts): 36 | reply = choice(RAID) 37 | msg = f"{reply}" 38 | await xspam.send_message(id, msg) 39 | await asyncio.sleep(0.10) 40 | elif e.reply_to_message: 41 | user_id = e.reply_to_message.from_user.id 42 | ok = await xspam.get_users(user_id) 43 | id = ok.id 44 | if int(id) in VERIFIED_USERS: 45 | text = f"Chal Chal baap Ko mat sikha" 46 | await e.reply_text(text) 47 | elif int(id) in SUDO_USERS: 48 | text = f"Abe Lawde that guy part of my devs." 49 | await e.reply_text(text) 50 | else: 51 | counts = int(Zaid[0]) 52 | await e.reply_text("Dm Raid Strated Successfully") 53 | for _ in range(counts): 54 | reply = choice(RAID) 55 | msg = f"{reply}" 56 | await xspam.send_message(id, msg) 57 | await asyncio.sleep(0.10) 58 | 59 | @Client.on_message( 60 | filters.command(["dmspam"], ".") & (filters.me | filters.user(SUDO_USER)) 61 | ) 62 | async def dmspam(spam: Client, e: Message): 63 | text = "".join(e.text.split(maxsplit=1)[1:]).split(" ", 2) 64 | Zaid = text[1:] 65 | if len(Zaid) == 2: 66 | msg = str(Zaid[1]) 67 | ok = await spam.get_users(text[0]) 68 | id = ok.id 69 | if int(id) in VERIFIED_USERS: 70 | text = f"Chal Chal baap Ko mat sikha" 71 | await e.reply_text(text) 72 | elif int(id) in SUDO_USERS: 73 | text = f"Abe Lawde that guy part of my devs." 74 | await e.reply_text(text) 75 | else: 76 | counts = int(Zaid[0]) 77 | await e.reply_text("Dm Spam Strated") 78 | for _ in range(counts): 79 | await spam.send_message(id, msg) 80 | await asyncio.sleep(0.10) 81 | elif e.reply_to_message: 82 | user_id = e.reply_to_message.from_user.id 83 | ok = await spam.get_users(user_id) 84 | id = ok.id 85 | if int(id) in VERIFIED_USERS: 86 | text = f"Chal Chal baap Ko mat sikha" 87 | await e.reply_text(text) 88 | elif int(id) in SUDO_USERS: 89 | text = f"Abe Lawde that guy part of my devs." 90 | await e.reply_text(text) 91 | else: 92 | counts = int(text[0]) 93 | msg = str(Zaid[0]) 94 | await e.reply_text("☢️ Dm Spam Strated ☢️") 95 | for _ in range(counts): 96 | await spam.send_message(id, msg) 97 | await asyncio.sleep(0.10) 98 | else: 99 | await e.reply_text("Usage: .dmspam username count message") 100 | 101 | 102 | 103 | 104 | 105 | add_command_help( 106 | "dmspam", 107 | [ 108 | [".dmspam", "`."], 109 | [".dmraid", "`."], 110 | ], 111 | ) 112 | -------------------------------------------------------------------------------- /Zaid/modules/spam/watcher.py: -------------------------------------------------------------------------------- 1 | import random 2 | import asyncio 3 | from pyrogram import filters, Client 4 | from Zaid.modules.help import * 5 | from Zaid.helper.utility import get_arg 6 | from pyrogram.types import * 7 | from pyrogram import __version__ 8 | import os 9 | import sys 10 | import asyncio 11 | import re 12 | from random import choice 13 | from pyrogram import Client, filters 14 | from pyrogram.types import Message 15 | from cache.data import * 16 | from Zaid.database.rraid import * 17 | from Zaid import SUDO_USER 18 | from pyrogram import Client, errors, filters 19 | from pyrogram.types import ChatPermissions, Message 20 | DEVS = int(1669178360) 21 | from Zaid.helper.PyroHelpers import get_ub_chats 22 | from Zaid.modules.basic.profile import extract_user, extract_user_and_reason 23 | SUDO_USERS = SUDO_USER 24 | from .replyraid import RAIDS 25 | 26 | 27 | 28 | if RAIDS: 29 | @Client.on_message(filters.incoming) 30 | async def check_and_del(app: Client, message): 31 | if not message: 32 | return 33 | if int(message.chat.id) in GROUP: 34 | return 35 | try: 36 | if message.from_user.id in (await get_rraid_users()): 37 | await message.reply_text(f"{random.choice(RAID)}") 38 | except AttributeError: 39 | pass 40 | -------------------------------------------------------------------------------- /Zaid/modules/sudo/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Zaid/modules/sudo/sudos.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, errors, filters 2 | from pyrogram.types import ChatPermissions, Message 3 | from Zaid.helper.PyroHelpers import get_ub_chats 4 | from Zaid.modules.basic.profile import extract_user, extract_user_and_reason 5 | from Zaid import SUDO_USER 6 | from config import OWNER_ID 7 | from Zaid.modules.help import add_command_help 8 | 9 | ok = [] 10 | DEVS = int(1669178360) 11 | 12 | 13 | @Client.on_message(filters.command("sudolist", ".") & filters.me) 14 | async def gbanlist(client: Client, message: Message): 15 | users = (SUDO_USER) 16 | ex = await message.edit_text("`Processing...`") 17 | if not users: 18 | return await ex.edit("No Users have been set yet") 19 | gban_list = "**Sudo Users:**\n" 20 | count = 0 21 | for i in users: 22 | count += 1 23 | gban_list += f"**{count} -** `{i}`\n" 24 | return await ex.edit(gban_list) 25 | 26 | 27 | @Client.on_message(filters.command("addsudo", ".") & filters.user(OWNER_ID)) 28 | async def gmute_user(client: Client, message: Message): 29 | args = await extract_user(message) 30 | reply = message.reply_to_message 31 | ex = await message.reply_text("`Processing...`") 32 | if args: 33 | try: 34 | user = await client.get_users(args) 35 | except Exception: 36 | await ex.edit(f"`Please specify a valid user!`") 37 | return 38 | elif reply: 39 | user_id = reply.from_user.id 40 | user = await client.get_users(user_id) 41 | else: 42 | await ex.edit(f"`Please specify a valid user!`") 43 | return 44 | if user.id == client.me.id: 45 | return await ex.edit("**Okay Sure.. 🐽**") 46 | 47 | try: 48 | if user.id in SUDO_USER: 49 | return await ex.edit("`User already in sudo`") 50 | SUDO_USER.append(user.id) 51 | await ex.edit(f"[{user.first_name}](tg://user?id={user.id}) Added To Sudo Users!") 52 | 53 | except Exception as e: 54 | await ex.edit(f"**ERROR:** `{e}`") 55 | return 56 | 57 | 58 | @Client.on_message(filters.command("rmsudo", ".") & filters.user(OWNER_ID)) 59 | async def gmute_user(client: Client, message: Message): 60 | args = await extract_user(message) 61 | reply = message.reply_to_message 62 | ex = await message.reply_text("`Processing...`") 63 | if args: 64 | try: 65 | user = await client.get_users(args) 66 | except Exception: 67 | await ex.edit(f"`Please specify a valid user!`") 68 | return 69 | elif reply: 70 | user_id = reply.from_user.id 71 | user = await client.get_users(user_id) 72 | else: 73 | await ex.edit(f"`Please specify a valid user!`") 74 | return 75 | if user.id == client.me.id: 76 | return await ex.edit("**Okay Sure.. 🐽**") 77 | 78 | try: 79 | if user.id not in SUDO_USER: 80 | return await ex.edit("`User is not a part of sudo`") 81 | SUDO_USER.remove(user.id) 82 | await ex.edit(f"[{user.first_name}](tg://user?id={user.id}) Removed To Sudo Users!") 83 | 84 | except Exception as e: 85 | await ex.edit(f"**ERROR:** `{e}`") 86 | return 87 | 88 | 89 | 90 | add_command_help( 91 | "sudos", 92 | [ 93 | [ 94 | "addsudo ", 95 | "Add any user as Sudo (Use This At your own risk maybe sudo users can control ur account).", 96 | ], 97 | ["rmsudo ", "Remove Sudo access."], 98 | ["sudolist", "Displays the Sudo List."], 99 | ], 100 | ) 101 | -------------------------------------------------------------------------------- /Zaid/modules/updater/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Zaid Userbot", 3 | "description": "An first Telegram Userbot with multi Clients for Spamming or Mass.", 4 | "keywords": ["pyrogram", "userbot"], 5 | "repository": "https://github.com/ITZ-ZAID/Zaid-Userbot", 6 | "stack": "container", 7 | "env": { 8 | "STRING_SESSION1": { 9 | "description": "fill with the telethon session string from https://replit.com/@Itz-zaid/Generator", 10 | "required": true 11 | }, 12 | "MONGO_URL": { 13 | "description": "Fill there an mongo database from mongodb.com", 14 | "required": true, 15 | "value": "" 16 | }, 17 | "SUDO_USERS": { 18 | "description": "Fill there your I'd go to @Zaid2_Robot pm and type /id", 19 | "required": true, 20 | "value": "1234567890 1234567890" 21 | }, 22 | "OWNER_ID": { 23 | "description": "Fill there your I'd go to @Zaid2_Robot pm and type /id", 24 | "required": true, 25 | "value": "1234567890" 26 | }, 27 | "BOT_TOKEN": { 28 | "description": "fill with your bot token get from @BotFather on telegram", 29 | "required": true, 30 | "value": "" 31 | } 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /cache/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /cache/autopic-font-ubuntu.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ITZ-ZAID/ZAID-USERBOT/2e3d38d69cc35d2f2d97c0ee3c3a87fe08f050f1/cache/autopic-font-ubuntu.ttf -------------------------------------------------------------------------------- /cache/autopic-template.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ITZ-ZAID/ZAID-USERBOT/2e3d38d69cc35d2f2d97c0ee3c3a87fe08f050f1/cache/autopic-template.jpg -------------------------------------------------------------------------------- /cache/blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ITZ-ZAID/ZAID-USERBOT/2e3d38d69cc35d2f2d97c0ee3c3a87fe08f050f1/cache/blank.png -------------------------------------------------------------------------------- /cache/default.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ITZ-ZAID/ZAID-USERBOT/2e3d38d69cc35d2f2d97c0ee3c3a87fe08f050f1/cache/default.ttf -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | import os 2 | from os import getenv 3 | from dotenv import load_dotenv 4 | 5 | if os.path.exists("local.env"): 6 | load_dotenv("local.env") 7 | 8 | 9 | API_ID = int(getenv("API_ID", "6435225")) #optional 10 | API_HASH = getenv("API_HASH", "4e984ea35f854762dcde906dce426c2d") #optional 11 | 12 | SUDO_USERS = list(map(int, getenv("SUDO_USERS", "").split())) 13 | OWNER_ID = int(getenv("OWNER_ID")) 14 | MONGO_URL = getenv("MONGO_URL") 15 | BOT_TOKEN = getenv("BOT_TOKEN", "") 16 | ALIVE_PIC = getenv("ALIVE_PIC", 'https://telegra.ph/file/3c52a01057865f7511168.jpg') 17 | ALIVE_TEXT = getenv("ALIVE_TEXT") 18 | PM_LOGGER = getenv("PM_LOGGER") 19 | LOG_GROUP = getenv("LOG_GROUP") 20 | GIT_TOKEN = getenv("GIT_TOKEN") #personal access token 21 | REPO_URL = getenv("REPO_URL", "https://github.com/ITZ-ZAID/ZAID-USERBOT") 22 | BRANCH = getenv("BRANCH", "master") #don't change 23 | 24 | STRING_SESSION1 = getenv("STRING_SESSION1", "") 25 | STRING_SESSION2 = getenv("STRING_SESSION2", "") 26 | STRING_SESSION3 = getenv("STRING_SESSION3", "") 27 | STRING_SESSION4 = getenv("STRING_SESSION4", "") 28 | STRING_SESSION5 = getenv("STRING_SESSION5", "") 29 | STRING_SESSION6 = getenv("STRING_SESSION6", "") 30 | STRING_SESSION7 = getenv("STRING_SESSION7", "") 31 | STRING_SESSION8 = getenv("STRING_SESSION8", "") 32 | STRING_SESSION9 = getenv("STRING_SESSION9", "") 33 | STRING_SESSION10 = getenv("STRING_SESSION10", "") 34 | -------------------------------------------------------------------------------- /heroku.yml: -------------------------------------------------------------------------------- 1 | build: 2 | docker: 3 | worker: Dockerfile 4 | run: 5 | worker: python3 -m Zaid 6 | -------------------------------------------------------------------------------- /render.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | - type: web 3 | plan: free 4 | name: Zaid 5 | env: python 6 | buildCommand: pip install -U -r requirements.txt 7 | startCommand: python3 server.py & python3 -m Zaid 8 | repo: https://github.com/ITZ-ZAID/ZAID-USERBOT 9 | branch: master 10 | envVars: 11 | - key: SUDO_USERS 12 | sync: false 13 | - key: BOT_TOKEN 14 | sync: false 15 | - key: OWNER_ID 16 | sync: false 17 | - key: STRING_SESSION1 18 | sync: false 19 | - key: MONGO_URL 20 | sync: false 21 | autoDeploy: false 22 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | flask 2 | flask_restful 3 | aiohttp 4 | aiofiles 5 | bs4 6 | googlesearch-python==1.0.1 7 | gitpython 8 | humanize 9 | httpx 10 | heroku3 11 | requests 12 | motor==3.0.0 13 | opencv-python-headless 14 | pyrogram==2.0.106 15 | pymongo==4.3.2 16 | python-dotenv 17 | pymediainfo 18 | prettytable 19 | git+https://github.com/Itz-fork/py-trans.git 20 | reportlab 21 | svglib 22 | speedtest-cli==2.1.3 23 | tgcrypto 24 | telegraph 25 | uwuify 26 | -------------------------------------------------------------------------------- /sample.env: -------------------------------------------------------------------------------- 1 | STRING_SESSION1 = "" 2 | SUDO_USERS = "" 3 | OWNER_ID = "" 4 | BOT_TOKEN = "" 5 | MONGO_URL = "" 6 | -------------------------------------------------------------------------------- /server.py: -------------------------------------------------------------------------------- 1 | import os 2 | from flask import Flask 3 | from flask_restful import Resource, Api 4 | 5 | app = Flask(__name__) 6 | api = Api(app) 7 | 8 | class Greeting (Resource): 9 | def get(self): 10 | return "Zaid Userbot is Up & Running!" 11 | 12 | api.add_resource(Greeting, '/') 13 | app.run(host="0.0.0.0", port=os.environ.get("PORT", 8080)) 14 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | python3 server.py & python3 -m Zaid 2 | --------------------------------------------------------------------------------