Download bot/plugins/callback.py from dimag69/tg-fs: direct link, hf CLI and curl.
- Browser
- Download file 801 Bytes
-
https://huggingface.co/spaces/dimag69/tg-fs/resolve/main/bot/plugins/callback.py
- Command line
-
hf download hf://spaces/dimag69/tg-fs/bot/plugins/callback.py
-
curl -L -o callback.py https://huggingface.co/spaces/dimag69/tg-fs/resolve/main/bot/plugins/callback.py
801 Bytes
| from telethon.events import CallbackQuery | |
| from bot import TelegramBot | |
| from bot.modules.decorators import verify_user | |
| from bot.modules.static import * | |
| from bot.modules.telegram import get_message | |
| async def delete_file(event: CallbackQuery.Event): | |
| query_data = event.query.data.decode().split('_') | |
| if len(query_data) != 3: | |
| return await event.answer(InvalidQueryText, alert=True) | |
| message = await get_message(int(query_data[1])) | |
| if not message: | |
| return await event.answer(MessageNotExist, alert=True) | |
| if query_data[2] != message.raw_text: | |
| return await event.answer(InvalidQueryText, alert=True) | |
| await message.delete() | |
| return await event.answer(LinkRevokedText, alert=True) | |