Created
December 8, 2024 07:19
-
-
Save OlegKorn/a1a934ec2e0d3c1dc9090c7192b10ed7 to your computer and use it in GitHub Desktop.
telethon - мониторинг каналов тг по словам
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# автор =- https://github.com/security-hab/telegram-keyword-monitor/blob/main/main.py | |
channels_to_monitor = ['elite_estate', 'tash_nedvij', 'myhouse773', 'realestatemurod1', | |
'realtor_yunusov', 'apartments_tashkent', 'TheBestHomeUz', 'reeltoruz'] # Список имен каналов | |
keywords = ['аренда', 'Аренда', 'АРЕНДА', 'коммерческое', 'нежилое'] # Список ключевых слов | |
group_id_for_notifications = -1002370398266 # ID вашей группы | |
# Асинхронная функция для мониторинга каналов | |
@client.on(events.NewMessage(chats=channels_to_monitor)) | |
async def handler(event): | |
message_text = event.message.message | |
if any(keyword.lower() in message_text.lower() for keyword in keywords): | |
print(f"Найдено ключевое слово в сообщении: {message_text}") | |
links = extract_links(message_text) | |
if links: | |
print("Найденные ссылки:", links) | |
# save_message_to_file(message_text) | |
await client.forward_messages(group_id_for_notifications, event.message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment