MohammedAlakhras commited on
Commit
a03f7d7
·
1 Parent(s): 4a4cb82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -4,6 +4,15 @@ import datetime
4
  import socks
5
  import time
6
  import os
 
 
 
 
 
 
 
 
 
7
 
8
 
9
  proxy_server = '142.93.68.63'
@@ -27,12 +36,15 @@ username=os.environ['username']
27
 
28
  serssionFile=os.environ['sessionUrlFile']
29
 
 
 
 
30
 
31
  # Dictionary to track the times when senders were last replied to
32
  reply_times = {}
33
 
34
  async def main():
35
- async with TelegramClient(serssionFile, api_id, api_hash) as client:
36
  @client.on(events.NewMessage())
37
  async def my_event_handler(event):
38
  sender = await event.get_sender()
 
4
  import socks
5
  import time
6
  import os
7
+ import requests
8
+
9
+ def download_file(url, filename):
10
+ response = requests.get(url)
11
+ with open(filename, 'wb') as file:
12
+ file.write(response.content)
13
+
14
+
15
+
16
 
17
 
18
  proxy_server = '142.93.68.63'
 
36
 
37
  serssionFile=os.environ['sessionUrlFile']
38
 
39
+ download_file(serssionFile, 'an.session')
40
+
41
+
42
 
43
  # Dictionary to track the times when senders were last replied to
44
  reply_times = {}
45
 
46
  async def main():
47
+ async with TelegramClient(an, api_id, api_hash) as client:
48
  @client.on(events.NewMessage())
49
  async def my_event_handler(event):
50
  sender = await event.get_sender()