def decorator(func): pattern = args.get('pattern', None) disable_edited = args.get('disable_edited', False) ignore_unsafe = args.get('ignore_unsafe', False) unsafe_pattern = r'^[^/!#@\$A-Za-z]' group_only = args.get('group_only', False) disable_errors = args.get('disable_errors', False) if pattern is not None and not pattern.startswith('(?i)'): args['pattern'] = '(?i)' + pattern if "disable_edited" in args: del args['disable_edited'] if "ignore_unsafe" in args: del args['ignore_unsafe'] if "group_only" in args: del args['group_only'] if "disable_errors" in args: del args['disable_errors'] if pattern: if not ignore_unsafe: args['pattern'] = pattern.replace('^.', unsafe_pattern, 1) async def wrapper(check): if group_only and not check.is_group: await check.respond("`Are you sure this is a group?`") return try: await func(check) # # HACK HACK HACK # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly # TODO # Rewrite events to not passing all exceptions # except events.StopPropagation: raise events.StopPropagation # This exception has to be passed except KeyboardInterrupt: pass except BaseException: # Check if we have to disable it. # If not silence the log spam on the console, # with a dumb except. if not disable_errors: process = await asyncsubshell( "git log --pretty=format:\"%an: %s\" -5", stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() link = "[https://t.me/userbot_support](Userbot Support Chat)" text = "**Sorry, I encountered a error!**\n" \ f"If you want, you can report this to {link}.\n" \ "I won't log anything except for the exception and date. \n\n" \ "Disclaimer:\n" \ "This file uploaded ONLY here, we logged only fact of error " \ "and date, we respect your privacy. You may not report this " \ "if this containing any non-disclosure data, no one will " \ "see your data. \n\n" traceback = "--------BEGIN USERBOT TRACEBACK LOG--------\n" \ f"Date: {strftime('%Y-%m-%d %H:%M:%S', gmtime())} \n" \ f"Group ID: {str(check.chat_id)} \n" \ f"Sender ID: {str(check.sender_id)} \n" \ f"Event Trigger: \n{str(check.text)} \n\n" \ f"Traceback Info: \n {str(format_exc())} \n\n" \ f"Error Text: {str(sys.exc_info()[1])} \n\n" \ "-------- END USERBOT TRACEBACK LOG-------- \n\n" \ "Last 5 commits: \n" \ f"{str(stdout.decode().strip())}" \ f"{str(stderr.decode().strip())}" file = open("error.log", "w+") file.write(traceback) file.close() await check.client.send_file( check.chat_id, "error.log", caption=text, ) remove("error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def __init__(self, func=None, **args): self.Var = Var bot.add_event_handler(func, events.NewMessage(**args))
def decorator(func): async def wrapper(check): if check.edit_date and check.is_channel and not check.is_group: # Messages sent in channels can be edited by other users. # Ignore edits that take place in channels. return if group_only and not check.is_group: await check.respond("`Are you sure this is a group?`") return if check.via_bot_id and not insecure and check.out: # Ignore outgoing messages via inline bots for security reasons return if pattern.startswith( "^.") and not check.message.message.startswith("."): return try: await func(check) # # HACK HACK HACK # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly # TODO # Rewrite events to not passing all exceptions # except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt spam chats except KeyboardInterrupt: pass except BaseException as e: LOGGER.exception(e) # Log the error in console # Check if we have to disable error logging message. if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**Sorry, I encountered a error!**\n" link = "[https://t.me/tgpaperplane](Userbot Support Chat)" text += "If you wanna you can report it" text += f"- just forward this message to {link}.\n" text += "I won't log anything except the fact of error and date\n" ftext = "\nDisclaimer:\nThis file uploaded ONLY here, " ftext += "we logged only fact of error and date, " ftext += "we respect your privacy, " ftext += "you may not report this error if you've " ftext += "any confidential data here, no one will see your data " ftext += "if you choose not to do so.\n\n" ftext += "--------BEGIN USERBOT TRACEBACK LOG--------" ftext += "\nDate: " + date ftext += "\nGroup ID: " + str(check.chat_id) ftext += "\nSender ID: " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(format_exc()) ftext += "\n\nError text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" #command = "git log --pretty=format:\"%an: %s\" -5" #ftext += "\n\n\nLast 5 commits:\n" #process = await asyncsubshell(command, # stdout=asyncsub.PIPE, # stderr=asyncsub.PIPE) #stdout, stderr = await process.communicate() #result = str(stdout.decode().strip()) \ # + str(stderr.decode().strip()) #ftext += result file = open("error.log", "w+") file.write(ftext) file.close() remove("error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
await check.client.respond( "`Sorry, my userbot has crashed馃様, check logs for more info.\ \nThe error logs are stored in the userbot's log chat.`" ) await check.client.send_file(send_to, "error.log", caption=text) remove("error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper return decorator
def decorator(func): async def wrapper(check): if LOGSPAMMER: send_to = BOTLOG_CHATID if not trigger_on_fwd and check.fwd_from: return if groups_only and not check.is_group: await check.respond("`I don't think this is a group.`") return try: await func(check) # Thanks to @kandnub for this HACK. # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt spam chats except KeyboardInterrupt: pass except BaseException: # Check if we have to disable it. # If not silence the log spam on the console, # with a dumb except. if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**JAVES ERROR REPORT**\n" text += "Send this to @rekcah05 if you cant find issue\n" ftext = "========== DISCLAIMER ==========" ftext += "\nThis file uploaded only logchat," ftext += "\nreport to admin this error if you cant find any issue" ftext += "\n---------------------------------\n" ftext += "================================\n\n" ftext += "--------BEGIN LOG--------\n" ftext += "\nDate: " + date ftext += "\nChat ID: " + str(check.chat_id) ftext += "\nSender ID: " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(format_exc()) ftext += "\n\nError text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------END LOG--------" command = "git log --pretty=format:\"%an: %s\" -10" ftext += "\n\n\nLast 10 commits:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("javes_error.log", "w+") file.write(ftext) file.close() await check.client.send_file(send_to, "javes_error.log", caption=text) remove("javes_error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if check.edit_date and check.is_channel and not check.is_group: # Messages sent in channels can be edited by other users. # Ignore edits that take place in channels. return if not trigger_on_fwd and check.fwd_from: return if groups_only and not check.is_group: await check.respond("`I don't think this is a group.`") return if check.via_bot_id and not insecure and check.out: return try: await func(check) except events.StopPropagation: raise events.StopPropagation except KeyboardInterrupt: pass except BaseException: # Check if we have to disable it. # If not silence the log spam on the console, # with a dumb except. if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**✘ MAN-USERBOT ERROR REPORT ✘**\n\n" link = "[Group Support](https://t.me/SharingUserbot)" text += "Jika mau, Anda bisa melaporkan error ini, " text += f"Cukup forward saja pesan ini ke {link}.\n\n" ftext = "========== DISCLAIMER ==========" ftext += "\nFile ini HANYA diupload di sini," ftext += "\nkami hanya mencatat fakta error dan tanggal," ftext += "\nkami menghormati privasi Anda." ftext += "\nJika mau, Anda bisa melaporkan error ini," ftext += "\ncukup forward saja pesan ini ke @SharingUserbot" ftext += "\n================================\n\n" ftext += "--------BEGIN USERBOT TRACEBACK LOG--------\n" ftext += "\nTanggal : " + date ftext += "\nChat ID : " + str(check.chat_id) ftext += "\nUser ID : " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(format_exc()) ftext += "\n\nError text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" command = 'git log --pretty=format:"%an: %s" -10' ftext += "\n\n\n10 commits Terakhir:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) + str( stderr.decode().strip()) ftext += result with open("error.log", "w+") as file: file.write(ftext) if bot: if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) if MAN2: if not disable_edited: MAN2.add_event_handler(wrapper, events.MessageEdited(**args)) MAN2.add_event_handler(wrapper, events.NewMessage(**args)) if MAN3: if not disable_edited: MAN3.add_event_handler(wrapper, events.MessageEdited(**args)) MAN3.add_event_handler(wrapper, events.NewMessage(**args)) if MAN4: if not disable_edited: MAN4.add_event_handler(wrapper, events.MessageEdited(**args)) MAN4.add_event_handler(wrapper, events.NewMessage(**args)) if MAN5: if not disable_edited: MAN5.add_event_handler(wrapper, events.MessageEdited(**args)) MAN5.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): if not disable_edited: bot.add_event_handler(func, events.MessageEdited(**args)) bot.add_event_handler(func, events.NewMessage(**args)) return func
def register(cls: Command.__class__): """Register a new `Command`""" pattern = cls.command_pattern() args = {'pattern': pattern, 'incoming': cls.incoming} async def decorator(check: NewMessage): # pylint: disable=no-member db_chat = Chat.query.get(check.chat.id) if db_chat and not db_chat.bot_enabled and not cls.disable_override: return if cls.group_only and not check.is_group(): logging.warning("Attempted to call method marked as group_only" "in a non-group setting.") return if cls.incoming and not check.out: await cls().exec(check) return try: await cls().exec(check) except KeyboardInterrupt: pass except BaseException as err: # Do some error handling. In the future we may make this more configurable, # but for now we just send a file to the log chat. # Log the error logging.error(err) if not cls.disable_errors and LOG_CHAT_ID != "": date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "" command = "git log --pretty=format:\"%an: %s\" -5" process = await asyncio.create_subprocess_shell( command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) stdout, stderr = await process.communicate() gitlog = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) title = "**Sorry, your bot encountered an error**" text += f"{title}\n\n" text += "Disclaimer: This file may contain sensitive information.\n" text += " Be careful sharing it.\n\n" text += "--------BEGIN ERROR LOG--------\n" text += "Date: %s\n" % (date) text += "Group ID: %s\n" % (str(check.chat_id)) text += "Sender ID: %s\n" % (str(check.sender_id)) text += "Event Trigger:\n" text += str(check.text) + "\n\n" text += "Traceback info:\n" text += str(traceback.format_exc()) + "\n\n" text += "Error text:" text += str(sys.exc_info()[1]) + "\n\n" text += "---------END ERROR LOG---------\n\n" text += "Last 5 commits:\n" text += gitlog err_file = open("error.log", "w+") err_file.write(text) err_file.close() await check.client.send_file(LOG_CHAT_ID, "error.log", caption=title, parse_mode="markdown") else: pass if not cls.disable_edited: bot.add_event_handler(decorator, MessageEdited(**args)) bot.add_event_handler(decorator, NewMessage(**args)) cls.on_register(bot) return decorator
def decorator(func): async def wrapper(check): if group_only and not check.is_group: await check.respond("`Are you sure this is a group?`") return if incoming_func and not check.out: await func(check) return # Check if the sudo is an admin already, if yes, we can avoid acting to his command. #If his admin was limited, its his problem. if not check.out and check.sender_id in BRAIN_CHECKER and permit_sudo: async for user in check.client.iter_participants( check.chat_id, filter=ChannelParticipantsAdmins): if user.id in BRAIN_CHECKER: return # Avoid non-sudos from triggering the command elif not check.out and check.sender_id not in BRAIN_CHECKER: return # Announce that you are handling the request elif not check.out and check.sender_id in BRAIN_CHECKER and permit_sudo: await check.respond("`Processing Sudo Request!`") try: await func(check) # This is a gay exception and must be passed out. So that it doesnt spam chats except KeyboardInterrupt: pass except BaseException: # Check if we have to disable it. If not silence the log spam on the console, with a dumb except. if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) new = { 'error': str(sys.exc_info()[1]), 'date': datetime.datetime.now() } text = "**Sorry, I encountered a error!**\n" link = "[https://t.me/userbot_support](Userbot Support Chat)" text += "If you wanna you can report it" text += f"- just forward this message to {link}.\n" text += "I won't log anything except the fact of error and date\n" ftext = "\nDisclaimer:\nThis file uploaded ONLY here, " ftext += "we logged only fact of error and date, " ftext += "we respect your privacy, " ftext += "you may not report this error if you've " ftext += "any confidential data here, noone will see your data\n\n" ftext += "--------BEGIN USERBOT TRACEBACK LOG--------" ftext += "\nDate: " + date ftext += "\nGroup ID: " + str(check.chat_id) ftext += "\nSender ID: " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(traceback.format_exc()) ftext += "\n\nError text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" command = "git log --pretty=format:\"%an: %s\" -5" ftext += "\n\n\nLast 5 commits:\n" process = await asyncio.create_subprocess_shell( command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("error.log", "w+") file.write(ftext) file.close() await check.client.send_file( check.chat_id, "error.log", caption=text, ) remove("error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): SiriVer = int(SIRI_VERSION.split(".")[1]) if ForceVer > SiriVer: await check.edit( f"`🌈 Botu acilen güncellemen lazım! Bu sürüm artık kullanılamıyor..`\n\n__🥺 Sorunu çözmek için__ `.update now` __yazmalısın!__" ) return if not LOGSPAMMER: send_to = check.chat_id else: send_to = BOTLOG_CHATID if not trigger_on_fwd and check.fwd_from: return if check.via_bot_id and not trigger_on_inline: return if groups_only and not check.is_group: if not notifyoff: try: await check.edit( "`⛔ Bunun bir grup olduğunu sanmıyorum. Bu plugini bir grupta dene! `" ) except: await check.respond( "`⛔ Bunun bir grup olduğunu sanmıyorum. Bu plugini bir grupta dene! `" ) return if replyneeded and not check.is_reply: if not notifyoff: try: await check.edit( "`🤰🏻Plugini kullanabilmek için bir mesajı yanıtlamalısın!`" ) except: await check.respond( "`🤰🏻 Plugini kullanabilmek için bir mesajı yanıtlamalısın!`" ) return try: await func(check) except SP: raise SP except KeyboardInterrupt: pass except MessageIdInvalidError: try: await check.respond( '__🗒️ ( **Hata** ) :: Plugine ait mesaj silinmiş gibi görünüyor..__' ) except: pass except BaseException: if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) eventtext = str(check.text) text = "**≛『 USERBOT HATA RAPORU 』≛**\n" link = "[Siri Destek Grubuna](https://t.me/SiriSupport)" if len(eventtext) < 20: text += f"\n**🗒️ Şu yüzden:** {eventtext}\n" text += "\n✆ İsterseniz, bunu bildirebilirsiniz." text += f"- sadece bu mesajı {link} gönderin." text += "**Hata ve tarih haricinde hiçbir şey** kayıt edilmez.\n" ftext = "" ftext += "========== UYARI ==========" ftext += "\nBu dosya sadece burada yüklendi," ftext += "\nSadece hata ve tarih kısmını kaydettik," ftext += "\nGizliliğinize saygı duyuyoruz," ftext += "\nBurada herhangi bir gizli veri varsa" ftext += "\nBu hata raporu olmayabilir, kimse verilerinize ulaşamaz.\n" ftext += "--------USERBOT HATA GUNLUGU--------\n" ftext += "\n➢ Tarih: " + date ftext += "\n➢ Grup ID: " + str(check.chat_id) ftext += "\n➢ Gönderen kişinin ID: " + str(check.sender_id) ftext += "\n\n➢ Olay Tetikleyici:\n" ftext += str(check.text) ftext += "\n\n➢ Hata metni:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n➢ Bot versiyonu:\n" ftext += "{}".format(str(SIRI_VERSION)) ftext += "\n\n\n➢ Geri izleme bilgisi: \n" ftext += str(format_exc()) ftext += "\n\n--------USERBOT HATA GUNLUGU BITIS--------" command = "git log --pretty=format:\"%an: %s\" -7" ftext += "\n\n\nSon 7 Güncelleme:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("error.log", "w+") file.write(ftext) file.close() if LOGSPAMMER: try: await check.edit( "__🥺 Üzgünüm, UserBot bir hatayla karşılaştı.\n🐙 Hata raporu Botlog grubuna gönderildi.__" ) except: pass await check.client.send_file(send_to, "error.log", caption=text) try: remove("error.log") except: pass if not disable_edited: bot.add_event_handler(wrapper, ME(**args)) bot.add_event_handler(wrapper, NW(**args)) return wrapper
def decorator(func): async def wrapper(check): if check.edit_date and check.is_channel and not check.is_group: # Messages sent in channels can be edited by other users. # Ignore edits that take place in channels. return if not trigger_on_fwd and check.fwd_from: return if groups_only and not check.is_group: await check.respond("`Eu não acho que isso seja um grupo.`") return try: from userbot.modules.sql_helper.blacklist_sql import get_blacklist for blacklisted in get_blacklist(): if str(check.chat_id) == blacklisted.chat_id: return except Exception: pass if check.via_bot_id and not insecure and check.out: return try: await func(check) # Thanks to @kandnub for this HACK. # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt # spam chats except KeyboardInterrupt: pass except BaseException as e: # Check if we have to disable error logging. if not disable_errors: LOGS.exception(e) # Log the error in console date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**RELATÓRIO DE ERRO DO USERBOT**\n" link = "[SUPORTE](https://t.me/Kircheiss)" text += "Caso queira" text += f"- encaminhe esta mensagem para {link}.\n" text += "Nada será registrado, exceto o módulo do erro e a data\n" ftext = "\nALERTA:\nEste arquivo foi carregado SOMENTE aqui, " ftext += "registramos apenas o motivo do erro e a data, " ftext += "Nós respeitamos sua privacidade, " ftext += "você não deve relatar este erro caso existam " ftext += "quaisquer dados confidenciais aqui, ninguém vai ver seus dados " ftext += "se você escolher não fazer isso.\n\n" ftext += "--------INÍCIO DO RELATÓRIO--------" ftext += "\nData: " + date ftext += "\nChat ID: " + str(check.chat_id) ftext += "\nUser ID: " + str(check.sender_id) ftext += "\n\nComando:\n" ftext += str(check.text) ftext += "\n\nInformações de traceback:\n" ftext += str(format_exc()) ftext += "\n\nTexto de erro:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------FIM DO RELATÓRIO--------" command = 'git log --pretty=format:"%an: %s" -10' ftext += "\n\n\nÚltimos 10 commits:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) + str( stderr.decode().strip()) ftext += result with open("error.log", "w+") as file: file.write(ftext) if LOGSPAMMER: await check.client.send_file( BOTLOG_CHATID, "error.log", caption=text, ) else: await check.client.send_file( check.chat_id, "error.log", caption=text, ) remove("error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): SiriVer = int(SIRI_VERSION.split(".")[1]) if ForceVer > SiriVer: await check.edit( f"`🌈 Botu acilen güncellemen lazım! Bu sürüm artık kullanılamıyor..`\n\n__🥺 Sorunu çözmek için__ `.update now` __yazmalısın!__" ) return if not LOGSPAMMER: send_to = check.chat_id else: send_to = BOTLOG_CHATID if not trigger_on_fwd and check.fwd_from: return if check.via_bot_id and not trigger_on_inline: return if groups_only and not check.is_group: await check.respond( "`⛔ Bunun bir grup olduğunu sanmıyorum. Bu plugini bir grupta dene! `" ) return try: await func(check) except events.StopPropagation: raise events.StopPropagation except KeyboardInterrupt: pass except BaseException: if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) eventtext = str(check.text) text = "**==USERBOT HATA RAPORU==**\n\n" link = "[Siri Destek Grubuna](https://t.me/SiriSupport)" if len(eventtext) < 10: text += f"**🗒️ Şu yüzden:** {eventtext}\n" text += "\nℹ️ İsterseniz, bunu bildirebilirsiniz." text += f"- sadece bu mesajı {link} gönderin.\n" text += "Hata ve tarih haricinde hiçbir şey kayıt edilmez.\n" ftext = "========== UYARI ==========" ftext += "\nBu dosya sadece burada yüklendi," ftext += "\nSadece hata ve tarih kısmını kaydettik," ftext += "\nGizliliğinize saygı duyuyoruz," ftext += "\nBurada herhangi bir gizli veri varsa" ftext += "\nBu hata raporu olmayabilir, kimse verilerinize ulaşamaz.\n" ftext += "--------USERBOT HATA GUNLUGU--------\n" ftext += "\nTarih: " + date ftext += "\nGrup ID: " + str(check.chat_id) ftext += "\nGönderen kişinin ID: " + str(check.sender_id) ftext += "\n\nOlay Tetikleyici:\n" ftext += str(check.text) ftext += "\n\nHata metni:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n\nGeri izleme bilgisi:\n" ftext += str(format_exc()) ftext += "\n\n--------USERBOT HATA GUNLUGU BITIS--------" ftext += "\n\n================================\n" ftext += f"====== BOTVER : {SIRI_VERSION} ======\n" ftext += "================================" command = "git log --pretty=format:\"%an: %s\" -7" ftext += "\n\n\nSon 7 commit:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("error.log", "w+") file.write(ftext) file.close() if LOGSPAMMER: try: await check.reply( "`❕ Üzgünüm, UserBot bir hatayla karşılaştı.\n ℹ️ Hata günlükleri UserBot günlük grubunda saklanır.`" ) except: await check.client.send_message( check.chat_id, "`❕ Üzgünüm, UserBot bir hatayla karşılaştı.\n ℹ️ Hata günlükleri UserBot günlük grubunda saklanır.`" ) await check.client.send_file(send_to, "error.log", caption=text) remove("error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if not LOGSPAMMER: send_to = check.chat_id else: send_to = BOTLOG_CHATID if not trigger_on_fwd and check.fwd_from: return if check.via_bot_id and not trigger_on_inline: return if groups_only and not check.is_group: await check.respond("`Bunun bir qrup olduğunu düşünmürəm.`") return try: await func(check) except events.StopPropagation: raise events.StopPropagation except KeyboardInterrupt: pass except BaseException: if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**USERBOTUN XƏTA HESABATI**\n" link = "[Brend Dəstək Qrupuna](https://t.me/BrendSup)" text += "Userbotunuzda nəsə bir xəta baş verdi." text += f"Xətanın nə olduğunu bilmək istəyirsinizsə bu Hesabatı {link} yönəldin.\n" text += "Xəta və Tarixdən başqa heçbir məlumat qeyd olunmur\n" ftext = "========== DİQQƏT ==========" ftext += "\nBu fayl yalnız buraya yüklənmişdir," ftext += "\nyalnız xəta və tarix hissəsini qeyd etdik," ftext += "\ngizliliyinizə hörmət edirik," ftext += "\nburada hansısa məxfi məlumatlar varsa" ftext += "\nbu bir xəta hesabatı olmaya bilər, heç kim məlumatınıza girə bilməz.\n" ftext += "================================\n\n" ftext += "--------USERBOT XƏTA HİSSƏSİİ--------\n" ftext += "\nTarix: " + date ftext += "\nQrup IDsi: " + str(check.chat_id) ftext += "\nGöndərən istifadəçinin IDsi: " + str(check.sender_id) ftext += "\n\nHadisə səbəbi:\n" ftext += str(check.text) ftext += "\n\nGeri izləmə məlumatı:\n" ftext += str(format_exc()) ftext += "\n\nXəta mətni:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------USERBOT XƏTA HİSSƏSİNİN SONU--------" command = "git log --pretty=format:\"%an: %s\" -10" ftext += "\n\n\nSon 10 hərəkət:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("Brendxəta.log", "w+") file.write(ftext) file.close() if LOGSPAMMER: await check.client.respond("`Bağışlayın, UserBot'um çökdü.\ \nXəta Günlükləri UserBot günlük qrupunda saxlanılır.`") await check.client.send_file(send_to, "Brendxəta.log", caption=text) remove("Brendxəta.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if not LOGSPAMMER: send_to = check.chat_id else: send_to = BOTLOG_CHATID if not trigger_on_fwd and check.fwd_from: return if check.via_bot_id and not trigger_on_inline: return if groups_only and not check.is_group: await check.respond("`Bunun bir qrup olduğunu düşünmürəm!`") return try: await func(check) except events.StopPropagation: raise events.StopPropagation except KeyboardInterrupt: pass except BaseException: if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) eventtext = str(check.text) text = "**C Y B Σ R XƏTA BİLDİRİŞİ**\n" link = "[C Y B Σ R Dəstək Qrupuna](https://t.me/TheCyberSupport)" if len(eventtext)<10: text += f"\n**⚙ Əmr:** {eventtext}\n" text += "\n🔸️ İstəsəniz bunu bizə bildirə bilərsiniz." text += f" Sadəcə bu mesajı {link} göndərin.\n" text += "Xəta və tarix xaricində heç bir şey qeyd edilmir.\n" ftext = "========== XEBERDARLIQ ==========" ftext += "\nBu fayl sadəcə bura yüklənib," ftext += "\nSadəcə xəta və tarixi qeyd edirik," ftext += "\nGizliliyiniz bizim üçün önəmlidir," ftext += "\nBurada hər hansı bir gizli məlumat olarsa" ftext += "\nBu xəta bildirişi olmaz, heç kəs sizin məlumatlarınızı oğurlaya bilməz.\n" ftext += "--------USERBOT XƏTA LOG--------\n" ftext += "\nTarix: " + date ftext += "\nQrup ID: " + str(check.chat_id) ftext += "\nGöndərən adamın ID: " + str(check.sender_id) ftext += "\n\nƏmr:\n" ftext += str(check.text) ftext += "\n\nXəta mətni:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n\nDaha ətraflı:\n" ftext += str(format_exc()) ftext += "\n\n--------USERBOT XETA LOGU SON--------" ftext += "\n\n================================\n" ftext += f"====== ⚠️ Version : {CYBER_VERSION} ======\n" ftext += "================================" command = "git log --pretty=format:\"%an: %s\" -5" ftext += "\n\n\nSon 5 dəyişiklik:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("cyber.log", "w+") file.write(ftext) file.close() if LOGSPAMMER: try: await check.edit("`Bağışlayın,\n ℹ️ Xəta günlükləri UserBot günlük qrupunda saxlanılır.`") except: pass await check.client.send_file(send_to, "cyber.log", caption=text) remove("cyber.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if not trigger_on_fwd and check.fwd_from: return if groups_only and not check.is_group: await check.respond("`I don't think this is a group.`") return try: await func(check) except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt spam chats except KeyboardInterrupt: pass except BaseException: # Check if we have to disable it. # If not silence the log spam on the console, # with a dumb except. if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**USERBOT ERROR REPORT**\n" text += "If you want to, you can report it" text += "Nothing is logged except the fact of error and date\n" ftext = "========== DISCLAIMER ==========" ftext += "\nThis file uploaded ONLY here," ftext += "\nwe logged only fact of error and date," ftext += "\nwe respect your privacy," ftext += "\nyou may not report this error if you've" ftext += "\nany confidential data here, no one will see your data\n" ftext += "================================\n\n" ftext += "--------BEGIN USERBOT TRACEBACK LOG--------" ftext += "\nDate: " + date ftext += "\nGroup ID: " + str(check.chat_id) ftext += "\nSender ID: " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(format_exc()) ftext += "\n\nError text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" command = "git log --pretty=format:\"%an: %s\" -5" ftext += "\n\n\nLast 5 commits:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("error.log", "w+") file.write(ftext) file.close() await check.client.send_file( BOTLOG_CHATID, "error.log", caption=text, ) remove("error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if check.edit_date and check.is_channel and not check.is_group: # Messages sent in channels can be edited by other users. # Ignore edits that take place in channels. return if not LOGSPAMMER: check.chat_id else: pass if not trigger_on_fwd and check.fwd_from: return if groups_only and not check.is_group: await check.respond("`I don't think this is a group.`") return if check.via_bot_id and not insecure and check.out: return try: await func(check) # Thanks to @kandnub for this HACK. # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt spam chats except KeyboardInterrupt: pass except BaseException as e: # Check if we have to disable error logging. if not disable_errors: LOGS.exception(e) # Log the error in console date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**USERBOT ERROR REPORT**\n" link = "[Support Chat](https://t.me/KenVerseChat)" text += "If you want to, you can report it" text += f"- just forward this message to {link}.\n" text += "I won't log anything except the fact of error and date\n" ftext = "\nDisclaimer:\nThis file uploaded ONLY here, " ftext += "we logged only fact of error and date, " ftext += "we respect your privacy, " ftext += "you may not report this error if you've " ftext += "any confidential data here, no one will see your data " ftext += "if you choose not to do so.\n\n" ftext += "--------BEGIN USERBOT TRACEBACK LOG--------" ftext += "\nDate: " + date ftext += "\nChat ID: " + str(check.chat_id) ftext += "\nSender ID: " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(format_exc()) ftext += "\n\nError text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" command = "git log --pretty=format:\"%an: %s\" -10" ftext += "\n\n\nLast 10 commits:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("error.log", "w+") file.write(ftext) file.close() if LOGSPAMMER: await check.client.send_file( BOTLOG_CHATID, "error.log", caption=text, ) else: await check.client.send_file( check.chat_id, "error.log", caption=text, ) remove("error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): # sourcery no-metrics async def wrapper(check): if groups_only and not check.is_group: await edit_delete(check, "`I don't think this is a group.`", 10) return if private_only and not check.is_private: await edit_delete( check, "`I don't think this is a personal Chat.`", 10) return try: await func(check) except events.StopPropagation: raise events.StopPropagation except KeyboardInterrupt: pass except BaseException as e: LOGS.exception(e) if not disable_errors: if BOTLOG_CHATID == 0: return date = (datetime.datetime.now() ).strftime("%m/%d/%Y, %H:%M:%S") ftext = f"\nDisclaimer:\nThis file is pasted only here ONLY here,\ \nwe logged only fact of error and date,\nwe respect your privacy,\ \nyou may not report this error if you've\ \nany confidential data here, no one will see your data\ \n\n--------BEGIN USERBOT TRACEBACK LOG--------\ \nDate: {date}\nGroup ID: {str(check.chat_id)}\ \nSender ID: {str(check.sender_id)}\ \n\nEvent Trigger:\n{str(check.text)}\ \n\nTraceback info:\n{str(traceback.format_exc())}\ \n\nError text:\n{str(sys.exc_info()[1])}" new = { "error": str(sys.exc_info()[1]), "date": datetime.datetime.now(), } ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" command = 'git log --pretty=format:"%an: %s" -5' ftext += "\n\n\nLast 5 commits:\n" output = (await runcmd(command))[:2] result = output[0] + output[1] ftext += result pastelink = paste_text(ftext) text = "**Petercord Error report**\n\n" link = "[here](https://t.me/teamsquaduserbotsupport)" text += "If you wanna you can report it" text += f"- just forward this message {link}.\n" text += ( "Nothing is logged except the fact of error and date\n\n" ) text += f"**Error report : ** [{new['error']}]({pastelink})" await check.client.send_message(BOTLOG_CHATID, text, link_preview=False) if func.__doc__ is not None: CMD_INFO[command[0]].append((func.__doc__).strip()) if pattern is not None: if command is not None: if command[0] in LOADED_CMDS and wrapper in LOADED_CMDS[ command[0]]: return None try: LOADED_CMDS[command[0]].append(wrapper) except BaseException: LOADED_CMDS.update({command[0]: [wrapper]}) if edited: bot.add_event_handler( wrapper, MessageEdited(pattern=REGEX_.regex1, outgoing=True, **kwargs), ) bot.add_event_handler( wrapper, NewMessage(pattern=REGEX_.regex1, outgoing=True, **kwargs), ) if allow_sudo and gvarstatus("sudoenable") is not None: if command is None or command[0] in sudo_enabledcmds: if edited: bot.add_event_handler( wrapper, MessageEdited( pattern=REGEX_.regex2, from_users=_sudousers_list(), **kwargs, ), ) bot.add_event_handler( wrapper, NewMessage( pattern=REGEX_.regex2, from_users=_sudousers_list(), **kwargs, ), ) else: if file_test in LOADED_CMDS and func in LOADED_CMDS[file_test]: return None try: LOADED_CMDS[file_test].append(func) except BaseException: LOADED_CMDS.update({file_test: [func]}) if edited: bot.add_event_handler(func, events.MessageEdited(**kwargs)) bot.add_event_handler(func, events.NewMessage(**kwargs)) return wrapper
def decorator(func): async def wrapper(check): if check.edit_date and check.is_channel and not check.is_group: # Messages sent in channels can be edited by other users. # Ignore edits that take place in channels. return if not LOGSPAMMER: send_to = check.chat_id else: send_to = BOTLOG_CHATID if not trigger_on_fwd and check.fwd_from: return if groups_only and not check.is_group: await check.respond("`I don't think this is a group.`") return try: from userbot.modules.sql_helper.blacklist_sql import get_blacklist for blacklisted in get_blacklist(): if str(check.chat_id) == blacklisted.chat_id: return except Exception: pass if check.via_bot_id and not insecure and check.out: return try: await func(check) # Thanks to @kandnub for this HACK. # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt # spam chats except KeyboardInterrupt: pass except BaseException: # Check if we have to disable it. # If not silence the log spam on the console, # with a dumb except. if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**USERBOT ERROR REPORT**\n" text += "Nothing is logged except the fact of error and date." ftext = "========== DISCLAIMER ==========" ftext += "\nThis file uploaded ONLY here," ftext += "\nwe logged only fact of error and date," ftext += "\nwe respect your privacy," ftext += "\nyou may not report this error if you've" ftext += "\nany confidential data here, no one will see your data\n" ftext += "================================\n\n" ftext += "--------BEGIN USERBOT TRACEBACK LOG--------\n" ftext += "\nDate: " + date ftext += "\nChat ID: " + str(check.chat_id) ftext += "\nSender ID: " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(format_exc()) ftext += "\n\nError text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" command = 'git log --pretty=format:"%an: %s" -10' ftext += "\n\n\nLast 10 commits:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) + str( stderr.decode().strip()) ftext += result with open("error.txt", "w+") as file: file.write(ftext) if LOGSPAMMER: await check.respond( "`Sorry, my userbot has crashed." "\nThe error logs are stored in the userbot's log chat.`" ) async with PasteBin(ftext) as client: await client.post() if client: text += f"\n\nPasted to : [URL]({client.raw_link})" await check.client.send_file(send_to, "error.txt", caption=text) remove("error.txt") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if check.edit_date and check.is_channel and not check.is_group: # Messages sent in channels can be edited by other users. # Ignore edits that take place in channels. return if not is_chat_allowed(check): return if check.via_bot_id and check.out: return try: await func(check) # Thanks to @kandnub for this HACK. # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt # spam chats except KeyboardInterrupt: pass except BaseException as e: # Check if we have to disable error logging. if not disable_errors: LOGS.exception(e) # Log the error in console date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) link = "[Support Chat](https://t.me/KensurOT)" text = ( "**USERBOT ERROR REPORT**\n" "If you want to, you can report it" f"- just forward this message to {link}.\n" "I won't log anything except the fact of error and date\n" ) command = 'git log --pretty=format:"%an: %s" -10' process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() ftext = ( "\nDisclaimer:\nThis file uploaded ONLY here, we " "logged only fact of error and date, we respect your " "privacy, you may not report this error if you've any " "confidential data here, no one will see your data if " "you choose not to do so.\n\n" "--------BEGIN USERBOT TRACEBACK LOG--------" f"\nDate: {date}\nChat ID: {check.chat_id}" f"\nSender ID: {check.sender_id}\n\nEvent Trigger:\n" f"{check.text}\n\nTraceback info:\n{format_exc()}" f"\n\nError text:\n{exc_info()[1]}" "\n\n--------END USERBOT TRACEBACK LOG--------" "\n\n\nLast 10 commits:\n" f"{stdout.decode().strip()}{stderr.decode().strip()}") with open("error.log", "w+") as file: file.write(ftext) if LOGSPAMMER: await check.client.send_file( BOTLOG_CHATID, "error.log", caption=text, ) else: await check.client.send_file( check.chat_id, "error.log", caption=text, ) remove("error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if check.edit_date and check.is_channel and not check.is_group: # Messages sent in channels can be edited by other users. # Ignore edits that take place in channels. return if not LOGSPAMMER: send_to = check.chat_id else: send_to = BOTLOG_CHATID if not trigger_on_fwd and check.fwd_from: return if groups_only and not check.is_group: await check.respond("`I don't think this is a group.`") return if check.via_bot_id and not insecure and check.out: return try: await func(check) # Thanks to @kandnub for this HACK. # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt # spam chats except KeyboardInterrupt: pass except BaseException: # Check if we have to disable it. # If not silence the log spam on the console, # with a dumb except. if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**USERBOT ERROR REPORT**\n" link = "Support chat PM: @adekmaulana" text += "If you want to, you can report it" text += f"- just forward this message to {link}.\n" text += "Nothing is logged except the fact of error and date\n" ftext = "========== DISCLAIMER ==========" ftext += "\nThis file uploaded ONLY here," ftext += "\nwe logged only fact of error and date," ftext += "\nwe respect your privacy," ftext += "\nyou may not report this error if you've" ftext += "\nany confidential data here, no one will see your data\n" ftext += "================================\n\n" ftext += "--------BEGIN USERBOT TRACEBACK LOG--------\n" ftext += "\nDate: " + date ftext += "\nChat ID: " + str(check.chat_id) ftext += "\nSender ID: " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(format_exc()) ftext += "Error text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" command = "git log --pretty=format:\"%an: %s\" -10" ftext += "\n\nLast 10 commits:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result with open("error.log", "w+") as file: file.write(ftext) if LOGSPAMMER: await check.edit( "`Sorry, my userbot has crashed.\nThe error logs are stored in the userbot's log chat.`" ) log = codecs.open("error.log", "r", encoding="utf-8") data = log.read() key = (requests.post( "https://nekobin.com/api/documents", json={ "content": data }, ).json().get("result").get("key")) url = f"https://nekobin.com/raw/{key}" anu = f"{text}\n`Here the error:`\nPasted to: [Nekobin]({url})" await check.client.send_message(send_to, anu) remove("error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if not LOGSPAMMER: send_to = check.chat_id else: send_to = BOTLOG_CHATID if not trigger_on_fwd and check.fwd_from: return if check.via_bot_id and not trigger_on_inline: return if groups_only and not check.is_group: await check.respond("`Bunun bir grup olduğunu sanmıyorum.`") return try: await func(check) except events.StopPropagation: raise events.StopPropagation except KeyboardInterrupt: pass except BaseException: if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**USERBOT HATA RAPORU**\n" link = "[Hawli Destek Grubu](https://t.me/HawliSupport)" text += "İsterseniz, bunu rapor edebilirsiniz" text += f"- sadece bu mesajı buraya iletin {link}.\n" text += "Hata ve Tarih dışında hiçbir şey kaydedilmez\n" ftext = "========== UYARI ==========" ftext += "\nBu dosya sadece burada yüklendi," ftext += "\nsadece hata ve tarih kısmını kaydettik," ftext += "\ngizliliğinize saygı duyuyoruz," ftext += "\nburada herhangi bir gizli veri varsa" ftext += "\nbu hata raporu olmayabilir, kimse verilerinize ulaşamaz.\n" ftext += "================================\n\n" ftext += "--------USERBOT HATA GUNLUGU--------\n" ftext += "\nTarih: " + date ftext += "\nGrup ID: " + str(check.chat_id) ftext += "\nGönderen kişinin ID: " + str(check.sender_id) ftext += "\n\nOlay Tetikleyici:\n" ftext += str(check.text) ftext += "\n\nGeri izleme bilgisi:\n" ftext += str(format_exc()) ftext += "\n\nHata metni:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------USERBOT HATA GUNLUGU BITIS--------" command = "git log --pretty=format:\"%an: %s\" -10" ftext += "\n\n\nSon 10 commit:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("error.log", "w+") file.write(ftext) file.close() if LOGSPAMMER: await check.client.respond( "`Üzgünüm, UserBot'um çöktü.\ \nHata günlükleri UserBot günlük grubunda saklanır.`") await check.client.send_file(send_to, "error.log", caption=text) remove("error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if not LOGSPAMMER: send_to = check.chat_id else: send_to = BOTLOG_CHATID if not trigger_on_fwd and check.fwd_from: return if groups_only and not check.is_group: await check.respond("`I don't think this is a group.`") return if check.via_bot_id and not insecure: return try: await func(check) # Thanks to @kandnub for this HACK. # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt spam chats except KeyboardInterrupt: pass except BaseException: # Check if we have to disable it. # If not silence the log spam on the console, # with a dumb except. if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**USERBOT ERROR REPORT**\n" link = "[Republik Telegram ID](https://t.me/Republik_TelegramID)" text += "Jika kamu mau, kamu bisa melaporkannya" text += f".Ingat dan forward pesan ini ke {link}.\n" text += "Tidak ada yang dicatat kecuali fakta kesalahan dan tanggal\n" ftext = "========== DISCLAIMER ==========" ftext += "\nFile ini Hanya di upload DISINI," ftext += "\nKami hanya mencatat fakta dari kesalahan dan tanggal saja," ftext += "\nKami menghargai privasimu," ftext += "\nAnda tidak perlu melaporkan kesalahan ini jika sudah anda lakukan" ftext += "\ndata rahasia apa pun di sini, tidak ada yang akan melihatnya\n" ftext += "================================\n\n" ftext += "--------BEGIN USERBOT TRACEBACK LOG--------\n" ftext += "\nDate: " + date ftext += "\nChat ID: " + str(check.chat_id) ftext += "\nSender ID: " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(format_exc()) ftext += "\n\nError text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" command = "git log --pretty=format:\"%an: %s\" -10" ftext += "\n\n\nLast 10 commits:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("error.log", "w+") file.write(ftext) file.close() if LOGSPAMMER: await check.client.respond( "`Maaf, Userbotku Tiba-tiba rusak." "\nCatatan error telah di setor ke Grup Chat Userbot Anda.`" ) await check.client.send_file(send_to, "error.log", caption=text) remove("error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if check.edit_date and check.is_channel and not check.is_group: # Messages sent in channels can be edited by other users. # Ignore edits that take place in channels. return if not LOGSPAMMER: send_to = check.chat_id else: send_to = BOTLOG_CHATID if not trigger_on_fwd and check.fwd_from: return if groups_only and not check.is_group: await check.respond("`I don't think this is a group.`") return if check.via_bot_id and not insecure and check.out: return if check.via_bot_id and not trigger_on_inline: return try: await func(check) # Thanks to @kandnub for this HACK. # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt # spam chats except KeyboardInterrupt: pass except BaseException: # Check if we have to disable it. # If not silence the log spam on the console, # with a dumb except. if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**REMIX ERROR REPORT**\n" link = "[OUB REMIX](https://t.me/remixsupport)" text += "If you want to, you can report it" text += f"- just forward this message to {link}.\n" text += "Nothing is logged except the fact of error and date\n" ftext = "========== DISCLAIMER ==========" ftext += "\nThis file uploaded ONLY here," ftext += "\nwe logged only fact of error and date," ftext += "\nwe respect your privacy," ftext += "\nyou may not report this error if you've" ftext += "\nany confidential data here, no one will see your data\n" ftext += "================================\n\n" ftext += "--------BEGIN USERBOT TRACEBACK LOG--------\n" ftext += "\nDate: " + date ftext += "\nChat ID: " + str(check.chat_id) ftext += "\nSender ID: " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(format_exc()) ftext += "\n\nError text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" command = "git log --pretty=format:\"%an: %s\" -10" ftext += "\n\n\nLast 10 commits:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result with open("error.txt", "w+") as file: file.write(ftext) #if LOGSPAMMER: # sorry_msg = await check.respond( # "`Sorry,userbot has crashed.\ # \nCheck botlog group for error logs.`" # ) # await asyncio.sleep(3.5) # await sorry_msg.delete() # await check.client.send_file(send_to, # "error.txt", # caption=text) remove("error.txt") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if group_only and not check.is_group: await check.respond("`Are you sure this is a group?`") return try: await func(check) # # HACK HACK HACK # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly # TODO # Rewrite events to not passing all exceptions # except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt spam chats except KeyboardInterrupt: pass except BaseException: # Check if we have to disable it. # If not silence the log spam on the console, # with a dumb except. if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**Sorry, I encountered an error!**\n" link = "[maintainer of this fork](https://t.me/Polisan_The_Easy_Nick)" text += "If you wanna you can report it" text += f"- just forward this message to {link}.\n" text += "I won't log anything except the fact of error and date\n" ftext = "\nDisclaimer:\nThis file uploaded ONLY here, " ftext += "we logged only fact of error and date, " ftext += "we respect your privacy, " ftext += "you may not report this error if you've " ftext += "any confidential data here, noone will see your data\n\n" ftext += "--------BEGIN USERBOT TRACEBACK LOG--------" ftext += "\nDate: " + date ftext += "\nGroup ID: " + str(check.chat_id) ftext += "\nSender ID: " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(format_exc()) ftext += "\n\nError text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" command = "git log --pretty=format:\"%an: %s\" -5" ftext += "\n\n\nLast 5 commits:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("error.log", "w+") file.write(ftext) file.close() await check.client.send_file( check.chat_id, "error.log", caption=text, ) remove("error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if BOTLOG_CHATID: send_to = BOTLOG_CHATID if not trigger_on_fwd and check.fwd_from: return if groups_only and not check.is_group: await check.respond("`I don't think this is a group.`") return try: await func(check) # Thanks to @kandnub for this HACK. # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt spam chats except KeyboardInterrupt: pass except BaseException: # Check if we have to disable it. # If not silence the log spam on the console, # with a dumb except. if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**OOF-UserBot ERROR REPORT**\n" text += "Mostra il file a @doggy_cheems o a @MarvynSTAR se non sai risolvere\n" ftext = "========== DISCLAIMER ==========" ftext += "\nFile uploaded in logchat," ftext += "\nMostra il file dell'errore all'admin se non sai risolvere" ftext += "\n---------------------------------\n" ftext += "================================\n\n" ftext += "--------INIZIO LOG--------\n" ftext += "\nData: " + date ftext += "\nChat ID: " + str(check.chat_id) ftext += "\nSender ID: " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(format_exc()) ftext += "\n\nError text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------FINE LOG--------" command = "git log --pretty=format:\"%an: %s\" -5" ftext += "\n\n\nUltimi 5 commit:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("OOF-UserBot_error.log", "w+") file.write(ftext) file.close() await check.client.send_file(send_to, "OOF-UserBot_error.log", caption=text) remove("OOF-UserBot_error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if check.edit_date and check.is_channel and not check.is_group: # Messages sent in channels can be edited by other users. # Ignore edits that take place in channels. return if not LOGSPAMMER: send_to = check.chat_id else: send_to = BOTLOG_CHATID if not trigger_on_fwd and check.fwd_from: return if groups_only and not check.is_group: await check.respond("`Saya tidak yakin ini adalah grup.`") return if check.via_bot_id and not insecure and check.out: return try: await func(check) # Thanks to @kandnub for this HACK. # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt # spam chats except KeyboardInterrupt: pass except BaseException: # Check if we have to disable it. # If not silence the log spam on the console, # with a dumb except. if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**LAPORAN KESALAHAN USERBOT**\n" text += "Tidak ada yang dicatat kecuali fakta kesalahan dan tanggal\n\n" ftext = "================= PENOLAKAN =================" ftext += "\nFile ini HANYA diunggah di sini," ftext += "\nkami hanya mencatat fakta kesalahan dan tanggal," ftext += "\nkami menghormati privasi Anda," ftext += "\nAnda tidak dapat melaporkan kesalahan ini jika Anda punya" ftext += "\ndata rahasia apa pun di sini, tidak ada yang akan melihat data Anda\n" ftext += "===============================================\n\n" ftext += "========== MULAI MELACAK LOG USERBOT ==========\n" ftext += "\nTanggal : " + date ftext += "\nID Obrolan : " + str(check.chat_id) ftext += "\nID Pengirim : " + str(check.sender_id) ftext += "\n\nPemicu Peristiwa :\n" ftext += str(check.text) ftext += "\n\nInfo Pelacakan :\n" ftext += str(format_exc()) ftext += "\n\nTeks Kesalahan :\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n========== AKHIR MELACAK LOG USERBOT ==========" command = "git log --pretty=format:\"%an: %s\" -10" ftext += "\n\n\n10 komit terakhir : \n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result with open("error.txt", "w+") as file: file.write(ftext) if LOGSPAMMER: await check.respond( "`Maaf, bot saya ngadat.`\n" "`Kesalahan disimpan dalam obrolan log Userbot.`") log = codecs.open("error.txt", "r", encoding="utf-8") data = log.read() key = (requests.post( "https://nekobin.com/api/documents", json={ "content": data }, ).json().get("result").get("key")) url = f"https://nekobin.com/raw/{key}" anu = f"{text}Ditempel ke : [Nekobin]({url})" await check.client.send_file(send_to, "error.txt", caption=anu) remove("error.txt") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if check.edit_date and check.is_channel and not check.is_group: # Messages sent in channels can be edited by other users. # Ignore edits that take place in channels. return if not LOGSPAMMER: check.chat_id else: pass if not trigger_on_fwd and check.fwd_from: return if groups_only and not check.is_group: await check.respond("`I don't think this is a group.`") return if check.via_bot_id and not insecure and check.out: return try: await func(check) # Thanks to @kandnub for this HACK. # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt # spam chats except KeyboardInterrupt: pass except BaseException: # Check if we have to disable it. # If not silence the log spam on the console, # with a dumb except. if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**NFALXBOT ERROR REPORT**\n" link = "Silahkan chat PM: @Si_Nfal" text += "Untuk melaporkan kesalahan" text += f"- just forward this message to {link}.\n" text += "Nothing is logged except the fact of error and date\n" ftext = "========== DISCLAIMER ==========" ftext += "\nThis file uploaded ONLY here," ftext += "\nwe logged only fact of error and date," ftext += "\nwe respect your privacy," ftext += "\nyou may not report this error if you've" ftext += "\nany confidential data here, no one will see your data\n" ftext += "================================\n\n" ftext += "--------BEGIN USERBOT TRACEBACK LOG--------\n" ftext += "\nDate: " + date ftext += "\nChat ID: " + str(check.chat_id) ftext += "\nSender ID: " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(format_exc()) ftext += "\n\nError text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" command = "git log --pretty=format:\"%an: %s\" -10" ftext += "\n\n\nLast 10 commits:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("error.log", "w+") file.write(ftext) file.close() else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if check.edit_date and check.is_channel and not check.is_group: return if groups_only and not check.is_group: await check.respond("`Are you sure this is a group?`") return if check.via_bot_id and not insecure and check.out: return try: await func(check) except events.StopPropagation: raise events.StopPropagation except KeyboardInterrupt: pass except BaseException: if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "**USERBOT ERROR REPORT**\n" link = "Support chat PM: @NGGDCLXVI" text += "If you want to, you can report it" text += f"- just forward this message to {link}.\n" text += "Nothing is logged except the fact of error and date\n" ftext = "========== DISCLAIMER ==========" ftext += "\nThis file uploaded ONLY here," ftext += "\nwe logged only fact of error and date," ftext += "\nwe respect your privacy," ftext += "\nyou may not report this error if you've" ftext += "\nany confidential data here, no one will see your data\n" ftext += "================================\n\n" ftext += "--------BEGIN USERBOT TRACEBACK LOG--------\n" ftext += "\nDate: " + date ftext += "\nChat ID: " + str(check.chat_id) ftext += "\nSender ID: " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(format_exc()) ftext += "\n\nError text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" command = 'git log --pretty=format:"%an: %s" -10' ftext += "\n\n\nLast 10 commits:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) + \ str(stderr.decode().strip()) ftext += result file = open("crash.txt", "w+") file.write(ftext) file.close() await check.client.send_file( BOTLOG_CHATID if BOTLOG else check.chat_id, "crash.txt", caption=text, ) remove("crash.txt") if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if not LOGSPAMMER: send_to = check.chat_id else: send_to = BOTLOG_CHATID if not trigger_on_fwd and check.fwd_from: return if groups_only and not check.is_group: await check.respond("`I don't think this is a group.`") return try: await func(check) # Thanks to @kandnub for this HACK. # Raise StopPropagation to Raise StopPropagation # This needed for AFK to working properly except events.StopPropagation: raise events.StopPropagation # This is a gay exception and must be passed out. So that it doesnt spam chats except KeyboardInterrupt: pass except BaseException: # Check if we have to disable it. # If not silence the log spam on the console, # with a dumb except. if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) text = "#ERROR\n" text += "**Sorry, I encountered a error!**\n" text += "I won't log anything except the fact of error and date\n" ftext = "========== DISCLAIMER ==========" ftext += "\nThis file uploaded ONLY here," ftext += "\nwe logged only fact of error and date," ftext += "\nwe respect your privacy," ftext += "\nyou may not report this error if you've" ftext += "\nany confidential data here, no one will see your data\n" ftext += "================================\n\n" ftext += "--------BEGIN USERBOT TRACEBACK LOG--------\n" ftext += "\nDate: " + date ftext += "\nChat ID: " + str(check.chat_id) ftext += "\nSender ID: " + str(check.sender_id) ftext += "\n\nEvent Trigger:\n" ftext += str(check.text) ftext += "\n\nTraceback info:\n" ftext += str(format_exc()) ftext += "\n\nError text:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------END USERBOT TRACEBACK LOG--------" command = "git log --pretty=format:\"%an: %s\" -10" ftext += "\n\n\nLast 10 commits:\n" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("ubotx_error.log", "w+") file.write(ftext) file.close() if LOGSPAMMER: await check.respond("`Sorry, my userbot has crashed.\ \nThe error logs are stored in the userbot's log chat.`" ) await check.client.send_file(send_to, "ubotx_error.log", caption=text) remove("ubotx_error.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper
def decorator(func): async def wrapper(check): if not LOGSPAMMER: send_to = check.chat_id else: send_to = BOTLOG_CHATID if not trigger_on_fwd and check.fwd_from: return if check.via_bot_id and not trigger_on_inline: return if groups_only and not check.is_group: await check.respond("`Bunun bir qrup olduğunu düşünmürəm.`") return try: await func(check) except events.StopPropagation: raise events.StopPropagation except KeyboardInterrupt: pass except BaseException: if not disable_errors: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) brendtext = str(check.text) text = "**⚡BREND XƏTA HESABATI⚡**\n\n" link = "[⚡Brend Dəstək Qrupuna](https://t.me/BrendSup)" if len(brendtext)<10: text += f"🧰 Əmr: {brendtext}\n\n" text += "🔹Userbotda xəta aşkar olundu." text += f" Bu Hesabatı {link} göndərin." text += " Beləliklə xətanın nə olduğunu biləcəksiniz\n" ftext = "--------BREND XƏTA BÖLÜMÜ--------\n" ftext += "\nTarix: " + date ftext += "\nQrup IDsi: " + str(check.chat_id) ftext += "\nGöndərən istifadəçinin IDsi: " + str(check.sender_id) ftext += "\n\nXətanın səbəbi:\n" ftext += str(check.text) ftext += "\n\nGeri izləmə məlumatı:\n" ftext += str(format_exc()) ftext += "\n\nXəta mətni:\n" ftext += str(sys.exc_info()[1]) ftext += "\n\n--------BREND XƏTASININ SONU--------" command = "git log --pretty=format:\"%an: %s\" -0" ftext += "ㅤ" process = await asyncsubshell(command, stdout=asyncsub.PIPE, stderr=asyncsub.PIPE) stdout, stderr = await process.communicate() result = str(stdout.decode().strip()) \ + str(stderr.decode().strip()) ftext += result file = open("Brend.log", "w+") file.write(ftext) file.close() if LOGSPAMMER: await check.client.respond("`Bağışlayın, UserBot'um çökdü.\ \nXəta Günlükləri UserBot günlük qrupunda saxlanılır.`") await check.client.send_file(send_to, "Brend.log", caption=text) remove("Brend.log") else: pass if not disable_edited: bot.add_event_handler(wrapper, events.MessageEdited(**args)) bot.add_event_handler(wrapper, events.NewMessage(**args)) return wrapper