MohammedAlakhras commited on
Commit
16fd271
ยท
1 Parent(s): f959059

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -9,7 +9,6 @@ proxy_port = 2434
9
  proxy_secret = 'ee32b920dffb51643028e2f6b878d4eac1666172616b61762e636f6d'
10
  proxy_dc_id = 2 # This is usually 2 for MTProto proxies
11
 
12
- #('hostname', port, 'secret')
13
  proxy = (
14
  socks.SOCKS5,
15
  proxy_server,
@@ -27,7 +26,7 @@ phone = '+963994935356'
27
  reply_times = {}
28
 
29
  async def main():
30
- async with TelegramClient('anon', api_id, api_hash, proxy=proxy) as client:
31
  @client.on(events.NewMessage())
32
  async def my_event_handler(event):
33
  sender = await event.get_sender()
@@ -58,7 +57,8 @@ async def main():
58
  await client.send_message(chat_id, response)
59
  reply_times[sender_id] = time.time()
60
 
61
- await client.run_until_disconnected()
 
62
 
63
  # ุชุนุฑูŠู ุญู‚ูˆู„ ุงู„ู†ุต ููŠ Gradio
64
 
@@ -68,4 +68,4 @@ output = "text"
68
  gr.Interface(fn=main, inputs=inputs, outputs=output).launch()
69
 
70
  # Run the main function in the event loop
71
- # client.loop.run_until_complete(main())
 
9
  proxy_secret = 'ee32b920dffb51643028e2f6b878d4eac1666172616b61762e636f6d'
10
  proxy_dc_id = 2 # This is usually 2 for MTProto proxies
11
 
 
12
  proxy = (
13
  socks.SOCKS5,
14
  proxy_server,
 
26
  reply_times = {}
27
 
28
  async def main():
29
+ async with TelegramClient('anon', api_id, api_hash) as client:
30
  @client.on(events.NewMessage())
31
  async def my_event_handler(event):
32
  sender = await event.get_sender()
 
57
  await client.send_message(chat_id, response)
58
  reply_times[sender_id] = time.time()
59
 
60
+ # await client.run_until_disconnected()
61
+ client.loop.run_until_complete(main())
62
 
63
  # ุชุนุฑูŠู ุญู‚ูˆู„ ุงู„ู†ุต ููŠ Gradio
64
 
 
68
  gr.Interface(fn=main, inputs=inputs, outputs=output).launch()
69
 
70
  # Run the main function in the event loop
71
+ # client.loop.run_until_complete(main())