async def exec(self, event): args, count = parse_arguments(event.pattern_match.group(1), ['silent', 'me']) from_user = '******' if args.get('me') else None reply_message = await event.message.get_reply_message() chat = await event.get_input_chat() messages = [] # Delete the command message await event.delete() if reply_message: # If a message was replied to we'll delete all messages since that one async for msg in bot.iter_messages(chat, min_id=reply_message.id, from_user=from_user): messages.append(msg) messages.append(reply_message) else: # Otherwise we'll purge the last N messages, where N is `count` count = int(count) async for msg in bot.iter_messages(chat, from_user=from_user): if len(messages) >= count: break messages.append(msg) if len(messages) > 0: await bot.delete_messages(chat, messages) if not args.get('silent'): await event.respond(f"Purged {len(messages)} messages")
async def fastpurger(e): if not e.text[0].isalpha() and e.text[0] != "!" and e.text[ 0] != "/" and e.text[0] != "#" and e.text[0] != "@": chat = await e.get_input_chat() msgs = [] count = 0 async with aclosing(bot.iter_messages(chat, min_id=e.reply_to_msg_id)) as h: async for m in h: msgs.append(m) count = count + 1 if len(msgs) == 100: await bot.delete_messages(chat, msgs) msgs = [] if msgs: await bot.delete_messages(chat, msgs) await bot.send_message( e.chat_id, "`Fast purge complete!\n`Purged " + str(count) + " messages. **This auto-generated message shall be self destructed in 2 seconds.**" ) if LOGGER: await bot.send_message( LOGGER_GROUP, "Purge of " + str(count) + " messages done successfully.") time.sleep(2) i = 1 async for message in bot.iter_messages(e.chat_id, from_user='******'): if i > 1: break i = i + 1 await message.delete()
async def not_afk(e): if not e.text[0].isalpha(): global ISAFK global COUNT_MSG global USERS global AFKREASON ISAFK = False await e.edit("Oke master has arrived") await e.respond( "`You recieved " + str(COUNT_MSG) + " messages while you were away. Check log for more details. This auto-generated message shall be self destructed in 2 seconds.`" ) time.sleep(2) i = 1 async for message in bot.iter_messages(e.chat_id, from_user='******'): if i > 1: break i = i + 1 await message.delete() if LOGGER: await bot.send_message( LOGGER_GROUP, "You\'ve recieved " + str(COUNT_MSG) + " messages from " + str(len(USERS)) + " chats while you were away") for i in USERS: name = await bot.get_entity(i) name0 = str(name.first_name) await bot.send_message( LOGGER_GROUP, '[' + name0 + '](tg://user?id=' + str(i) + ')' + " sent you " + "`" + str(USERS[i]) + " messages`") COUNT_MSG = 0 USERS = {} AFKREASON = "No Reason"
async def fastpurger(e): if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"): chat = await e.get_input_chat() msgs = [] count = 0 async with aclosing(bot.iter_messages(chat, min_id=e.reply_to_msg_id)) as h: async for m in h: msgs.append(m) count = count + 1 msgs.append(e.reply_to_msg_id) if len(msgs) == 100: await bot.delete_messages(chat, msgs) msgs = [] if msgs: await bot.delete_messages(chat, msgs) r = await bot.send_message( e.chat_id, "`Fast purge complete!\n`Purged " + str(count) + " messages. **This auto-generated message shall be self destructed in 2 seconds.**", ) if LOGGER: await bot.send_message( LOGGER_GROUP, "Purge of " + str(count) + " messages done successfully.") time.sleep(2) await r.delete()
async def _(event): if event.fwd_from: return if event.reply_to_msg_id: i = 1 msgs = [] from_user = None input_str = event.pattern_match.group(1) if input_str: from_user = await bot.get_entity(input_str) logger.info(from_user) async for message in bot.iter_messages( event.chat_id, min_id=event.reply_to_msg_id, from_user=from_user ): i = i + 1 msgs.append(message) if len(msgs) == 100: await bot.delete_messages(event.chat_id, msgs, revoke=True) msgs = [] if len(msgs) <= 100: await bot.delete_messages(event.chat_id, msgs, revoke=True) msgs = [] await event.delete() else: await event.edit("**PURGE** Failed!")
async def purgeme(delme): if not delme.text[0].isalpha() and delme.text[0] not in ("/", "#", "@", "!"): message = delme.text chat = await delme.get_input_chat() self_id = await bot.get_peer_id('me') count = int(message[9:]) i = 1 async for message in bot.iter_messages(chat, self_id): if i > count + 1: break i = i + 1 await message.delete() smsg = await bot.send_message( delme.chat_id, "`Purge complete!` Purged " + str(count) + " messages. **This auto-generated message shall be self destructed in 2 seconds.**", ) if LOGGER: await bot.send_message( LOGGER_GROUP, "Purge of " + str(count) + " messages done successfully.") time.sleep(2) i = 1 await smsg.delete()
async def delmsg(e): if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"): i = 1 async for message in bot.iter_messages(e.chat_id, from_user="******"): if i > 2: break i = i + 1 await message.delete()
async def get_target_message(event): me = await bot.get_me() if event.is_reply and (await event.get_reply_message()).sender_id == me.id: return await event.get_reply_message() async for message in bot.iter_messages(await event.get_input_chat(), limit=20): if message.out: return message
async def delmsg(e): if not e.text[0].isalpha() and e.text[0] != "!" and e.text[ 0] != "/" and e.text[0] != "#" and e.text[0] != "@": i = 1 async for message in bot.iter_messages(e.chat_id, from_user='******'): if i > 2: break i = i + 1 await message.delete()
async def welcome_mute(welcm): if welcm.user_joined or welcm.user_added: from asyncio import sleep await sleep(5) if not WELCOME_MUTE: return async for message in bot.iter_messages( welcm.chat_id, from_user=welcm.action_message.from_id): global Spambot user = await welcm.client.get_entity(welcm.action_message.from_id) print(message.text) if "http://" in message.text: Spambot = True elif "t.me" in message.text: Spambot = True elif message.fwd_from: Spambot = True elif "https://" in message.text: Spambot = True else: if user.first_name in ("Bitmex", "Promotion", "Information", "Dex"): if user.last_name == "Bot": Spambot = True break if Spambot: await welcm.reply( "`Potential SpamBot Detected! Kicking away! Will log the ID for further purposes!`" ) chat = await welcm.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: await welcm.reply( "@admins \n`ANTI SPAMBOT DETECTOR! \nTHIS USER MATCHES MY ALGORITHMS AS A SPAMBOT!`" ) return try: await welcm.client( EditBannedRequest(welcm.chat_id, welcm.action_message.from_id, BANNED_RIGHTS)) await welcm.client( EditBannedRequest(welcm.chat_id, welcm.action_message.from_id, UNBAN_RIGHTS)) except: await welcm.reply( "@admins \n`ANTI SPAMBOT DETECTOR! \nTHIS USER MATCHES MY ALGORITHMS AS A SPAMBOT!`" ) return await message.delete() await welcm.client.send_message( LOGGER_GROUP, "#SPAMBOT-KICK\n" f"USER: [{user.first_name}](tg://user?id={welcm.action_message.from_id})\n" f"CHAT: {welcm.chat.title}(`{welcm.chat_id}`)")
async def editer(e): if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"): message = e.text string = str(message[8:]) i = 1 async for message in bot.iter_messages(e.chat_id, from_user="******"): if i == 2: await message.edit(string) await e.delete() break i = i + 1 if LOGGER: await bot.send_message(LOGGER_GROUP, "Edit query was executed successfully")
async def _(event): await event.delete() text = event.pattern_match.group(1) destination = await event.get_input_chat() for c in text.lower(): if c not in string.ascii_lowercase: continue if c not in msg_cache: async for msg in bot.iter_messages(None, search=c): if msg.raw_text.lower() == c and msg.media is None: msg_cache[c] = msg break await bot.forward_messages(destination, msg_cache[c])
async def purgeme(e): message = e.text count = int(message[9:]) i = 1 async for message in bot.iter_messages(e.chat_id, from_user='******'): if i > count + 1: break i = i + 1 await message.delete() await bot.send_message( e.chat_id, "`Purge complete!` Purged " + str(count) + " messages. **This auto-generated message shall be self destructed in 2 seconds.**" ) if LOGGER: await bot.send_message( LOGGER_GROUP, "Purge of " + str(count) + " messages done successfully.") time.sleep(2) i = 1 async for message in bot.iter_messages(e.chat_id, from_user='******'): if i > 1: break i = i + 1 await message.delete()
async def editer(edit): if not edit.text[0].isalpha() and edit.text[0] not in ("/", "#", "@", "!"): message = edit.text chat = await edit.get_input_chat() self_id = await bot.get_peer_id('me') string = str(message[8:]) i = 1 async for message in bot.iter_messages(chat, self_id): if i == 2: await message.edit(string) await edit.delete() break i = i + 1 if LOGGER: await bot.send_message(LOGGER_GROUP, "Edit query was executed successfully")
async def selfdestruct(e): if not e.text[0].isalpha() and e.text[0] != "!" and e.text[ 0] != "/" and e.text[0] != "#" and e.text[0] != "@": message = e.text counter = int(message[4:6]) text = str(e.text[6:]) text = text + "`This message shall be self-destructed in " + str( counter) + " seconds`" await e.delete() await bot.send_message(e.chat_id, text) time.sleep(counter) i = 1 async for message in bot.iter_messages(e.chat_id, from_user='******'): if i > 1: break i = i + 1 await message.delete() if LOGGER: await bot.send_message(LOGGER_GROUP, "sd query done successfully")
async def get_media(event): # chat = -1001285905728 chat = await event.client.get_entity('t.me/joinchat/AAAAAEylXUB6ztFxdgHp1w' ) mesajlar = [] print("kanaldan rastgele mesaj seçiliyor.") await event.edit("kanaldan rastgele link seçiliyor.") async for message in bot.iter_messages(chat): mesajlar.append(message.id) secim = int(random.choice(mesajlar)) # print(secim) x = await bot.forward_messages( entity=await event.client.get_entity('https://t.me/deryaaq#1'), messages=secim, from_peer=await event.client.get_entity('https://t.me/deryaaq#1'), ) await event.edit( "kanala başarılı bir şekilde link gönderildi. Kontrol etmek için 👇\n https://t.me/deryaaq#1" )
async def welcome_mute(welcm): ''' Ban a recently joined user if it matches the spammer checking algorithm.''' try: if not WELCOME_MUTE: return if welcm.user_joined or welcm.user_added: adder = None ignore = None spambot = False users = None if welcm.user_added: ignore = False adder = welcm.action_message.from_id async for admin in bot.iter_participants( welcm.chat_id, filter=ChannelParticipantsAdmins): if admin.id == adder: ignore = True break if ignore: return if welcm.user_joined: users_list = hasattr(welcm.action_message.action, "users") if users_list: users = welcm.action_message.action.users else: users = [welcm.action_message.from_id] await sleep(5) for user_id in users: async for message in bot.iter_messages(welcm.chat_id, from_user=user_id): correct_type = isinstance(message, Message) if not message or not correct_type: break join_time = welcm.action_message.date message_date = message.date if message_date < join_time: continue # The message was sent before the user joined, thus ignore it if CONSOLE_LOGGER_VERBOSE: print(f"User Joined: {join_time}") print(f"Message Sent: {message_date}") user = await welcm.client.get_entity(user_id) if "http://" in message.text: spambot = True elif "t.me" in message.text: spambot = True elif message.fwd_from: spambot = True elif "https://" in message.text: spambot = True else: if user.first_name in ("Bitmex", "Promotion", "Information", "Dex", "Announcements", "Info"): if user.last_name == "Bot": spambot = True if spambot: print(f"Potential Spam Message: {message.text}") await message.delete() break continue # Check the next messsage if spambot: chat = await welcm.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: return await welcm.reply( "`Potential Spambot Detected! Kicking away! " "Will log the ID for further purposes!\n" f"USER:` [{user.first_name}](tg://user?id={user.id})" ) await welcm.client.kick_participant(welcm.chat_id, user.id) if BOTLOG: await welcm.client.send_message( BOTLOG_CHATID, "#SPAMBOT-KICK\n" f"USER: [{user.first_name}](tg://user?id={user.id})\n" f"CHAT: {welcm.chat.title}(`{welcm.chat_id}`)") except ValueError: pass
async def welcome_mute(welcm): ''' Ban a recently joined user if it matches the spammer checking algorithm. ''' ignore = False if not WELCOME_MUTE: return if welcm.user_joined or welcm.user_added: if welcm.user_added: async for admin in bot.iter_participants( welcm.chat_id, filter=ChannelParticipantsAdmins): adder = welcm.action_message.from_id if admin.id is adder: ignore = True break if ignore: return if welcm.user_joined: users_list = hasattr(welcm.action_message.action, "users") if users_list: users = welcm.action_message.action.users else: users = [welcm.action_message.from_id] await sleep(5) spambot = False for user_id in users: async for message in bot.iter_messages(welcm.chat_id, from_user=user_id): correct_type = isinstance(message, Message) if not message or not correct_type: break join_time = welcm.action_message.date message_date = message.date # The message was sent before the user joined, thus ignore it if message_date < join_time: continue # DEBUGGING. LEAVING IT HERE FOR SOME TIME ### print(f"User Joined: {join_time}") print(f"Message Sent: {message_date}") # user = await welcm.client.get_entity(user_id) #if "http://" in message.text: if re.search( r"((?<=[^a-zA-Z0-9])*(?:https\:\/\/|[a-zA-Z0-9]{1,}\.{1}|\b)(?:\w{1,}\.{1}){1,5}(?:aaa|aarp|abarth|abb|abbott|abbvie|abc|able|abogado|abudhabi|ac|academy|accenture|accountant|accountants|aco|active|actor|ad|adac|ads|adult|ae|aeg|aero|aetna|af|afamilycompany|afl|africa|ag|agakhan|agency|ai|aig|aigo|airbus|airforce|airtel|akdn|al|alfaromeo|alibaba|alipay|allfinanz|allstate|ally|alsace|alstom|am|americanexpress|americanfamily|amex|amfam|amica|amsterdam|analytics|android|anquan|anz|ao|aol|apartments|app|apple|aq|aquarelle|ar|arab|aramco|archi|army|arpa|art|arte|as|asda|asia|associates|at|athleta|attorney|au|auction|audi|audible|audio|auspost|author|auto|autos|avianca|aw|aws|ax|axa|az|azure|ba|baby|baidu|banamex|bananarepublic|band|bank|bar|barcelona|barclaycard|barclays|barefoot|bargains|baseball|basketball|bauhaus|bayern|bb|bbc|bbt|bbva|bcg|bcn|bd|be|beats|beauty|beer|bentley|berlin|best|bestbuy|bet|bf|bg|bh|bharti|bi|bible|bid|bike|bing|bingo|bio|biz|bj|black|blackfriday|blanco|blockbuster|blog|bloomberg|blue|bm|bms|bmw|bn|bnl|bnpparibas|bo|boats|boehringer|bofa|bom|bond|boo|book|booking|boots|bosch|bostik|boston|bot|boutique|box|br|bradesco|bridgestone|broadway|broker|brother|brussels|bs|bt|budapest|bugatti|build|builders|business|buy|buzz|bv|bw|by|bz|bzh|ca|cab|cafe|cal|call|calvinklein|cam|camera|camp|cancerresearch|canon|capetown|capital|capitalone|car|caravan|cards|care|career|careers|cars|cartier|casa|case|caseih|cash|casino|cat|catering|catholic|cba|cbn|cbre|cbs|cc|cd|ceb|center|ceo|cern|cf|cfa|cfd|cg|ch|chanel|channel|chase|chat|cheap|chintai|christmas|chrome|chrysler|church|ci|cipriani|circle|cisco|citadel|citi|citic|city|cityeats|ck|cl|claims|cleaning|click|clinic|clinique|clothing|cloud|club|clubmed|cm|cn|co|coach|codes|coffee|college|cologne|com|comcast|commbank|community|company|compare|computer|comsec|condos|construction|consulting|contact|contractors|cooking|cookingchannel|cool|coop|corsica|country|coupon|coupons|courses|cr|credit|creditcard|creditunion|cricket|crown|crs|cruise|cruises|csc|cu|cuisinella|cv|cw|cx|cy|cymru|cyou|cz|dabur|dad|dance|data|date|dating|datsun|day|dclk|dds|de|deal|dealer|deals|degree|delivery|dell|deloitte|delta|democrat|dental|dentist|desi|design|dev|dhl|diamonds|diet|digital|direct|directory|discount|discover|dish|diy|dj|dk|dm|dnp|do|docs|doctor|dodge|dog|doha|domains|dot|download|drive|dtv|dubai|duck|dunlop|duns|dupont|durban|dvag|dvr|dz|earth|eat|ec|eco|edeka|edu|education|ee|eg|email|emerck|energy|engineer|engineering|enterprises|epost|epson|equipment|er|ericsson|erni|es|esq|estate|esurance|et|etisalat|eu|eurovision|eus|events|everbank|exchange|expert|exposed|express|extraspace|fage|fail|fairwinds|faith|family|fan|fans|farm|farmers|fashion|fast|fedex|feedback|ferrari|ferrero|fi|fiat|fidelity|fido|film|final|finance|financial|fire|firestone|firmdale|fish|fishing|fit|fitness|fj|fk|flickr|flights|flir|florist|flowers|fly|fm|fo|foo|food|foodnetwork|football|ford|forex|forsale|forum|foundation|fox|fr|free|fresenius|frl|frogans|frontdoor|frontier|ftr|fujitsu|fujixerox|fun|fund|furniture|futbol|fyi|ga|gal|gallery|gallo|gallup|game|games|gap|garden|gb|gbiz|gd|gdn|ge|gea|gent|genting|george|gf|gg|ggee|gh|gi|gift|gifts|gives|giving|gl|glade|glass|gle|global|globo|gm|gmail|gmbh|gmo|gmx|gn|godaddy|gold|goldpoint|golf|goo|goodhands|goodyear|goog|google|gop|got|gov|gp|gq|gr|grainger|graphics|gratis|green|gripe|grocery|group|gs|gt|gu|guardian|gucci|guge|guide|guitars|guru|gw|gy|hair|hamburg|hangout|haus|hbo|hdfc|hdfcbank|health|healthcare|help|helsinki|here|hermes|hgtv|hiphop|hisamitsu|hitachi|hiv|hk|hkt|hm|hn|hockey|holdings|holiday|homedepot|homegoods|homes|homesense|honda|honeywell|horse|hospital|host|hosting|hot|hoteles|hotels|hotmail|house|how|hr|hsbc|ht|hu|hughes|hyatt|hyundai|ibm|icbc|ice|icu|id|ie|ieee|ifm|ikano|il|im|imamat|imdb|immo|immobilien|in|industries|infiniti|info|ing|ink|institute|insurance|insure|int|intel|international|intuit|investments|io|ipiranga|iq|ir|irish|is|iselect|ismaili|ist|istanbul|it|itau|itv|iveco|iwc|jaguar|java|jcb|jcp|je|jeep|jetzt|jewelry|jio|jlc|jll|jm|jmp|jnj|jo|jobs|joburg|jot|joy|jp|jpmorgan|jprs|juegos|juniper|kaufen|kddi|ke|kerryhotels|kerrylogistics|kerryproperties|kfh|kg|kh|ki|kia|kim|kinder|kindle|kitchen|kiwi|km|kn|koeln|komatsu|kosher|kp|kpmg|kpn|kr|krd|kred|kuokgroup|kw|ky|kyoto|kz|la|lacaixa|ladbrokes|lamborghini|lamer|lancaster|lancia|lancome|land|landrover|lanxess|lasalle|lat|latino|latrobe|law|lawyer|lb|lc|lds|lease|leclerc|lefrak|legal|lego|lexus|lgbt|li|liaison|lidl|life|lifeinsurance|lifestyle|lighting|like|lilly|limited|limo|lincoln|linde|link|lipsy|live|living|lixil|lk|llc|loan|loans|locker|locus|loft|lol|london|lotte|lotto|love|lpl|lplfinancial|lr|ls|lt|ltd|ltda|lu|lundbeck|lupin|luxe|luxury|lv|ly|ma|macys|madrid|maif|maison|makeup|man|management|mango|map|market|marketing|markets|marriott|marshalls|maserati|mattel|mba|mc|mckinsey|md|me|med|media|meet|melbourne|meme|memorial|men|menu|meo|merckmsd|metlife|mg|mh|miami|microsoft|mil|mini|mint|mit|mitsubishi|mk|ml|mlb|mls|mm|mma|mn|mo|mobi|mobile|mobily|moda|moe|moi|mom|monash|money|monster|mopar|mormon|mortgage|moscow|moto|motorcycles|mov|movie|movistar|mp|mq|mr|ms|msd|mt|mtn|mtr|mu|museum|mutual|mv|mw|mx|my|mz|na|nab|nadex|nagoya|name|nationwide|natura|navy|nba|nc|ne|nec|net|netbank|netflix|network|neustar|new|newholland|news|next|nextdirect|nexus|nf|nfl|ng|ngo|nhk|ni|nico|nike|nikon|ninja|nissan|nissay|nl|no|nokia|northwesternmutual|norton|now|nowruz|nowtv|np|nr|nra|nrw|ntt|nu|nyc|nz|obi|observer|off|office|okinawa|olayan|olayangroup|oldnavy|ollo|om|omega|one|ong|onl|online|onyourside|ooo|open|oracle|orange|org|organic|origins|osaka|otsuka|ott|ovh|pa|page|panasonic|panerai|paris|pars|partners|parts|party|passagens|pay|pccw|pe|pet|pf|pfizer|pg|ph|pharmacy|phd|philips|phone|photo|photography|photos|physio|piaget|pics|pictet|pictures|pid|pin|ping|pink|pioneer|pizza|pk|pl|place|play|playstation|plumbing|plus|pm|pn|pnc|pohl|poker|politie|p**n|post|pr|pramerica|praxi|press|prime|pro|prod|productions|prof|progressive|promo|properties|property|protection|pru|prudential|ps|pt|pub|pw|pwc|py|qa|qpon|quebec|quest|qvc|racing|radio|raid|re|read|realestate|realtor|realty|recipes|red|redstone|redumbrella|rehab|reise|reisen|reit|reliance|ren|rent|rentals|repair|report|republican|rest|restaurant|review|reviews|rexroth|rich|richardli|ricoh|rightathome|ril|rio|rip|rmit|ro|rocher|rocks|rodeo|rogers|room|rs|rsvp|ru|rugby|ruhr|run|rw|rwe|ryukyu|sa|saarland|safe|safety|sakura|sale|salon|samsclub|samsung|sandvik|sandvikcoromant|sanofi|sap|sapo|sarl|sas|save|saxo|sb|sbi|sbs|sc|sca|scb|schaeffler|schmidt|scholarships|school|schule|schwarz|science|scjohnson|scor|scot|sd|se|search|seat|secure|security|seek|select|sener|services|ses|seven|sew|sex|sexy|sfr|sg|sh|shangrila|sharp|shaw|shell|shia|shiksha|shoes|shop|shopping|shouji|show|showtime|shriram|si|silk|sina|singles|site|sj|sk|ski|skin|sky|skype|sl|sling|sm|smart|smile|sn|sncf|so|soccer|social|softbank|software|sohu|solar|solutions|song|sony|soy|space|spiegel|sport|spot|spreadbetting|sr|srl|srt|st|stada|staples|star|starhub|statebank|statefarm|statoil|stc|stcgroup|stockholm|storage|store|stream|studio|study|style|su|sucks|supplies|supply|support|surf|surgery|suzuki|sv|swatch|swiftcover|swiss|sx|sy|sydney|symantec|systems|sz|tab|taipei|talk|taobao|target|tatamotors|tatar|tattoo|tax|taxi|tc|tci|td|tdk|team|tech|technology|tel|telecity|telefonica|temasek|tennis|teva|tf|tg|th|thd|theater|theatre|tiaa|tickets|tienda|tiffany|tips|tires|tirol|tj|tjmaxx|tjx|tk|tkmaxx|tl|tm|tmall|tn|to|today|tokyo|tools|top|toray|toshiba|total|tours|town|toyota|toys|tr|trade|trading|training|travel|travelchannel|travelers|travelersinsurance|trust|trv|tt|tube|tui|tunes|tushu|tv|tvs|tw|tz|ua|ubank|ubs|uconnect|ug|uk|unicom|university|uno|uol|ups|us|uy|uz|va|vacations|vana|vanguard|vc|ve|vegas|ventures|verisign|versicherung|vet|vg|vi|viajes|video|vig|viking|villas|vin|vip|virgin|visa|vision|vista|vistaprint|viva|vivo|vlaanderen|vn|vodka|volkswagen|volvo|vote|voting|voto|voyage|vu|vuelos|wales|walmart|walter|wang|wanggou|warman|watch|watches|weather|weatherchannel|webcam|weber|website|wed|wedding|weibo|weir|wf|whoswho|wien|wiki|williamhill|win|windows|wine|winners|wme|wolterskluwer|woodside|work|works|world|wow|ws|wtc|wtf|xbox|xerox|xfinity|xihuan|xin|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--30rr7y|xn--3bst00m|xn--3ds443g|xn--3e0b707e|xn--3hcrj9c|xn--3oq18vl8pn36a|xn--3pxu8k|xn--42c2d9a|xn--45br5cyl|xn--45brj9c|xn--45q11c|xn--4gbrim|xn--54b7fta0cc|xn--55qw42g|xn--55qx5d|xn--5su34j936bgsg|xn--5tzm5g|xn--6frz82g|xn--6qq986b3xl|xn--80adxhks|xn--80ao21a|xn--80aqecdr1a|xn--80asehdb|xn--80aswg|xn--8y0a063a|xn--90a3ac|xn--90ae|xn--90ais|xn--9dbq2a|xn--9et52u|xn--9krt00a|xn--b4w605ferd|xn--bck1b9a5dre4c|xn--c1avg|xn--c2br7g|xn--cck2b3b|xn--cg4bki|xn--clchc0ea0b2g2a9gcd|xn--czr694b|xn--czrs0t|xn--czru2d|xn--d1acj3b|xn--d1alf|xn--e1a4c|xn--eckvdtc9d|xn--efvy88h|xn--estv75g|xn--fct429k|xn--fhbei|xn--fiq228c5hs|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--fjq720a|xn--flw351e|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--fzys8d69uvgm|xn--g2xx48c|xn--gckr3f0f|xn--gecrj9c|xn--gk3at1e|xn--h2breg3eve|xn--h2brj9c|xn--h2brj9c8c|xn--hxt814e|xn--i1b6b1a6a2e|xn--imr513n|xn--io0a7i|xn--j1aef|xn--j1amh|xn--j6w193g|xn--jlq61u9w7b|xn--jvr189m|xn--kcrx77d1x4a|xn--kprw13d|xn--kpry57d|xn--kpu716f|xn--kput3i|xn--l1acc|xn--lgbbat1ad8j|xn--mgb9awbf|xn--mgba3a3ejt|xn--mgba3a4f16a|xn--mgba7c0bbn0a|xn--mgbaakc7dvf|xn--mgbaam7a8h|xn--mgbab2bd|xn--mgbai9azgqp6j|xn--mgbayh7gpa|xn--mgbb9fbpob|xn--mgbbh1a|xn--mgbbh1a71e|xn--mgbc0a9azcg|xn--mgbca7dzdo|xn--mgberp4a5d4ar|xn--mgbgu82a|xn--mgbi4ecexp|xn--mgbpl2fh|xn--mgbt3dhd|xn--mgbtx2b|xn--mgbx4cd0ab|xn--mix891f|xn--mk1bu44c|xn--mxtq1m|xn--ngbc5azd|xn--ngbe9e0a|xn--ngbrx|xn--node|xn--nqv7f|xn--nqv7fs00ema|xn--nyqy26a|xn--o3cw4h|xn--ogbpf8fl|xn--otu796d|xn--p1acf|xn--p1ai|xn--pbt977c|xn--pgbs0dh|xn--pssy2u|xn--q9jyb4c|xn--qcka1pmc|xn--qxam|xn--rhqv96g|xn--rovu88b|xn--rvc1e0am3e|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--tckwe|xn--tiq49xqyj|xn--unup4y|xn--vermgensberater-ctb|xn--vermgensberatung-pwb|xn--vhquv|xn--vuq861b|xn--w4r85el8fhu5dnra|xn--w4rs40l|xn--wgbh1c|xn--wgbl6a|xn--xhq521b|xn--xkc2al3hye2a|xn--xkc2dl3a5ee0h|xn--y9a3aq|xn--yfro4i67o|xn--ygbi2ammx|xn--zfr164b|xperia|xxx|xyz|yachts|yahoo|yamaxun|yandex|ye|yodobashi|yoga|yokohama|you|youtube|yt|yun|za|zappos|zara|zero|zip|zippo|zm|zone|zuerich|zw)\b/?(?!@))", message.text): spambot = True elif re.search(r"/t.me\/bitcoin/g", message.text): spambot = True #elif re.search(r"/t.me\/bitcoin/g", message.text): #spambot = True #elif re.search(r"/t.me\/bitcoin/g", message.text): #spambot = True else: if user.first_name in ("Bitmex", "Promotion", "Information", "Dex", "Announcements", "Info"): if user.last_name == "Bot": spambot = True if spambot: print(f"Potential Spam/Scam Message: {message.text}") await message.delete() break continue # Check the next messsage if spambot: await welcm.reply( "`Potential Spam bot Detected! Kicking away! " "Will log the ID for further purposes!\n" f"USER:` [{user.first_name}](tg://user?id={user.id})") chat = await welcm.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: await welcm.reply( "@admins\n" "`ANTI SPAM BOT DETECTOR!\n" "THIS USER MATCHES MY ALGORITHMS AS A SPAM BOT!`") else: try: await welcm.client( EditBannedRequest(welcm.chat_id, user.id, BANNED_RIGHTS)) await sleep(1) await welcm.client( EditBannedRequest(welcm.chat_id, user.id, UNBAN_RIGHTS)) except: await welcm.reply( "@admins\n" "`ANTI SPAM BOT DETECTOR!\n" "THIS USER MATCHES MY ALGORITHMS AS A SPAM BOT!`") if BOTLOG: await welcm.client.send_message( BOTLOG_CHATID, "#SPAMBOT-KICK\n" f"USER: [{user.first_name}](tg://user?id={user.id})\n" f"CHAT: {welcm.chat.title}(`{welcm.chat_id}`)")
async def ANTI_SPAMBOTS(welcm): """Ban a recently joined user if it matches the spammer checking algorithm.""" try: if not ANTI_SPAMBOT: return if welcm.user_joined or welcm.user_added: adder = None ignore = False users = None if welcm.user_added: ignore = False try: adder = welcm.action_message.from_id except AttributeError: return async for admin in bot.iter_participants( welcm.chat_id, filter=ChannelParticipantsAdmins): if admin.id == adder: ignore = True break if ignore: return elif welcm.user_joined: users_list = hasattr(welcm.action_message.action, "users") if users_list: users = welcm.action_message.action.users else: users = [welcm.action_message.from_id] await sleep(5) spambot = False if not users: return for user_id in users: async for message in bot.iter_messages(welcm.chat_id, from_user=user_id): correct_type = isinstance(message, Message) if not message or not correct_type: break join_time = welcm.action_message.date message_date = message.date if message_date < join_time: continue # The message was sent before the user joined, thus ignore it check_user = await welcm.client.get_entity(user_id) # DEBUGGING. LEAVING IT HERE FOR SOME TIME ### print( f"User Joined: {check_user.first_name} [ID: {check_user.id}]" ) print(f"Chat: {welcm.chat.title}") print(f"Time: {join_time}") print( f"Message Sent: {message.text}\n\n[Time: {message_date}]" ) ############################################## try: # https://t.me/combotnews/283 cas_url = f"https://api.cas.chat/check?user_id={check_user.id}" r = get(cas_url, timeout=3) data = r.json() except BaseException: print( "Falha na verificação de CAS, voltando ao comportamento anti_spambot legado." ) data = None if data and data["ok"]: reason = f"[Banido por Combot Anti Spam](https://cas.chat/query?u={check_user.id})" spambot = True elif "t.cn/" in message.text: reason = "Corresponde em `t.cn` URLs" spambot = True elif "t.me/joinchat" in message.text: reason = "Mensagem de promoção em potencial" spambot = True elif message.fwd_from: reason = "Mensagem encaminhada" spambot = True elif "?start=" in message.text: reason = "Telegram bot `start` link" spambot = True elif "bit.ly/" in message.text: reason = "Corresponde em `bit.ly` URLs" spambot = True else: if check_user.first_name in ( "Bitmex", "Promotion", "Information", "Dex", "Announcements", "Info", ): if users.last_name == "Bot": reason = "Spambot conhecido" spambot = True if spambot: print(f"Potential Spam Message: {message.text}") await message.delete() break continue # Check the next messsage if spambot: chat = await welcm.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT DETECTOR!\n" "ESTE USUÁRIO CORRESPONDE A MEUS ALGORITMOS COMO UM SPAMBOT!`" f"RAZÃO: {reason}") kicked = False reported = True else: try: await welcm.reply( "`Potencial Spambot Detectado !!`\n" f"`RAZÃO:` {reason}\n" "Expulsando por agora, registrarei a ID caso necessário.\n" f"`USUÁRIO:` [{check_user.first_name}](tg://user?id={check_user.id})" ) await welcm.client.kick_participant( welcm.chat_id, check_user.id) kicked = True reported = False except BaseException: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT DETECTOR!\n" "ESTE USUÁRIO CORRESPONDE A MEUS ALGORITMOS COMO UM SPAMBOT!`" f"RAZÃO: {reason}") kicked = False reported = True if BOTLOG: if kicked or reported: await welcm.client.send_message( BOTLOG_CHATID, "#ANTI_SPAMBOT REPORT\n" f"USUÁRIO: [{check_user.first_name}](tg://user?id={check_user.id})\n" f"USUÁRIO ID: `{check_user.id}`\n" f"CHAT: {welcm.chat.title}\n" f"CHAT ID: `{welcm.chat_id}`\n" f"RAZÃO: {reason}\n" f"MENSAGEM:\n\n{message.text}", ) except ValueError: pass
async def anti_spambot(welcm): try: ''' AntiSpam ''' if not ANTI_SPAMBOT: return if welcm.user_joined or welcm.user_added: adder = None ignore = False users = None if welcm.user_added: ignore = False try: adder = welcm.action_message.from_id except AttributeError: return async for admin in bot.iter_participants( welcm.chat_id, filter=ChannelParticipantsAdmins): if admin.id == adder: ignore = True break if ignore: return elif welcm.user_joined: users_list = hasattr(welcm.action_message.action, "users") if users_list: users = welcm.action_message.action.users else: users = [welcm.action_message.from_id] await sleep(5) spambot = False if not users: return for user_id in users: async for message in bot.iter_messages(welcm.chat_id, from_user=user_id): correct_type = isinstance(message, Message) if not message or not correct_type: break join_time = welcm.action_message.date message_date = message.date if message_date < join_time: # continue check_user = await welcm.client.get_entity(user_id) # . ### print( f"Qatılan istifadəçi: {check_user.first_name} [ID: {check_user.id}]" ) print(f"Söhbət: {welcm.chat.title}") print(f"Zaman: {join_time}") print( f"Göndərdiyi mesaj: {message.text}\n\n[Zaman: {message_date}]" ) ############################################## try: cas_url = f"https://combot.org/api/cas/check?user_id={check_user.id}" r = get(cas_url, timeout=3) data = r.json() except BaseException: print( "CAS yoxlanışı uğursuzdur, köhnə anti_spambot yoxlanışına dönülür." ) data = None pass if data and data['ok']: reason = f"[Combot Anti Spam tərəfindən banlandı.](https://combot.org/cas/query?u={check_user.id})" spambot = True elif "t.cn/" in message.text: reason = "`t.cn` URL'ləri görsəndi." spambot = True elif "t.me/joinchat" in message.text: reason = "Potansiyel reklam mesajı" spambot = True elif message.fwd_from: reason = "Başqasından yönləndirilən mesaj" spambot = True elif "?start=" in message.text: reason = "Telegram botu `start` linki" spambot = True elif "bit.ly/" in message.text: reason = "`bit.ly` URL'ləri tapıldı." spambot = True else: if check_user.first_name in ("Bitmex", "Promotion", "Information", "Dex", "Announcements", "Info", "Məlumat", "Məlumat" "Məlumatlandırma", "Məlumatlandırmalar"): if check_user.last_name == "Bot": reason = "BilinƏn SpamBot" spambot = True if spambot: print(f"Potansiyel Spam Mesajı: {message.text}") await message.delete() break continue # if spambot: chat = await welcm.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT TAPILDI!\n" "BU İSTİFADƏÇİ MƏNİM SPAMBOT ALQORİTİMLƏ UYĞUNLAŞIR!`" f"SƏBƏB: {reason}") kicked = False reported = True else: try: await welcm.reply( "`Potansiyel Spambot Tapıldı !!`\n" f"`SƏBƏB:` {reason}\n" "İndilik qrupdan atılır, bu ID irəlidəki vaxtlar üçün qeyd ediləcək.\n" f"`İSTİFADECİ:` [{check_user.first_name}](tg://user?id={check_user.id})" ) await welcm.client.kick_participant( welcm.chat_id, check_user.id) kicked = True reported = False except BaseException: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT TAPILDI!\n" "BU İSTİFADƏÇİ MƏNİM SPAMBOT ALQORİTİMLƏ UYĞUNLAŞIR`" f"SƏBƏB: {reason}") kicked = False reported = True if BOTLOG: if kicked or reported: await welcm.client.send_message( BOTLOG_CHATID, "#ANTI_SPAMBOT SİKAYET\n" f"İSTİFADECİ: [{check_user.first_name}](tg://user?id={check_user.id})\n" f"İstifadəçi IDsi: `{check_user.id}`\n" f"Söhbət: {welcm.chat.title}\n" f"Söhbət IDsi: `{welcm.chat_id}`\n" f"Səbəb: {reason}\n" f"Mesaj:\n\n{message.text}") except ValueError: pass
async def ANTI_SPAMBOTS(welcm): """Ban a recently joined user if it matches the spammer checking algorithm.""" try: if not ANTI_SPAMBOT: return if welcm.user_joined or welcm.user_added: adder = None ignore = False users = None if welcm.user_added: ignore = False try: adder = welcm.action_message.sender_id except AttributeError: return async for admin in bot.iter_participants( welcm.chat_id, filter=ChannelParticipantsAdmins ): if admin.id == adder: ignore = True break if ignore: return if welcm.user_joined: users_list = hasattr(welcm.action_message.action, "users") if users_list: users = welcm.action_message.action.users else: users = [welcm.action_message.sender_id] await sleep(5) spambot = False if not users: return for user_id in users: async for message in bot.iter_messages( welcm.chat_id, from_user=user_id ): correct_type = isinstance(message, Message) if not message or not correct_type: break join_time = welcm.action_message.date message_date = message.date if message_date < join_time: continue # The message was sent before the user joined, thus ignore it check_user = await welcm.client.get_entity(user_id) # DEBUGGING. LEAVING IT HERE FOR SOME TIME ### print(f"Novo usuário: {check_user.first_name} [ID: {check_user.id}]") print(f"Chat: {welcm.chat.title}") print(f"Horário: {join_time}") print(f"Mensagem enviada: {message.text}\n\n[Horário: {message_date}]") ############################################## try: # https://t.me/combotnews/283 cas_url = f"https://api.cas.chat/check?user_id={check_user.id}" r = get(cas_url, timeout=3) data = r.json() except BaseException: print( "Falha na verificação do CAS, voltando a verificação anti_spambot antiga." ) data = None if data and data["ok"]: reason = f"[Banido por Combot Anti Spam](https://cas.chat/query?u={check_user.id})" spambot = True elif "t.cn/" in message.text: reason = "Resultado em `t.cn` URLs" spambot = True elif "t.me/joinchat" in message.text: reason = "Mensagem de promoção em potencial" spambot = True elif message.fwd_from: reason = "Mensagem encaminhada" spambot = True elif "?start=" in message.text: reason = "Telegram bot `start` link" spambot = True elif "bit.ly/" in message.text: reason = "Resultado em `bit.ly` URLs" spambot = True else: if ( check_user.first_name in ( "Bitmex", "Promotion", "Information", "Dex", "Announcements", "Info", ) and users.last_name == "Bot" ): reason = "Spambot verificado" spambot = True if spambot: print(f"Possível mensagem de spam: {message.text}") await message.delete() break continue # Check the next messsage if spambot: chat = await welcm.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "**Detector anti-spambot!\n" "Este usuário foi identificado em meus algoritmos como um spambot!**" f"Motivo: {reason}" ) kicked = False reported = True else: try: await welcm.reply( "**Spambot potencial detectado!**\n" f"**Motivo:** {reason}\n" "Removendo, ID registrado.\n" f"**Usuário:** [{check_user.first_name}](tg://user?id={check_user.id})" ) await welcm.client.kick_participant( welcm.chat_id, check_user.id ) kicked = True reported = False except BaseException: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "**Detector anti-spambot!\n" "Este usuário foi identificado em meus algoritmos como um spambot!**" f"Motivo: {reason}" ) kicked = False reported = True if BOTLOG and (kicked or reported): await welcm.client.send_message( BOTLOG_CHATID, "#ANTI_SPAMBOT REPORT\n" f"USUÁRIO: [{check_user.first_name}](tg://user?id={check_user.id})\n" f"ID: `{check_user.id}`\n" f"CHAT: {welcm.chat.title}\n" f"CHAT ID: `{welcm.chat_id}`\n" f"MOTIVO: {reason}\n" f"MENSAGEM:\n\n{message.text}", ) except ValueError: pass
async def welcome_mute(welcm): ''' Ban a recently joined user if it matches the spammer checking algorithm. ''' ignore = False if not WELCOME_MUTE: return if welcm.user_joined or welcm.user_added: adder = None if welcm.user_added: async for admin in bot.iter_participants( welcm.chat_id, filter=ChannelParticipantsAdmins): adder = welcm.action_message.from_id if admin.id is adder: ignore = True break if ignore: return if welcm.user_joined: users_list = hasattr(welcm.action_message.action, "users") if users_list: users = welcm.action_message.action.users else: users = [welcm.action_message.from_id] await sleep(5) spambot = False for user_id in users: async for message in bot.iter_messages(welcm.chat_id, from_user=user_id): correct_type = isinstance(message, Message) if not message or not correct_type: break join_time = welcm.action_message.date message_date = message.date # The message was sent before the user joined, thus ignore it if message_date < join_time: continue # DEBUGGING. LEAVING IT HERE FOR SOME TIME ### print(f"User Joined: {join_time}") print(f"Message Sent: {message_date}") # user = await welcm.client.get_entity(user_id) if "http://" in message.text: spambot = True elif "t.me" in message.text: spambot = True elif message.fwd_from: spambot = True elif "https://" in message.text: spambot = True else: if user.first_name in ("Bitmex", "Promotion", "Information", "Dex", "Announcements", "Info"): if user.last_name == "Bot": spambot = True if spambot: print(f"Potential Spam Message: {message.text}") await message.delete() break continue # Check the next messsage if spambot: await welcm.reply( "`Potential Spambot Detected! Kicking away! " "Will log the ID for further purposes!\n" f"USER:` [{user.first_name}](tg://user?id={user.id})") chat = await welcm.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: await welcm.reply( "@admins\n" "`ANTI SPAMBOT DETECTOR!\n" "THIS USER MATCHES MY ALGORITHMS AS A SPAMBOT!`") else: try: await welcm.client( EditBannedRequest(welcm.chat_id, user.id, BANNED_RIGHTS)) await sleep(1) await welcm.client( EditBannedRequest(welcm.chat_id, user.id, UNBAN_RIGHTS)) except: await welcm.reply( "@admins\n" "`ANTI SPAMBOT DETECTOR!\n" "THIS USER MATCHES MY ALGORITHMS AS A SPAMBOT!`") if BOTLOG: await welcm.client.send_message( BOTLOG_CHATID, "#SPAMBOT-KICK\n" f"USER: [{user.first_name}](tg://user?id={user.id})\n" f"CHAT: {welcm.chat.title}(`{welcm.chat_id}`)")
async def anti_spambot(welcm): try: ''' Əgər bir istifadəçi spam algoritmasına keçə bilmirsə onu qrupdan banlar. ''' if not ANTI_SPAMBOT: return if welcm.user_joined or welcm.user_added: adder = None ignore = False users = None if welcm.user_added: ignore = False try: adder = welcm.action_message.from_id except AttributeError: return async for admin in bot.iter_participants( welcm.chat_id, filter=ChannelParticipantsAdmins): if admin.id == adder: ignore = True break if ignore: return elif welcm.user_joined: users_list = hasattr(welcm.action_message.action, "users") if users_list: users = welcm.action_message.action.users else: users = [welcm.action_message.from_id] await sleep(5) spambot = False if not users: return for user_id in users: async for message in bot.iter_messages(welcm.chat_id, from_user=user_id): correct_type = isinstance(message, Message) if not message or not correct_type: break join_time = welcm.action_message.date message_date = message.date if message_date < join_time: # Eğer mesaj kullanıcı katılma tarihinden daha önce ise yoksayılır. continue check_user = await welcm.client.get_entity(user_id) # Hata ayıklama. İlerideki durumlar için bırakıldı. ### print( f"Gələn istifadəçilər: {check_user.first_name} [ID: {check_user.id}]" ) print(f"Söhbət: {welcm.chat.title}") print(f"Vaxt: {join_time}") print( f"Gönfərdiyi mesaj: {message.text}\n\n[Zaman: {message_date}]" ) ############################################## try: cas_url = f"https://combot.org/api/cas/check?user_id={check_user.id}" r = get(cas_url, timeout=3) data = r.json() except BaseException: print( "CAS yoxlanışı uğursuz, köhnə anti_spambot yoxlanışına geri dönur." ) data = None pass if data and data['ok']: reason = f"[Combot Anti Spam tərəfındən banlandı.](https://combot.org/cas/query?u={check_user.id})" spambot = True elif "t.cn/" in message.text: reason = "`t.cn` URL'ləri qeyid edildi." spambot = True elif "t.me/joinchat" in message.text: reason = "Potansiyel reklam mesajı" spambot = True elif message.fwd_from: reason = "Başkasından və ya kanaldan göndərilən mesaj" spambot = True elif "?start=" in message.text: reason = "Telegram botu `start` linki" spambot = True elif "bit.ly/" in message.text: reason = "`bit.ly` URL'ləri qeyid edildi." spambot = True else: if check_user.first_name in ("Bitmex", "Promotion", "Information", "Dex", "Announcements", "Info", "Duyuru", "Duyurular" "Bilgilendirme", "Bilgilendirmeler"): if check_user.last_name == "Bot": reason = "Bilinen SpamBot" spambot = True if spambot: print(f"Potansiyel Spam Mesajı: {message.text}") await message.delete() break continue # Bir sonraki mesajı kontrol et if spambot: chat = await welcm.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT QEYİD EDİLDİ!\n" "BU İSTİFADƏÇİ MƏNİM SPAMBOT ALGORİTMLARIMA GİRƏ BİLİR!`" f"SEBEP: {reason}") kicked = False reported = True else: try: await welcm.reply( "`Potansiyel Spambot Qeyid Edildi !!`\n" f"`SEBEP:` {reason}\n" "Bu dəqiqə qrupdan atılır (kicklenir), bu ID ilerideki vəziyətlər üçün qeyid ediləcək.\n" f"`KULLANICI:` [{check_user.first_name}](tg://user?id={check_user.id})" ) await welcm.client.kick_participant( welcm.chat_id, check_user.id) kicked = True reported = False except BaseException: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT QEYİD EDİLDİ!\n" "BU İSTİFADƏÇİ MƏNİM SPAMBOT ALGORİTMLARIMA GİRƏ BİLİR!`" f"SEBEP: {reason}") kicked = False reported = True if BOTLOG: if kicked or reported: await welcm.client.send_message( BOTLOG_CHATID, "#ANTI_SPAMBOT RAPORU\n" f"Kullanıcı: [{check_user.first_name}](tg://user?id={check_user.id})\n" f"Kullanıcı IDsi: `{check_user.id}`\n" f"Sohbet: {welcm.chat.title}\n" f"Sohbet IDsi: `{welcm.chat_id}`\n" f"Sebep: {reason}\n" f"Mesaj:\n\n{message.text}") except ValueError: pass
async def anti_spambot(welcm): try: ''' Eğer bir kullanıcı spam algoritmasıyla eşleşiyorsa onu gruptan yasaklar. ''' if not ANTI_SPAMBOT: return if welcm.user_joined or welcm.user_added: adder = None ignore = False users = None if welcm.user_added: ignore = False try: adder = welcm.action_message.from_id except AttributeError: return async for admin in bot.iter_participants( welcm.chat_id, filter=ChannelParticipantsAdmins): if admin.id == adder: ignore = True break if ignore: return elif welcm.user_joined: users_list = hasattr(welcm.action_message.action, "users") if users_list: users = welcm.action_message.action.users else: users = [welcm.action_message.from_id] await sleep(5) spambot = False if not users: return for user_id in users: async for message in bot.iter_messages(welcm.chat_id, from_user=user_id): correct_type = isinstance(message, Message) if not message or not correct_type: break join_time = welcm.action_message.date message_date = message.date if message_date < join_time: # Eğer mesaj kullanıcı katılma tarihinden daha önce ise yoksayılır. continue check_user = await welcm.client.get_entity(user_id) # Hata ayıklama. İlerideki durumlar için bırakıldı. ### print( f"Katılan kullanıcı: {check_user.first_name} [ID: {check_user.id}]" ) print(f"Sohbet: {welcm.chat.title}") print(f"Zaman: {join_time}") print( f"Gönderdiği mesaj: {message.text}\n\n[Zaman: {message_date}]" ) ############################################## try: cas_url = f"https://combot.org/api/cas/check?user_id={check_user.id}" r = get(cas_url, timeout=3) data = r.json() except BaseException: print( "CAS kontrolü başarısız, eski anti_spambot kontrolüne dönülüyor." ) data = None pass if data and data['ok']: reason = f"[Combot Anti Spam tarafından banlandı.](https://combot.org/cas/query?u={check_user.id})" spambot = True elif "t.cn/" in message.text: reason = "`t.cn` URL'leri tespit edildi." spambot = True elif "t.me/joinchat" in message.text: reason = "Potansiyel reklam mesajı" spambot = True elif message.fwd_from: reason = "Başkasından iletilen mesaj" spambot = True elif "?start=" in message.text: reason = "Telegram botu `start` linki" spambot = True elif "bit.ly/" in message.text: reason = "`bit.ly` URL'leri tespit edildi." spambot = True else: if check_user.first_name in ("Bitmex", "Promotion", "Information", "Dex", "Announcements", "Info", "Duyuru", "Duyurular" "Bilgilendirme", "Bilgilendirmeler"): if check_user.last_name == "Bot": reason = "Bilinen SpamBot" spambot = True if spambot: print(f"Potansiyel Spam Mesajı: {message.text}") await message.delete() break continue # Bir sonraki mesajı kontrol et if spambot: chat = await welcm.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT TESPİT EDİLDİ!\n" "BU KULLANICI BENİM SPAMBOT ALGORİTMALARIMLA EŞLEŞİYOR!`" f"SEBEP: {reason}") kicked = False reported = True else: try: await welcm.reply( "`Potansiyel Spambot Tespit Edildi !!`\n" f"`SEBEP:` {reason}\n" "Şu anlık gruptan kickleniyor, bu ID ilerideki durumlar için kaydedilecek.\n" f"`KULLANICI:` [{check_user.first_name}](tg://user?id={check_user.id})" ) await welcm.client.kick_participant( welcm.chat_id, check_user.id) kicked = True reported = False except BaseException: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT TESPİT EDİLDİ!\n" "BU KULLANICI BENİM SPAMBOT ALGORİTMALARIMLA EŞLEŞİYOR!`" f"SEBEP: {reason}") kicked = False reported = True if BOTLOG: if kicked or reported: await welcm.client.send_message( BOTLOG_CHATID, "#ANTI_SPAMBOT RAPORU\n" f"Kullanıcı: [{check_user.first_name}](tg://user?id={check_user.id})\n" f"Kullanıcı IDsi: `{check_user.id}`\n" f"Sohbet: {welcm.chat.title}\n" f"Sohbet IDsi: `{welcm.chat_id}`\n" f"Sebep: {reason}\n" f"Mesaj:\n\n{message.text}") except ValueError: pass
async def welcome_mute(welcm): try: ''' Ban a recently joined user if it matches the spammer checking algorithm. ''' if not ANTI_SPAMBOT: return if welcm.user_joined or welcm.user_added: adder = None ignore = None if welcm.user_added: ignore = False adder = welcm._added_by async for admin in bot.iter_participants( welcm.chat_id, filter=ChannelParticipantsAdmins): if admin.id == adder: ignore = True break if ignore: return elif welcm.user_joined: users_list = hasattr(welcm.action_message.action, "users") if users_list: users = welcm.action_message.action.users else: users = [welcm.action_message.from_id] await sleep(5) spambot = False for user_id in users: async for message in bot.iter_messages(welcm.chat_id, from_user=user_id): correct_type = isinstance(message, Message) if not message or not correct_type: break join_time = welcm.action_message.date message_date = message.date if message_date < join_time: continue # The message was sent before the user joined, thus ignore it user = await welcm.client.get_entity(user_id) # DEBUGGING. LEAVING IT HERE FOR SOME TIME ### print(f"User Joined: {user.first_name} [ID: {user.id}]") print(f"Chat: {welcm.chat.title}") print(f"Time: {join_time}") print( f"Message Sent: {message.text}\n\n[Time: {message_date}]" ) # try: cas_url = f"https://combot.org/api/cas/check?user_id={user.id}" r = get(cas_url, timeout=3) data = r.json() except: print( "CAS check failed, falling back to legacy anti_spambot behaviour." ) pass if data and data['ok']: reason = f"[Banned by Combot Anti Spam](https://combot.org/cas/query?u={user.id})" spambot = True elif "http://" in message.text: reason = "Match on `http` URLs" spambot = True elif "t.me" in message.text: reason = "Potential Promotion Message" spambot = True elif message.fwd_from: reason = "Forwarded Message" spambot = True elif "https://" in message.text: reason = "Match on `https` URLs" spambot = True else: if user.first_name in ("Bitmex", "Promotion", "Information", "Dex", "Announcements", "Info"): if user.last_name == "Bot": reason = "Known Spam Bot" spambot = True if spambot: print(f"Potential Spam Message: {message.text}") await message.delete() break continue # Check the next messsage if spambot: chat = await welcm.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT DETECTOR!\n" "THIS USER MATCHES MY ALGORITHMS AS A SPAMBOT!`") else: await welcm.reply( "`Potential Spambot Detected! Kicking away! " "Will log the ID for further purposes!\n" f"USER:` [{user.first_name}](tg://user?id={user.id})") try: await welcm.client( EditBannedRequest(welcm.chat_id, user.id, BANNED_RIGHTS)) await sleep(1) await welcm.client( EditBannedRequest(welcm.chat_id, user.id, UNBAN_RIGHTS)) except BaseException: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT DETECTOR!\n" "THIS USER MATCHES MY ALGORITHMS AS A SPAMBOT!`" ) if BOTLOG: await welcm.client.send_message( BOTLOG_CHATID, "#SPAMBOT-KICK\n" f"USER: [{user.first_name}](tg://user?id={user.id})\n" f"CHAT: {welcm.chat.title}(`{welcm.chat_id}`)\n" f"REASON: {reason}\n" f"MESSAGE:\n{message.text}") except ValueError: pass
async def ANTI_SPAMBOTS(welcm): """Cekal pengguna yang baru bergabung jika cocok dengan algoritma pemeriksaan spammer.""" try: if not ANTI_SPAMBOT: return if welcm.user_joined or welcm.user_added: adder = None ignore = False users = None if welcm.user_added: ignore = False try: adder = welcm.action_message.from_id except AttributeError: return async for admin in bot.iter_participants( welcm.chat_id, filter=ChannelParticipantsAdmins ): if admin.id == adder: ignore = True break if ignore: return elif welcm.user_joined: users_list = hasattr(welcm.action_message.action, "users") if users_list: users = welcm.action_message.action.users else: users = [welcm.action_message.from_id] await sleep(5) spambot = False if not users: return for user_id in users: async for message in bot.iter_messages( welcm.chat_id, from_user=user_id ): correct_type = isinstance(message, Message) if not message or not correct_type: break join_time = welcm.action_message.date message_date = message.date if message_date < join_time: continue # The message was sent before the user joined, thus ignore it check_user = await welcm.client.get_entity(user_id) # DEBUGGING. LEAVING IT HERE FOR SOME TIME ### print(f"Pengguna Telah Bergabung: {check_user.first_name} [ID: {check_user.id}]") print(f"Chat: {welcm.chat.title}") print(f"Waktu: {join_time}") print(f"Pesan terkirim: {message.text}\n\n[Waktu: {message_date}]") ############################################## try: # https://t.me/combotnews/283 cas_url = f"https://api.cas.chat/check?user_id={check_user.id}" r = get(cas_url, timeout=3) data = r.json() except BaseException: print( "Pemeriksaan CAS gagal, kembali ke legacy anti_spambot behaviour." ) data = None if data and data["ok"]: reason = f"[Banned by Combot Anti Spam](https://cas.chat/query?u={check_user.id})" spambot = True elif "t.cn/" in message.text: reason = "Match on `t.cn` URLs" spambot = True elif "t.me/joinchat" in message.text: reason = "Potential Promotion Message" spambot = True elif message.fwd_from: reason = "Forwarded Message" spambot = True elif "?start=" in message.text: reason = "Telegram bot `start` link" spambot = True elif "bit.ly/" in message.text: reason = "Match on `bit.ly` URLs" spambot = True else: if check_user.first_name in ( "Bitmex", "Promotion", "Information", "Dex", "Announcements", "Info", ): if users.last_name == "Bot": reason = "Known spambot" spambot = True if spambot: print(f"Potensi Pesan Spam: {message.text}") await message.delete() break continue # Check the next messsage if spambot: chat = await welcm.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT DETECTOR!\n" "PENGGUNA INI SESUAI DENGAN ALGORITMA SAYA SEBAGAI SPAMBOT!`" f"ALASAN: {reason}" ) kicked = False reported = True else: try: await welcm.reply( "`Potensi Spambot Terdeteksi.!!`\n" f"`ALASAN :` {reason}\n" "Mengeluarkan dia untuk saat ini.\n" f"`PENGGUNA :` [{check_user.first_name}](tg://user?id={check_user.id})" ) await welcm.client.kick_participant( welcm.chat_id, check_user.id ) kicked = True reported = False except BaseException: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT DETECTOR!\n" "PENGGUNA INI SESUAI DENGAN ALGORITMA SAYA SEBAGAI SPAMBOT!`" f"ALASAN : {reason}" ) kicked = False reported = True if BOTLOG: if kicked or reported: await welcm.client.send_message( BOTLOG_CHATID, "#ANTI_SPAMBOT REPORT\n" f"Pengguna : [{users.first_name}](tg://user?id={check_user.id})\n" f"ID Pengguna : `{check_user.id}`\n" f"Pengguna : {welcm.chat.title}\n" f"ID Pesan : `{welcm.chat_id}`\n" f"ALASAN : {reason}\n" f"PESAN :\n\n{message.text}", ) except ValueError: pass
async def ANTI_SPAMBOTS(welcm): try: """Ban a recently joined user if it matches the spammer checking algorithm.""" if not ANTI_SPAMBOT: return if welcm.user_joined or welcm.user_added: adder = None ignore = False users = None if welcm.user_added: ignore = False try: adder = welcm.action_message.sender_id except AttributeError: return async for admin in bot.iter_participants( welcm.chat_id, filter=ChannelParticipantsAdmins): if admin.id == adder: ignore = True break if ignore: return elif welcm.user_joined: users_list = hasattr(welcm.action_message.action, "users") if users_list: users = welcm.action_message.action.users else: users = [welcm.action_message.sender_id] await sleep(5) spambot = False if not users: return for user_id in users: async for message in bot.iter_messages(welcm.chat_id, from_user=user_id): correct_type = isinstance(message, Message) if not message or not correct_type: break join_time = welcm.action_message.date message_date = message.date if message_date < join_time: continue # The message was sent before the user joined, thus ignore it check_user = await welcm.client.get_entity(user_id) # DEBUGGING. LEAVING IT HERE FOR SOME TIME ### print( f"**Pengguna Telah Bergabung** : {check_user.first_name} [ID : {check_user.id}]" ) print(f"**Obrolan** : {welcm.chat.title}") print(f"**Waktu** : {join_time}") print( f"**Pesan Terkirim** : {message.text}\n\n[Waktu : {message_date}]" ) ############################################## try: cas_url = ( f"https://combot.org/api/cas/check?user_id={check_user.id}" ) r = get(cas_url, timeout=3) data = r.json() except BaseException: print( "Pemeriksaan CAS gagal, kembali ke perilaku anti_spambot lama." ) data = None if data and data["ok"]: reason = f"Dilarang oleh [Combot Anti Spam](https://combot.org/cas/query?u={check_user.id})" spambot = True elif "t.cn/" in message.text: reason = "Cocok di `t.cn` URL" spambot = True elif "t.me/joinchat" in message.text: reason = "Pesan Promosi Potensial" spambot = True elif message.fwd_from: reason = "Pesan yang Diteruskan" spambot = True elif "?start=" in message.text: reason = "Tautan `mulai` bot Telegram" spambot = True elif "bit.ly/" in message.text: reason = "Cocok di `bit.ly` URL" spambot = True else: if check_user.first_name in ( "Bitmex", "Promotion", "Information", "Dex", "Announcements", "Info", ): if users.last_name == "Bot": reason = "Spambot diketahui" spambot = True if spambot: print(f"Potensi Pesan Spam : {message.text}") await message.delete() break continue # Check the next messsage if spambot: chat = await welcm.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "#DETEKTOR ANTI SPAMBOT\n" "PENGGUNA INI COCOK DENGAN ALGORITME SAYA SEBAGAI SPAMBOT!" f"**Alasan** : {reason}") kicked = False reported = True else: try: await welcm.reply( "**Potensi spambot terdeteksi!**\n" f"**Alasan** : {reason}\n" "Menendang pergi untuk saat ini, akan mencatat ID untuk tujuan selanjutnya.\n" f"**Pengguna** : [{check_user.first_name}](tg://user?id={check_user.id})" ) await welcm.client.kick_participant( welcm.chat_id, check_user.id) kicked = True reported = False except BaseException: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "DETEKTOR ANTI SPAMBOT\n" "PENGGUNA INI COCOK DENGAN ALGORITME SAYA SEBAGAI SPAMBOT!" f"**Alasan** : {reason}") kicked = False reported = True if BOTLOG: if kicked or reported: await welcm.client.send_message( BOTLOG_CHATID, "#LAPORAN ANTI_SPAMBOT\n" f"Pengguna : [{users.first_name}](tg://user?id={check_user.id})\n" f"ID Pengguna : `{check_user.id}`\n" f"Obrolan : {welcm.chat.title}\n" f"ID Obrolan : `{welcm.chat_id}`\n" f"Alasan : {reason}\n" f"Pesan :\n\n{message.text}", ) except ValueError: pass
async def ANTI_SPAMBOTS(welcm): """Ban a recently joined user if it matches the spammer checking algorithm.""" try: if not ANTI_SPAMBOT: return if welcm.user_joined or welcm.user_added: adder = None ignore = False users = None if welcm.user_added: ignore = False try: adder = welcm.action_message.from_id except AttributeError: return async for admin in bot.iter_participants( welcm.chat_id, filter=ChannelParticipantsAdmins): if admin.id == adder: ignore = True break if ignore: return elif welcm.user_joined: users_list = hasattr(welcm.action_message.action, "users") if users_list: users = welcm.action_message.action.users else: users = [welcm.action_message.from_id] await sleep(5) spambot = False if not users: return for user_id in users: async for message in bot.iter_messages(welcm.chat_id, from_user=user_id): correct_type = isinstance(message, Message) if not message or not correct_type: break join_time = welcm.action_message.date message_date = message.date if message_date < join_time: continue # The message was sent before the user joined, thus ignore it check_user = await welcm.client.get_entity(user_id) # DEBUGGING. LEAVING IT HERE FOR SOME TIME ### print( f"User Joined: {check_user.first_name} [ID: {check_user.id}]" ) print(f"Chat: {welcm.chat.title}") print(f"Time: {join_time}") print( f"Message Sent: {message.text}\n\n[Time: {message_date}]" ) ############################################## try: # https://t.me/combotnews/283 cas_url = f"https://api.cas.chat/check?user_id={check_user.id}" r = get(cas_url, timeout=3) data = r.json() except BaseException: print( "CAS check failed, falling back to legacy anti_spambot behaviour." ) data = None if data and data['ok']: reason = f"[Banned by Combot Anti Spam](https://cas.chat/query?u={check_user.id})" spambot = True elif "t.cn/" in message.text: reason = "Match on `t.cn` URLs" spambot = True elif "t.me/joinchat" in message.text: reason = "Potential Promotion Message" spambot = True elif message.fwd_from: reason = "Forwarded Message" spambot = True elif "?start=" in message.text: reason = "Telegram bot `start` link" spambot = True elif "bit.ly/" in message.text: reason = "Match on `bit.ly` URLs" spambot = True else: if check_user.first_name in ("Bitmex", "Promotion", "Information", "Dex", "Announcements", "Info"): if users.last_name == "Bot": reason = "Known spambot" spambot = True if spambot: print(f"Potential Spam Message: {message.text}") await message.delete() break continue # Check the next messsage if spambot: chat = await welcm.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT DETECTOR!\n" "THIS USER MATCHES MY ALGORITHMS AS A SPAMBOT!`" f"REASON: {reason}") kicked = False reported = True else: try: await welcm.reply( "`Potential Spambot Detected !!`\n" f"`REASON:` {reason}\n" "Kicking away for now, will log the ID for further purposes.\n" f"`USER:` [{check_user.first_name}](tg://user?id={check_user.id})" ) await welcm.client.kick_participant( welcm.chat_id, check_user.id) kicked = True reported = False except BaseException: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT DETECTOR!\n" "THIS USER MATCHES MY ALGORITHMS AS A SPAMBOT!`" f"REASON: {reason}") kicked = False reported = True if BOTLOG: if kicked or reported: await welcm.client.send_message( BOTLOG_CHATID, "#ANTI_SPAMBOT REPORT\n" f"USER: [{check_user.first_name}](tg://user?id={check_user.id})\n" f"USER ID: `{check_user.id}`\n" f"CHAT: {welcm.chat.title}\n" f"CHAT ID: `{welcm.chat_id}`\n" f"REASON: {reason}\n" f"MESSAGE:\n\n{message.text}") except ValueError: pass
async def anti_spambot(welcm): try: if not ANTI_SPAMBOT: return if welcm.user_joined or welcm.user_added: adder = None ignore = False users = None if welcm.user_added: ignore = False try: adder = welcm.action_message.from_id except AttributeError: return async for admin in bot.iter_participants( welcm.chat_id, filter=ChannelParticipantsAdmins): if admin.id == adder: ignore = True break if ignore: return elif welcm.user_joined: users_list = hasattr(welcm.action_message.action, "users") if users_list: users = welcm.action_message.action.users else: users = [welcm.action_message.from_id] await sleep(5) spambot = False if not users: return for user_id in users: async for message in bot.iter_messages(welcm.chat_id, from_user=user_id): correct_type = isinstance(message, Message) if not message or not correct_type: break join_time = welcm.action_message.date message_date = message.date if message_date < join_time: continue check_user = await welcm.client.get_entity(user_id) print( f"Qatılan istifadəçi: {check_user.first_name} [ID: {check_user.id}]" ) print(f"Söhbət: {welcm.chat.title}") print(f"vaxt: {join_time}") print( f"Göndərdiyi mesaj: {message.text}\n\n[vaxt: {message_date}]" ) try: cas_url = f"https://combot.org/api/cas/check?user_id={check_user.id}" r = get(cas_url, timeout=3) data = r.json() except BaseException: print( "CAS yoxlanışı baş tutmadı, köhnə anti_spambot yoxlanışına qayıtdı." ) data = None pass if data and data['ok']: reason = f"[Combot Anti Spam tərəfindan banlandı.](https://combot.org/cas/query?u={check_user.id})" spambot = True elif "t.cn/" in message.text: reason = "`t.cn` URL'ləri yoxlayır." spambot = True elif "t.me/joinchat" in message.text: reason = "Güncəl reklam mesajı" spambot = True elif message.fwd_from: reason = "Başqasından yönləndirilən mesaj" spambot = True elif "?start=" in message.text: reason = "Telegram botu `start` linki" spambot = True elif "bit.ly/" in message.text: reason = "`bit.ly` URL-lər aşkarlandı." spambot = True else: if check_user.first_name in ("Bitmex", "Promotion", "Information", "Dex", "Announcements", "Info", "Duyuru", "Duyurular" "Bilgilendirme", "Bilgilendirmeler"): if check_user.last_name == "Bot": reason = "Bilinməyən SpamBot" spambot = True if spambot: print(f"Güncəl Spam Mesajı: {message.text}") await message.delete() break continue if spambot: chat = await welcm.get_chat() admin = chat.admin_rights creator = chat.creator if not admin and not creator: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT TAPILDI!\n" "BU İSTİFADƏÇİ Mənim spam-bot alqoritmlərimə uyğundur`" f"SƏBƏB: {reason}") kicked = False reported = True else: try: await welcm.reply( "`Potensial spambot aşkarlandı !!`\n" f"`SƏBƏB:` {reason}\n" "Hal-hazırda qrupdan qovulur, bu ID gələcək vəziyyətlər üçün qeyd ediləcəkdir.\n" f"`İSTİFADƏÇİ:` [{check_user.first_name}](tg://user?id={check_user.id})" ) await welcm.client.kick_participant( welcm.chat_id, check_user.id) kicked = True reported = False except BaseException: if ANTI_SPAMBOT_SHOUT: await welcm.reply( "@admins\n" "`ANTI SPAMBOT AŞKAR OLUNDU!\n" "BU İSTİFADƏÇİ Mənim spambot alqoritmlərimə uyğundur!`" f"SƏBƏB: {reason}") kicked = False reported = True if BOTLOG: if kicked or reported: await welcm.client.send_message( BOTLOG_CHATID, "#ANTI_SPAMBOT MƏLUMAT\n" f"İstifadəçi: [{check_user.first_name}](tg://user?id={check_user.id})\n" f"İstifadəçi IDsi: `{check_user.id}`\n" f"Söhbət: {welcm.chat.title}\n" f"Söhbət IDsi: `{welcm.chat_id}`\n" f"Səbəb: {reason}\n" f"Mesaj:\n\n{message.text}") except ValueError: pass