Skip to content

Commit d375852

Browse files
Update
1 parent 27f48f6 commit d375852

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

jd_panda_token.py

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import asyncio
2+
import re
3+
import threading
4+
5+
from telethon import TelegramClient
6+
from telethon.helpers import TotalList
7+
8+
api_id = 0
9+
api_hash = ''
10+
client = TelegramClient('anon', api_id, api_hash, proxy=('http', '127.0.0.1', 1080))
11+
12+
13+
async def click(msg):
14+
print('click')
15+
await msg.click(0)
16+
17+
18+
async def main():
19+
msg = await client.get_messages('@pang_da_bot', ids=39861)
20+
if type(msg) == list:
21+
msg = msg[0]
22+
t = threading.Thread(target=asyncio.run, args=(click(msg),))
23+
t.daemon = True
24+
t.start()
25+
await asyncio.sleep(2)
26+
27+
print('main')
28+
msg = await client.get_messages('@pang_da_bot', limit=1)
29+
if type(msg) == TotalList:
30+
msg = msg[0]
31+
32+
token = re.search(r"你的Token (.*)\n", msg.message).group(1)
33+
print('token:', token)
34+
35+
with open('.env', 'r') as f:
36+
txt = f.read()
37+
txt = txt.replace(re.search(r'(PANDA_TOKEN=".*")', txt).group(1), f'PANDA_TOKEN="{token}"')
38+
with open('.env', 'w') as f:
39+
f.write(txt)
40+
41+
42+
with client:
43+
client.loop.run_until_complete(main())

0 commit comments

Comments
 (0)