You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 rivejä
912 B
37 rivejä
912 B
import asyncio |
|
import json |
|
|
|
# Change this: |
|
USER_PHONE = '+19705736497' |
|
|
|
from telethon.sync import TelegramClient, events, utils |
|
|
|
TELETHON_SPAM = -1001382672427 |
|
BWB = -1001146421621 |
|
HORSESHOE = -1001269329011 |
|
|
|
SESSION = 'telethon' |
|
API_ID = '929249' # semi-secret |
|
API_HASH = '00c171d347a5140ddf2212157ab2a37a' # semi-secret |
|
|
|
client = TelegramClient(SESSION, API_ID, API_HASH, sequential_updates=True) |
|
client.start(USER_PHONE) |
|
|
|
@client.on(events.NewMessage(chats=(HORSESHOE))) |
|
async def new_message(event): |
|
text = event.raw_text |
|
print('[{}]: {}'.format(event.sender.first_name, text)) |
|
|
|
if text and len(text) < 1000: |
|
m = {} |
|
m['chat_id'] = event.chat_id |
|
m['mid'] = event.id |
|
m['from_id'] = event.sender_id |
|
m['raw_text'] = event.raw_text |
|
|
|
j = json.dumps(m) |
|
|
|
await client.send_message(BWB, j) |
|
|
|
print('Loaded.') |
|
asyncio.get_event_loop().run_forever()
|
|
|