Multiple channel support
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -6,12 +6,18 @@ load_dotenv()
|
|||||||
|
|
||||||
api_id = os.getenv('API_ID')
|
api_id = os.getenv('API_ID')
|
||||||
api_hash = os.getenv('API_HASH')
|
api_hash = os.getenv('API_HASH')
|
||||||
chat = 'tg1337const'
|
chats = [
|
||||||
|
'tg1337const',
|
||||||
|
'cyberboec',
|
||||||
|
'Ateobreaking'
|
||||||
|
]
|
||||||
|
|
||||||
def cleanup(msg):
|
def cleanup(msg):
|
||||||
unwanted_strings = [
|
unwanted_strings = [
|
||||||
'[1337const | подписаться](https://t.me/tg1337const)',
|
'[1337const | подписаться](https://t.me/tg1337const)',
|
||||||
'[1337const | Подписаться](https://t.me/tg1337const)'
|
'[1337const | Подписаться](https://t.me/tg1337const)',
|
||||||
|
'**',
|
||||||
|
'__'
|
||||||
]
|
]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -25,6 +31,8 @@ def cleanup(msg):
|
|||||||
|
|
||||||
with TelegramClient('bot', api_id, api_hash) as client:
|
with TelegramClient('bot', api_id, api_hash) as client:
|
||||||
f = open("data/data.txt", "w")
|
f = open("data/data.txt", "w")
|
||||||
|
|
||||||
|
for chat in chats:
|
||||||
for message in client.iter_messages(chat):
|
for message in client.iter_messages(chat):
|
||||||
try:
|
try:
|
||||||
f.write(cleanup(message.text))
|
f.write(cleanup(message.text))
|
||||||
|
|||||||
Reference in New Issue
Block a user