def wrap(client, message): if message.empty: return try: if len(me) < 1: me.append(app.get_me()) if me[0].id in BLACKLIST: raise RetardsException('RETARDS CANNOT USE THIS BOT') if message.service and not service: return if message.chat.type == 'channel': return if not bot and message.chat.type == 'bot': message.continue_propagation() if not private and message.chat.type in ['private', 'bot']: if not disable_notify: edit(message, f'`{get_translation("groupUsage")}`') return if not group and message.chat.type in ['group', 'supergroup']: if not disable_notify: edit(message, f'`{get_translation("privateUsage")}`') return if not compat: func(client, message) else: func(message) except RetardsException: try: app.stop() except BaseException: pass execl(executable, 'killall', executable) except ContinuePropagation as c: raise c except Exception as e: if disable_notify: return try: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) if f'{_parsed_prefix}crash' == f'{message.text}'.split( )[0]: text = f'{get_translation("logidTest")}' else: edit(message, f'`{get_translation("errorLogSend")}`') link = get_translation("supportGroup", [SUPPORT_GROUP]) text = get_translation("sedenErrorText", ['**', link]) ftext = get_translation("sedenErrorText2", [ date, message.chat.id, message.from_user.id if message.from_user else "Unknown", message.text, format_exc(), exc_info()[1] ]) process = Popen( ['git', 'log', '--pretty=format:"%an: %s"', '-10'], stdout=PIPE, stderr=PIPE) out, err = process.communicate() out = f'{out.decode()}\n{err.decode()}'.strip() ftext += out file = open(f'{get_translation("rbgLog")}', 'w+') file.write(ftext) file.close() send_log_doc(f'{get_translation("rbgLog")}', caption=text, remove_file=True) raise e except Exception as x: raise x
def wrap(client, message): if message.empty or not message.from_user: return try: if 'ME' not in TEMP_SETTINGS: me = app.get_me() TEMP_SETTINGS['ME'] = me if me.id in BLACKLIST: raise RetardsException('RETARDS CANNOT USE THIS BOT') if message.service and not service: return if message.chat.type == 'channel': return if not bot and message.chat.type == 'bot': message.continue_propagation() if not private and message.chat.type in ['private', 'bot']: if not disable_notify: edit(message, f'`{get_translation("groupUsage")}`') message.continue_propagation() if not group and 'group' in message.chat.type: if not disable_notify: edit(message, f'`{get_translation("privateUsage")}`') message.continue_propagation() if admin and not is_admin(message): if not disable_notify: edit(message, f'`{get_translation("adminUsage")}`') message.continue_propagation() if not compat: func(client, message) else: func(message) except RetardsException: try: system(f'kill -9 {getpid()}') except BaseException: pass except (ContinuePropagation, StopPropagation) as c: raise c except Exception as e: try: date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) if get_cmd(message) == 'crash': text = get_translation('logidTest') else: if not disable_notify: edit(message, f'`{get_translation("errorLogSend")}`') text = get_translation( 'sedenErrorText', ['**', '`', exc_info()[1]] ) ftext = get_translation( 'sedenErrorText2', [ date, message.chat.id, message.from_user.id if message.from_user else 'Unknown', BOT_VERSION, message.text, format_exc(), exc_info()[1], ], ) process = Popen( ['git', 'log', '--pretty=format:"%an: %s"', '-10'], stdout=PIPE, stderr=PIPE, ) out, err = process.communicate() out = f'{out.decode()}\n{err.decode()}'.strip() ftext += out file = open(get_translation('rbgLog'), 'w+') file.write(ftext) file.close() send_log_doc( get_translation('rbgLog'), caption=text, remove_file=True ) raise e except Exception as x: raise x
def get_me(): return app.get_me()