__version__ = (1, 0, 0) # ▀█▀ █ █ █▀█ █▀▄▀█ ▄▀█ █▀ # █  █▀█ █▄█ █ ▀ █ █▀█ ▄█ # https://t.me/netuzb # # 🔒 Licensed under the GNU AGPLv3 # 🌐 https://www.gnu.org/licenses/agpl-3.0.html # meta desc: Manager bot for working on modules (all Python files in general). # meta pic: https://te.legra.ph/file/e534f736497cd1b3e711b.png # meta banner: https://te.legra.ph/file/16c25a32943f74d7a47bf.jpg # meta developer: @wilsonmods # scope: hikka_only # scope: hikka_min 1.4.0 from pygments.formatters import ImageFormatter from pygments.lexers import Python3Lexer from asyncio import sleep from .. import loader, utils import pygments import os import io # EMOJI PLACE em_warn = "🚨 " em_wait = "🕒 " manage_byte = "utf8" @loader.tds class CodeManagerMod(loader.Module): """Manager bot for working on modules (all Python files in general).""" strings = { "name": "👨‍💻 Code-Manager", "manager_reply_to_msg": em_warn + ( "Reply to message." ), "manager_reply_to_file": em_warn + ( "Please, reply to file." ), "manager_pls_wait": em_wait + ( "Please, wait for end..." ), "manager_code_name": "-code-manager.py", } strings_ru = { "manager_reply_to_msg": em_warn + ( "Необходимо ответить реплэем на" " кодовое сообщение..." ), "manager_reply_to_file": em_warn + ( "Укажи файл с реплэем..." ), "manager_pls_wait": em_wait + ( "Пожалуйста, дождитесь окончания..." ), } strings_uz = { "manager_reply_to_msg": em_warn + ( "Faylga konvertlash uchun kerakli" " habarga javob tariqasida..." ), "manager_reply_to_file": em_warn + ( "Faylga javob tariqasida..." ), "manager_pls_wait": em_wait + ( "Iltimos, tayyor bo'lguncha kuting..." ), } async def client_ready(self, client, db): self.client = client async def tofilecmd(self, message): """Reply to message code""" text = utils.get_args_raw(message) reply = await message.get_reply_message() if not reply or not reply.message: await message.edit(self.strings("manager_reply_to_file", message)) return text = bytes(reply.raw_text, manage_byte) fname = utils.get_args_raw(message) or str(message.id+reply.id) + self.strings('manager_code_name') file = io.BytesIO(text) file.name = fname file.seek(0) await reply.reply(file=file) await message.delete() async def tofilencmd(self, message): """[name.format] - Reply to message code (enter the name and format)""" text = utils.get_args_raw(message) reply = await message.get_reply_message() if not reply or not reply.message: await message.edit(self.strings("manager_reply_to_file", message)) return text = bytes(reply.raw_text, manage_byte) fname = utils.get_args_raw(message) or str(message.id+reply.id)+f"{text}" file = io.BytesIO(text) file.name = fname file.seek(0) await reply.reply(file=file) await message.delete() async def tomsgcmd(self, message): """Reply to file code""" reply = await message.get_reply_message() if not reply or not reply.file: await message.edit(self.strings("manager_reply_to_msg", message)) return await message.edit(self.strings("manager_pls_wait", message)) await sleep(0.9) text = await reply.download_media(bytes) text = str(text, manage_byte) text = f"{text}" await utils.answer(message, utils.escape_html(text))