from .. import loader, utils import io @loader.tds class MTFMod(loader.Module): """send Message as file""" strings = {'name': 'MessageToFile'} async def mtfcmd(self, message): """.mtf """ reply = await message.get_reply_message() if not reply or not reply.message: await message.edit("Reply to text!") return text = bytes(reply.raw_text, "utf8") fname = utils.get_args_raw(message) or str(message.id+reply.id)+".txt" file = io.BytesIO(text) file.name = fname file.seek(0) await reply.reply(file=file) await message.delete() async def ftmcmd(self, message): """.ftm """ reply = await message.get_reply_message() if not reply or not reply.file: await message.edit("Reply to file!") return text = await reply.download_media(bytes) text = str(text, "utf8") if utils.get_args(message): text = f"{text}" await utils.answer(message, utils.escape_html(text))