Skip to content

Instantly share code, notes, and snippets.

@OlegKorn
Created December 8, 2024 07:19
Show Gist options
  • Save OlegKorn/a1a934ec2e0d3c1dc9090c7192b10ed7 to your computer and use it in GitHub Desktop.
Save OlegKorn/a1a934ec2e0d3c1dc9090c7192b10ed7 to your computer and use it in GitHub Desktop.
telethon - мониторинг каналов тг по словам
# автор =- 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