async def _(event): if event.fwd_from: return await event.delete() the_real_message = None if event.reply_to_msg_id: event = await event.get_reply_message() the_real_message = yaml_format(event) if len(the_real_message) > Config.MAX_MESSAGE_SIZE_LIMIT: with io.BytesIO(str.encode(the_real_message)) as out_file: out_file.name = "yaml.html" await event.reply( file=out_file, force_document=True, ) else: await event.reply(the_real_message, parse_mode=parse_pre)
async def _(event): if event.fwd_from: return entity = event.chat_id input_str = event.pattern_match.group(1) if input_str: entity = input_str status_message = await event.reply("... this might take some time " "depending on the number of messages " "in the chat ...") mus = 0 hmm = {} async for message in event.client.iter_messages(entity=entity, limit=None): if message and message.file: if message.file.mime_type not in hmm: hmm[message.file.mime_type] = 0 hmm[message.file.mime_type] += message.file.size hnm = {key: humanbytes(hmm[key]) for key in hmm} await status_message.edit(yaml_format(hnm), parse_mode=parse_pre)
async def aexec(code, event): p = lambda _x: print(yaml_format(_x)) reply = await event.get_reply_message() exec(f"async def __aexec(event, reply, client, p): " + "".join(f"\n {l}" for l in code.split("\n"))) return await locals()["__aexec"](event, reply, event.client, p)
async def aexec(code, event): p = lambda _x: print(yaml_format(_x)) reply = await event.get_reply_message() exec(f'async def __aexec(message, reply, client, p): ' + ''.join(f'\n {l}' for l in code.split('\n'))) return await locals()['__aexec'](event, reply, event.client, p)