diff options
| author | Mroik <mroik@delayed.space> | 2024-04-13 21:50:09 +0200 |
|---|---|---|
| committer | Mroik <mroik@delayed.space> | 2025-02-01 19:56:16 +0100 |
| commit | 4aa166882444c039b5a977eb28595df141697f49 (patch) | |
| tree | a39424e13971aae59102bd708ff7c9965171b80c /userbot.py | |
| parent | ec3f1a80a064eadf91b58c9a3f309b1ddc42fd5a (diff) | |
Better output
Diffstat (limited to 'userbot.py')
| -rw-r--r-- | userbot.py | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,6 +1,6 @@ from telethon import TelegramClient, events from telethon.tl.patched import Message -from telethon.tl.types import Chat +from telethon.tl.types import Chat, User from config import API_ID, API_HASH, WORDLIST, BOTNICK client = TelegramClient("notify-on-untagged", int(API_ID), API_HASH) @@ -11,9 +11,10 @@ client.parse_mode = "markdown" async def check_message(event): message: Message = event.message c: Chat = await message.get_chat() + sender: User = await message.get_sender() + name = sender.username or sender.first_name found = len(list(filter(lambda x: x in message.message.lower(), WORDLIST))) > 0 - if found and not message.mentioned: - print(f"[{message.chat_id}](https://t.me/c/{message.chat_id}/{message.id})") - to_send = f"[{message.from_id.user_id}](tg://user?id={message.from_id.user_id}) " + if found and (message.mentioned is False or message.mentioned is None): + to_send = f"[{name}](tg://user?id={message.from_id.user_id}) " to_send += f"tagged you in [{c.id}](https://t.me/c/{c.id}/{message.id})" await client.send_message(BOTNICK, to_send) |
