__version__ = (1, 0, 2) # # @@@@@@ @@@@@@ @@@@@@@ @@@@@@@ @@@@@@ @@@@@@@@@@ @@@@@@ @@@@@@@ @@@ @@@ @@@ @@@@@@@@ @@@@@@ # @@@@@@@@ @@@@@@@ @@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@@@@ @@@@@@@@ @@@@@@@@ @@@ @@@ @@@ @@@@@@@@ @@@@@@@ # @@! @@@ !@@ @@! @@! @@@ @@! @@@ @@! @@! @@! @@! @@@ @@! @@@ @@! @@@ @@! @@! !@@ # !@! @!@ !@! !@! !@! @!@ !@! @!@ !@! !@! !@! !@! @!@ !@! @!@ !@! @!@ !@! !@! !@! # @!@!@!@! !!@@!! @!! @!@!!@! @!@ !@! @!! !!@ @!@ @!@ !@! @!@ !@! @!@ !@! @!! @!!!:! !!@@!! # !!!@!!!! !!@!!! !!! !!@!@! !@! !!! !@! ! !@! !@! !!! !@! !!! !@! !!! !!! !!!!!: !!@!!! # !!: !!! !:! !!: !!: :!! !!: !!! !!: !!: !!: !!! !!: !!! !!: !!! !!: !!: !:! # :!: !:! !:! :!: :!: !:! :!: !:! :!: :!: :!: !:! :!: !:! :!: !:! :!: :!: !:! # :: ::: :::: :: :: :: ::: ::::: :: ::: :: ::::: :: :::: :: ::::: :: :: :::: :: :::: :::: :: # : : : :: : : : : : : : : : : : : : : :: : : : : : : :: : : : :: :: :: : : # # © Copyright 2024 # # https://t.me/Den4ikSuperOstryyPer4ik # and # https://t.me/ToXicUse # # 🔒 Licensed under the GNU AGPLv3 # https://www.gnu.org/licenses/agpl-3.0.html # # meta banner: https://raw.githubusercontent.com/Den4ikSuperOstryyPer4ik/Astro-modules/main/Banners/Komaru.jpg # meta developer: @AstroModules from random import choice from telethon.tl.types import ( InputMessagesFilterGif, InputMessagesFilterPhotos, InputMessagesFilterVideo, Message, ) from .. import loader, utils class KomaruMod(loader.Module): '''Random picture/video/gif from the @komarueveryday''' strings = { "name": "Komaru", "choosing": "🔴 Choosing {}...", "gif": "gif", "video": "video", "photo": "photo", } strings_ru = { "choosing": "🔴 Подбираем {}...", "gif": "ваш гиф", "video": "ваше видео", "photo": "вашу картинку(пикчу)", } SEARCH_TYPES = { InputMessagesFilterGif: "gif", InputMessagesFilterPhotos: "photo", InputMessagesFilterVideo: "video", } @loader.command( ru_doc="- подобрать рандом картинку(пикчу)/видео/гиф" ) async def komaru(self, message: Message): """- choose a random picture/gif/video""" search_type = choice([ InputMessagesFilterGif, InputMessagesFilterPhotos, InputMessagesFilterVideo ]) search_type_str = self.strings(self.SEARCH_TYPES[search_type]) msg = await utils.answer(message, self.strings("choosing").format(search_type_str)) chosed_msg = choice([ message_in_channel async for message_in_channel in self.client.iter_messages( "komarueveryday", limit=200, filter=search_type ) ]) reply = None if not (reply := await message.get_reply_message()) else reply.id return await utils.answer_file( msg, chosed_msg, chosed_msg.text or "Подобрал " + search_type_str + ".", reply_to=reply )