Multiple channel support
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-04-02 23:32:19 +03:00
parent 1f7ab0c2cb
commit 96e034d478

View File

@@ -6,12 +6,18 @@ load_dotenv()
api_id = os.getenv('API_ID')
api_hash = os.getenv('API_HASH')
chat = 'tg1337const'
chats = [
'tg1337const',
'cyberboec',
'Ateobreaking'
]
def cleanup(msg):
unwanted_strings = [
'[1337const | подписаться](https://t.me/tg1337const)',
'[1337const | Подписаться](https://t.me/tg1337const)'
'[1337const | Подписаться](https://t.me/tg1337const)',
'**',
'__'
]
try:
@@ -25,10 +31,12 @@ def cleanup(msg):
with TelegramClient('bot', api_id, api_hash) as client:
f = open("data/data.txt", "w")
for message in client.iter_messages(chat):
try:
f.write(cleanup(message.text))
except:
pass
for chat in chats:
for message in client.iter_messages(chat):
try:
f.write(cleanup(message.text))
except:
pass
f.close()