__version__ = (1, 0, 2) # █ █ ▀ █▄▀ ▄▀█ █▀█ ▀ # █▀█ █ █ █ █▀█ █▀▄ █ # © Copyright 2022 # https://t.me/hikariatama # # 🔒 Licensed under the GNU AGPLv3 # 🌐 https://www.gnu.org/licenses/agpl-3.0.html # meta pic: https://static.dan.tatar/longread_icon.png # meta banner: https://mods.hikariatama.ru/badges/longread.jpg # meta developer: @hikarimods # scope: inline # scope: hikka_only # scope: hikka_min 1.2.10 from telethon.tl.types import Message from .. import loader, utils from ..inline.types import InlineCall, InlineQuery @loader.tds class LongReadMod(loader.Module): """Pack longreads under button spoilers""" strings = { "name": "LongRead", "no_text": "🚫 Please, specify text to hide", "longread": ( "🗄 This is long read\nClick button to show text!\nThis button is" " active within 6 hours" ), } strings_ru = { "no_text": "🚫 Укажи текст, который надо спрятать", "longread": ( "🗄 Это - лонгрид\nНажми на кнопку, чтобы показать текст!\nОна" " активна в течение 6 часов" ), "_cmd_doc_lr": " - Создать лонгрид", "_cls_doc": "Пакует лонгриды под спойлеры", } async def lrcmd(self, message: Message): """ - Create new hidden message""" args = utils.get_args_raw(message) if not args: return await self.inline.form( self.strings("longread"), message, reply_markup={ "text": "📖 Open spoiler", "callback": self._handler, "args": (args,), }, disable_security=True, ) async def lr_inline_handler(self, query: InlineQuery): """Create new hidden message""" text = query.args if not text: return await query.e400() return { "title": "Create new longread", "description": "ℹ This will create button-spoiler", "thumb": "https://img.icons8.com/external-wanicon-flat-wanicon/64/000000/external-read-free-time-wanicon-flat-wanicon.png", "message": self.strings("longread"), "reply_markup": { "text": "📖 Open spoiler", "callback": self._handler, "args": (text,), "disable_security": True, }, } async def _handler(self, call: InlineCall, text: str): """Process button presses""" await call.edit(text) await call.answer()