-
Notifications
You must be signed in to change notification settings - Fork 0
/
telebagger.py
44 lines (37 loc) · 1.91 KB
/
telebagger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from telethon import TelegramClient, events, sync, utils
from telethon.sessions import StringSession
import requests
def SendMessageToAlwaysWin(message):
caps = message.upper()
if ('/USDT' in message) or ('SHORT' in caps) or ('LONG' in caps):
message= "<@&834911692303237172>\n" + message
mUrl = "https://ptb.discord.com/api/webhooks/838079506660851762/7-lpGNlqWGGlO08XZJ3RwAvSXpWGDf5J6Z4ro5bsdtogYGGXovVfmYGmCb3Jvr1RvtWG"
data = {"content": message}
response = requests.post(mUrl, json=data)
def StartTelegramForwarding():
api_id = 5747368
api_hash = '19f6d3c9d8d4e6540bce79c3b9223fbe'
stringsesh = '1BVtsOIIBuxkl8w5skOHjonDCR_DFvM7luxNQA8itLwXv1CYkUSzhUh-sjw6I-qA6esNDR7JLmxUhCdXXE96vb6wMxPTmbWRDTDD626CeEmGa3ohLgJaoH1CeG_28DuYLqnNVsumwhp-rVqFb4Ksvo7GNgnCOiNUOpMthcHT2neKufl6c31LpedhxGoBCnbZIFc4peEK_hwqlJgW7uQAVD2p8LD0LVR70EQxjXnwJ-ROfWScorMUrcV7C2NA1Fg71KFhWpGSoyfkKzgdAD7OIM3E5TdXLdpX-7g4lwQCloCL1GODnhGQD28eAwcHZ4Y7b_OWO3Ueeej7esgIbzx7NAJGJkfTTifI='
client = TelegramClient(StringSession(stringsesh), api_id, api_hash)
@client.on(events.NewMessage())
async def my_event_handler(event):
#print(event.raw_text)
sender = await event.get_sender()
chat = await event.get_chat()
sender_id = str(sender.id)
channel_name = utils.get_display_name(sender)
msg = "Channel name: " + channel_name + " | ID: " + sender_id
#print(msg)
if sender_id == "1375168387":
SendMessageToAlwaysWin(event.raw_text)
await client.send_message(1576065688, event.message)
elif chat.id == 1899129008:
print("Robot Section +++")
if str(event.raw_text) == '/stop':
print('Exiting....')
#await client.disconnect()
print("Starting telegram scraper")
client.start()
client.get_dialogs()
client.run_until_disconnected()
StartTelegramForwarding()