# █ █ █ █▄▀ ▄▀█ █▀▄▀█ █▀█ █▀█ █ █ # █▀█ █ █ █ █▀█ █ ▀ █ █▄█ █▀▄ █▄█ # 🔒 Licensed under the GNU GPLv3 # 🌐 https://www.gnu.org/licenses/agpl-3.0.html # 👤 https://t.me/hikamoru # meta developer: @hikamorumods # meta pic: https://te.legra.ph/file/5ef64ee0466032d8a4687.png # meta banner: hhttps://raw.githubusercontent.com/AmoreForever/assets/master/Telegraphup.jpg from .. import loader, utils import requests from telethon.tl.types import DocumentAttributeFilename @loader.tds class Telegraphup(loader.Module): """Upload video and photo to telegraph""" strings = { "name": "Telegraph", "pls_reply": "⚠️ Reply to photo or video/gif", } @loader.sudo async def thupcmd(self, message): """""" if message.is_reply: reply_message = await message.get_reply_message() data = await check_media(reply_message) if isinstance(data, bool): await message.edit(self.strings("pls_reply")) return else: await message.edit(self.strings("pls_reply")) return file = await message.client.download_media(data, bytes) path = requests.post( "https://te.legra.ph/upload", files={"file": ("file", file, None)} ).json() try: amore = "https://te.legra.ph" + path[0]["src"] except KeyError: amore = path["error"] await utils.answer(message, f"😸 Your file uploaded: {amore}") async def check_media(reply_message): if reply_message and reply_message.media: if reply_message.photo: data = reply_message.photo elif reply_message.document: if ( DocumentAttributeFilename(file_name="AnimatedSticker.tgs") in reply_message.media.document.attributes ): return False if reply_message.audio or reply_message.voice: return False data = reply_message.media.document else: return False else: return False if not data or data is None: return False else: return data