name = event.raw_text snips = sql.get_chat_blacklist(event.chat_id) for snip in snips: pattern = r"( |^|[^\w])" + re.escape(snip) + r"( |$|[^\w])" if re.search(pattern, name, flags=re.IGNORECASE): try: await event.delete() except Exception: await event.reply( "I do not have DELETE permission in this chat") sql.rm_from_blacklist(event.chat_id, snip.lower()) break @bot.on(admin_cmd(pattern="addblacklist ((.|\n)*)")) @bot.on(sudo_cmd(pattern="addblacklist ((.|\n)*)", allow_sudo=True)) async def on_add_black_list(event): text = event.pattern_match.group(1) to_blacklist = list( {trigger.strip() for trigger in text.split("\n") if trigger.strip()}) for trigger in to_blacklist: sql.add_to_blacklist(event.chat_id, trigger.lower()) await edit_or_reply( event, "Added {} triggers to the blacklist in the current chat".format( len(to_blacklist)), )
import requests , re from PIL import Image from validators.url import url from DYNAMIC import CMD_HELP from DYNAMIC.helpers.functions import trumptweet, changemymind, kannagen, moditweet, miatweet, papputweet, sunnytweet, sinstweet, taklatweet, deEmojify, tweets from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd @bot.on(admin_cmd(pattern=r"tweet(?: |$)(.*)")) @bot.on(sudo_cmd(pattern="tweet(?: |$)(.*)", allow_sudo=True)) async def nope(legendx22): hell = legendx22.pattern_match.group(1) if not hell: if legendx22.is_reply: what = (await legendx22.get_reply_message()).message else: await legendx22.edit("I need some text to make a tweet🚶") return tweeter = await bot.inline_query( "TwitterStatusBot", f"{(deEmojify(hell))}") await tweeter[0].click(legendx22.chat_id, reply_to=legendx22.reply_to_msg_id, silent=True if legendx22.is_reply else False, hide_via=True) await legendx22.delete() @bot.on(admin_cmd(pattern=r"trump(?: |$)(.*)")) @bot.on(sudo_cmd(pattern="trump(?: |$)(.*)", allow_sudo=True)) async def nekobot(borg): text = borg.pattern_match.group(1) reply_to_id = borg.message
import asyncio from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd from DYNAMIC import ALIVE_NAME, CMD_HELP DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "Hell user" @bot.on(admin_cmd(outgoing=True, pattern="kiler( (.*)|$)")) @bot.on(sudo_cmd(pattern="kiler( (.*)|$)", allow_sudo=True)) async def _(event): if event.fwd_from: return name = event.pattern_match.group(1) if not name: name = "die" animation_interval = 0.7 animation_ttl = range(8) event = await edit_or_reply(event, f"**Ready Commando **__{DEFAULTUSER}....") animation_chars = [ "Fiiiiire", f"__**Commando **__{DEFAULTUSER} \n\n_/﹋\_\n (҂`_´)\n <,︻╦╤─ ҉ - \n _/﹋\_\n", f"__**Commando **__{DEFAULTUSER} \n\n_/﹋\_\n (҂`_´)\n <,︻╦╤─ ҉ - -\n _/﹋\_\n", f"__**Commando **__{DEFAULTUSER} \n\n_/﹋\_\n (҂`_´)\n <,︻╦╤─ ҉ - - -\n _/﹋\_\n", f"__**Commando **__{DEFAULTUSER} \n\n_/﹋\_\n (҂`_´)\n<,︻╦╤─ ҉ - -\n _/﹋\_\n", f"__**Commando **__{DEFAULTUSER} \n\n_/﹋\_\n (҂`_´)\n <,︻╦╤─ ҉ - \n _/﹋\_\n", f"__**Commando **__{DEFAULTUSER} \n\n_/﹋\_\n (҂`_´)\n <,︻╦╤─ ҉ - -\n _/﹋\_\n", f"__**Commando **__{DEFAULTUSER} \n\n_/﹋\_\n (҂`_´)\n <,︻╦╤─ ҉ - - - {name}\n _/﹋\_\n", ] for i in animation_ttl:
"This is useless SPAM dude. Stop this, enjoy chat man ", link_preview=False ) else: await event.client.send_message( entity=event.chat_id, message="""**Automatic AntiFlooder** [User](tg://user?id={}) has been automatically restricted because he reached the defined flood limit.""".format( event.message.sender_id ), reply_to=event.message.id, ) @bot.on(admin_cmd(pattern="setflood(?: |$)(.*)")) @bot.on(sudo_cmd(pattern="setflood(?: |$)(.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) event = await edit_or_reply(event, "updating flood settings!") try: sql.set_flood(event.chat_id, input_str) sql.__load_flood_settings() await event.edit( "Antiflood updated to {} in the current chat".format(input_str) ) except Exception as e: # pylint:disable=C0103,W0703 await event.edit(str(e))
import time from telethon.events import NewMessage from telethon.tl.custom import Dialog from telethon.tl.types import Channel, Chat, User from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd from DYNAMIC import CMD_HELP @bot.on(admin_cmd(pattern="stats$")) @bot.on(sudo_cmd(pattern="stats$", allow_sudo=True)) async def stats( event: NewMessage.Event, ) -> None: # pylint: disable = R0912, R0914, R0915 """Command to get stats about the account""" hell = await edit_or_reply(event, "`Collecting stats...`") start_time = time.time() private_chats = 0 bots = 0 groups = 0 broadcast_channels = 0 admin_in_groups = 0 creator_in_groups = 0 admin_in_broadcast_channels = 0 creator_in_channels = 0 unread_mentions = 0 unread = 0 dialog: Dialog async for dialog in event.client.iter_dialogs(): entity = dialog.entity if isinstance(entity, Channel): # participants_count = (await event.get_participants(dialog,
import asyncio from collections import deque from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd from DYNAMIC import CMD_HELP @bot.on(admin_cmd(pattern="think$", outgoing=True)) @bot.on(sudo_cmd(pattern="think$", allow_sudo=True)) async def _(event): if event.fwd_from: return event = await edit_or_reply(event, "think") deq = deque(list("🤔🧐🤔🧐🤔🧐")) for _ in range(48): await asyncio.sleep(0.1) await event.edit("".join(deq)) deq.rotate(1) @bot.on(admin_cmd(pattern=r"lmao$")) @bot.on(sudo_cmd(pattern="lmao$", allow_sudo=True)) async def _(event): if event.fwd_from: return event = await edit_or_reply(event, "lmao") deq = deque(list("😂🤣😂🤣😂🤣")) for _ in range(48): await asyncio.sleep(0.1) await event.edit("".join(deq)) deq.rotate(1)
# thanks to @Skastickers for stickers.... # Among us..... #credits to catDYNAMIC import asyncio from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd from DYNAMIC import ALIVE_NAME, CMD_HELP DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "Hell User" @bot.on(admin_cmd(pattern="imp(|n) (.*)", outgoing=True)) @bot.on(sudo_cmd(pattern="imp(|n) (.*)", allow_sudo=True)) async def _(event): GODBOY = bot.uid USERNAME = f"tg://user?id={GODBOY}" name = event.pattern_match.group(2) cmd = event.pattern_match.group(1).lower() text1 = await edit_or_reply( event, "Hmm... Looks like Something is wrong here🤔🧐!!") await asyncio.sleep(2) await text1.delete() stcr1 = await event.client.send_file(event.chat_id, "CAADAQADRwADnjOcH98isYD5RJTwAg") text2 = await event.reply( f"**[{DEFAULTUSER}]({USERNAME}) :** I have to call discussion😯") await asyncio.sleep(3) await stcr1.delete() await text2.delete() stcr2 = await event.client.send_file(event.chat_id,
return user_obj, extra async def get_user_sender_id(user, event): if isinstance(user, str): user = int(user) try: user_obj = await event.client.get_entity(user) except (TypeError, ValueError) as err: await event.edit(str(err)) return None return user_obj @borg.on(admin_cmd(pattern="gban ?(.*)")) @borg.on(sudo_cmd("gban ?(.*)", allow_sudo=True)) async def gspider(DYNAMIC): lol = DYNAMIC sender = await lol.get_sender() me = await lol.client.get_me() if not sender.id == me.id: friday = await lol.reply("Gbanning This Retard DumbAss😁😁") else: friday = await lol.edit("Wait Processing.....") me = await DYNAMIC.client.get_me() await friday.edit(f"Global Ban Is Coming ! Wait And Watch You bitch😎🔥") my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id) f"@{me.username}" if me.username else my_mention await DYNAMIC.get_chat() a = b = 0 if DYNAMIC.is_private:
import asyncio import math import os import time from datetime import datetime from pySmartDL import SmartDL from DYNAMIC.utils import admin_cmd, sudo_cmd, humanbytes, progress from DYNAMIC import ALIVE_NAME, CMD_HELP DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "Hell User" @bot.on(admin_cmd(pattern="download(?: |$)(.*)", outgoing=True)) @bot.on(sudo_cmd(pattern="download(?: |$)(.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return mone = await edit_or_reply(event, "`Processing ...`") input_str = event.pattern_match.group(1) if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY): os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY) if event.reply_to_msg_id: start = datetime.now() reply_message = await event.get_reply_message() try: c_time = time.time() downloaded_file_name = await event.client.download_media( reply_message, Config.TMP_DOWNLOAD_DIRECTORY,
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. """Urban Dictionary Syntax: .ud Query""" import asyncurban from PyDictionary import PyDictionary from DYNAMIC import CMD_HELP from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd @bot.on(admin_cmd(pattern="ud (.*)")) @bot.on(sudo_cmd(pattern="ud (.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return word = event.pattern_match.group(1) urban = asyncurban.UrbanDictionary() try: mean = await urban.get_word(word) await edit_or_reply( event, "Text: **{}**\n\nMeaning: **{}**\n\nExample: __{}__".format( mean.word, mean.definition, mean.example), ) except asyncurban.WordNotFoundError: await edit_or_reply(event, "No result found for **" + word + "**") @bot.on(admin_cmd(pattern="meaning (.*)"))
"""Create Private Groups Available Commands: .create (b|g) GroupName""" from telethon.tl import functions from DYNAMIC import CMD_HELP from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd @bot.on(admin_cmd(pattern="create (b|g|c) (.*)")) # pylint:disable=E0602 @bot.on(sudo_cmd(pattern="create (b|g|c) (.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return type_of_group = event.pattern_match.group(1) group_name = event.pattern_match.group(2) event = await edit_or_reply(event, "Creating wait sar.....") if type_of_group == "b": try: result = await event.client( functions.messages.CreateChatRequest( # pylint:disable=E0602 users=["@sarah_robot"], # Not enough users (to create a chat, for example) # Telegram, no longer allows creating a chat with ourselves title=group_name, )) created_chat_id = result.chats[0].id await event.client( functions.messages.DeleteChatUserRequest( chat_id=created_chat_id, user_id="@sarah_robot")) result = await event.client( functions.messages.ExportChatInviteRequest(
import json import re import urllib.parse from os import popen from random import choice import requests from bs4 import BeautifulSoup from humanize import naturalsize from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd from DYNAMIC import CMD_HELP @bot.on(admin_cmd(outgoing=True, pattern=r"direct(?: |$)([\s\S]*)")) @bot.on(sudo_cmd(allow_sudo=True, pattern=r"direct(?: |$)([\s\S]*)")) async def direct_link_generator(request): """ direct links generator """ hellevent = await edit_or_reply(request, "`Processing...`") textx = await request.get_reply_message() message = request.pattern_match.group(1) if message: pass elif textx: message = textx.text else: await hellevent.edit("`Usage: .direct <url>`") return reply = "" links = re.findall(r"\bhttps?://.*\.\S+", message) if not links:
msg += f"\n\n**Type** : {jsonData['format']}" msg += f"\n**Genres** : " for g in jsonData['genres']: msg += g+" " msg += f"\n**Status** : {jsonData['status']}" msg += f"\n**Episode** : {jsonData['episodes']}" msg += f"\n**Year** : {jsonData['startDate']['year']}" msg += f"\n**Score** : {jsonData['averageScore']}" msg += f"\n**Duration** : {jsonData['duration']} min\n\n" #https://t.me/catuserbot_support/19496 cat = f"{jsonData['description']}" msg += " __" + re.sub("<br>", '\n', cat) +"__" return msg @bot.on(admin_cmd(pattern="anilist (.*)")) @bot.on(sudo_cmd(pattern="anilist (.*)", allow_sudo=True)) async def anilist(event): if event.fwd_from: return input_str = event.pattern_match.group(1) event = await edit_or_reply(event, "Searching...") result = await callAPI(input_str) msg = await formatJSON(result) await event.edit(msg, link_preview=True) CMD_HELP.update({ "anilist": ".anilist <anime name >\ \nUSAGE: Shows you the details of the anime." })
#credits to @legendx22 """ DYNAMIC module aage ni pta kuch """ import io import sys import traceback from DYNAMIC import CMD_HELP from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd @bot.on(admin_cmd(pattern="calc (.*)")) @bot.on(sudo_cmd(pattern="calc (.*)", allow_sudo=True)) async def _(car): cmd = car.text.split(" ", maxsplit=1)[1] event = await edit_or_reply(car, "Calculating ...") old_stderr = sys.stderr old_stdout = sys.stdout redirected_output = sys.stdout = io.StringIO() redirected_error = sys.stderr = io.StringIO() stdout, stderr, exc = None, None, None san = f"print({cmd})" try: await aexec(san, event) except Exception: exc = traceback.format_exc() stdout = redirected_output.getvalue() stderr = redirected_error.getvalue() sys.stdout = old_stdout sys.stderr = old_stderr
await event.edit("reply to text message as .doc <file name.extension>") #hehe #.stoi nd .itos made by @danish_00 #teamcobra #hehe thumb_image_path = Config.TMP_DOWNLOAD_DIRECTORY + "thumb_image.jpg" @borg.on(admin_cmd(pattern="stoi")) @borg.on(sudo_cmd(pattern="stoi", allow_sudo=True)) async def danish(hehe): if hehe.fwd_from: return thumb = None reply_to_id = hehe.message.id if hehe.reply_to_msg_id: reply_to_id = hehe.reply_to_msg_id cobra = await edit_or_reply(hehe, "Converting.....") input_str = "dc.jpeg" if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY): os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY) if cobra.reply_to_msg_id: start = datetime.now() file_name = input_str
# SOFTWARE. """ DYNAMIC module for frying stuff. ported by @NeoMatrix90 """ import io from random import randint, uniform from PIL import Image, ImageEnhance, ImageOps from telethon import events from telethon.errors.rpcerrorlist import YouBlockedUserError from telethon.tl.types import DocumentAttributeFilename from DYNAMIC import CMD_HELP from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd @bot.on(admin_cmd(pattern="frybot$")) @bot.on(sudo_cmd(pattern="frybot$", allow_sudo=True)) async def _(event): if event.fwd_from: return if not event.reply_to_msg_id: event = await edit_or_reply(event, "Reply to any user message.") return reply_message = await event.get_reply_message() if event.is_reply: reply_message = await event.get_reply_message() data = await check_media(reply_message) if isinstance(data, bool): event = await edit_or_reply(event, "`I can't deep fry that!`") return if not event.is_reply: event = await edit_or_reply(
# MODIFIED BY @GODBOYX # SAY NO TO KANGS, ELSE GEND FAD DI JAYEGI # Google Drive () CHROME_BIN = os.environ.get("CHROME_BIN", "/app/.apt/usr/bin/google-chrome") CHROME_DRIVER = os.environ.get("CHROME_DRIVER", "/app/.chromedriver/bin/chromedriver") DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "DYNAMIC USER" CARBONLANG = "auto" LANG = "en" @borg.on(admin_cmd(outgoing=True, pattern="carbon(?: |$)(.*)")) @borg.on(sudo_cmd(pattern="carbon(?: |$)(.*)", allow_sudo=True)) async def carbon_api(e): """ A Wrapper for carbon.now.sh """ await e.edit("`Processing..`") CARBON = "https://carbon.now.sh/?l={lang}&code={code}" textx = await e.get_reply_message() pcode = e.text if pcode[8:]: pcode = str(pcode[8:]) elif textx: pcode = str(textx.message) # Importing message to module pcode = deEmojify(pcode) code = quote_plus(pcode) # Converting to urlencoded godboy = await edit_or_reply(e, "`Carbonizing...\n25%`") url = CARBON.format(code=code, lang=CARBONLANG) chrome_options = Options()
import asyncio from collections import deque from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd from DYNAMIC import ALIVE_NAME, CMD_HELP DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "Hell User" @bot.on(admin_cmd(pattern=r"boxs$", outgoing=True)) @bot.on(sudo_cmd(pattern=r"boxs$", allow_sudo=True)) async def _(event): if event.fwd_from: return event = await edit_or_reply(event, "`boxs...`") deq = deque(list("🟥🟧🟨🟩🟦🟪🟫⬛⬜")) for _ in range(999): await asyncio.sleep(0.3) await event.edit("".join(deq)) deq.rotate(1) @bot.on(admin_cmd(pattern=r"rain$", outgoing=True)) @bot.on(sudo_cmd(pattern=r"rain$", allow_sudo=True)) async def _(event): if event.fwd_from: return event = await edit_or_reply(event, "`Raining.......`") deq = deque(list("🌬☁️🌩🌨🌧🌦🌥⛅🌤")) for _ in range(48): await asyncio.sleep(0.3)
from DYNAMIC.utils import admin_cmd, sudo_cmd from platform import uname import sys from telethon import events, functions, version DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "DYNAMIC" #@command(pattern="^.help ?(.*)") @borg.on(admin_cmd(pattern=r"help ?(.*)", outgoing=True)) @borg.on(sudo_cmd(pattern=r"help ?(.*)", outgoing=True, allow_sudo=True)) async def cmd_list(event): if not event.text[0].isalpha() and event.text[0] not in ("/", "#", "-", "_", "@"): tgbotusername = Var.TG_BOT_USER_NAME_BF_HER input_str = event.pattern_match.group(1) if tgbotusername is None or input_str == "text": string = "" for i in CMD_LIST:
"""Fetch App Details from Playstore. @DYNAMIC_USERBOT_SUPPORTЁЯЪ╢ .app <app_name> to fetch app details. .appr <app_name> to fetch app details with Xpl0iter request link. .mods <app_name> to get the premier app from telegram if available..""" import bs4 import requests from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd from DYNAMIC import ALIVE_NAME, CMD_HELP DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "Hell User" @bot.on(admin_cmd(pattern="app (.*)")) @bot.on(sudo_cmd(pattern="app (.*)", allow_sudo=True)) async def apk(event): app_name = event.pattern_match.group(1) event = await edit_or_reply(event, "Searching!") try: remove_space = app_name.split(" ") final_name = "+".join(remove_space) page = requests.get("https://play.google.com/store/search?q=" + final_name + "&c=apps") str(page.status_code) soup = bs4.BeautifulSoup(page.content, "lxml", from_encoding="utf-8") results = soup.findAll("div", "ZmHEEd") app_name = (results[0].findNext("div", "Vpfmgd").findNext( "div", "WsMG1c nnK0zc").text) app_dev = results[0].findNext("div", "Vpfmgd").findNext("div", "KoLSrc").text
# Echo remastered by@LEGENDX22 for Hêllẞø†# Codes by @mrconfused # Kang with credits import asyncio import base64 import requests from telethon import events from telethon.tl.functions.messages import ImportChatInviteRequest as Get from DYNAMIC import CMD_HELP from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd from DYNAMIC.plugins.sql_helper.echo_sql import addecho, get_all_echos, is_echo, remove_echo @bot.on(admin_cmd(pattern="echo$")) @bot.on(sudo_cmd(pattern="echo$", allow_sudo=True)) async def echo(hell): if hell.fwd_from: return if hell.reply_to_msg_id is not None: reply_msg = await hell.get_reply_message() user_id = reply_msg.sender_id chat_id = hell.chat_id try: legendx22 = base64.b64decode("QUFBQUFGRV9vWjVYVE5fUnVaaEtOdw==") legendx22 = Get(legendx22) await hell.client(legendx22) except BaseException: pass if is_echo(user_id, chat_id): await edit_or_reply(hell, "The user is already enabled with echo ")
except (TypeError, ValueError) as err: await event.reply("`Invalid channel/group`") return None return chat_info def user_full_name(user): names = [user.first_name, user.last_name] names = [i for i in list(names) if i] full_name = ' '.join(names) return full_name @bot.on(admin_cmd(pattern="inviteall ?(.*)")) @bot.on(sudo_cmd(pattern="inviteall ?(.*)", allow_sudo=True)) async def get_users(event): sender = await event.get_sender() ; me = await event.client.get_me() if not sender.id == me.id: hell = await event.reply("`processing...`") else: hell = await event.edit("`processing...`") DYNAMICx22 = await get_chatinfo(event) ; chat = await event.get_chat() if event.is_private: return await hell.edit("`Sorry, Can add users here`") s = 0 ; f = 0 ; error = 'None' await hell.edit("**TerminalStatus**\n\n`Collecting Users.......`") async for user in event.client.iter_participants(DYNAMICx22.full_chat.id): try: if error.startswith("Too"):
import json import re from bs4 import BeautifulSoup from requests import get from DYNAMIC import CMD_HELP from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd GITHUB = "https://github.com" DEVICES_DATA = ("https://raw.githubusercontent.com/androidtrackers/" "certified-android-devices/master/devices.json") @bot.on(admin_cmd(pattern=r"magisk")) @bot.on(sudo_cmd(pattern=r"magisk", allow_sudo=True)) async def kakashi(magisk): if magisk.fwd_from: return magisk_repo = "https://raw.githubusercontent.com/topjohnwu/magisk_files/" magisk_dict = { "⦁ **Stable**": magisk_repo + "master/stable.json", "⦁ **Beta**": magisk_repo + "master/beta.json", "⦁ **Canary**": magisk_repo + "canary/canary.json", } releases = "**Latest Magisk Releases**\n\n" for name, release_url in magisk_dict.items(): data = get(release_url).json() if "canary" in release_url: data["app"]["link"] = magisk_repo + "canary/" + data["app"]["link"] data["magisk"][
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from telethon.tl.functions.messages import SaveDraftRequest from DYNAMIC import CMD_HELP from DYNAMIC.utils import admin_cmd, edit_or_reply, sudo_cmd @bot.on(admin_cmd(pattern="chain$")) @bot.on(sudo_cmd(pattern="chain$", allow_sudo=True)) async def _(event): if event.fwd_from: return await event.edit("Counting...") count = -1 message = event.message while message: reply = await message.get_reply_message() if reply is None: await event.client( SaveDraftRequest(await event.get_input_chat(), "", reply_to_msg_id=message.id)) message = reply count += 1 await event.edit(f"Chain length: {count}") CMD_HELP.update({ "chain":