Commit
·
73c328a
1
Parent(s):
071fa59
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,8 @@ from telethon.sync import TelegramClient, events
|
|
| 3 |
import datetime
|
| 4 |
import socks
|
| 5 |
import time
|
|
|
|
|
|
|
| 6 |
|
| 7 |
proxy_server = '142.93.68.63'
|
| 8 |
proxy_port = 2434
|
|
@@ -18,9 +20,15 @@ proxy = (
|
|
| 18 |
'unlimited'
|
| 19 |
)
|
| 20 |
|
| 21 |
-
api_id = '10086982'
|
| 22 |
-
api_hash = '3ed461889a88b31fcbc323d13e43cf7e'
|
| 23 |
-
phone = '+963994935356'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
# Dictionary to track the times when senders were last replied to
|
| 26 |
reply_times = {}
|
|
@@ -46,7 +54,7 @@ async def main():
|
|
| 46 |
reply_times[str(sender_id)] = time.time() # update the last reply time
|
| 47 |
|
| 48 |
# Group message
|
| 49 |
-
elif
|
| 50 |
last_reply_time = reply_times.get(str(str(chat_id)+str(sender_id)), None)
|
| 51 |
if last_reply_time is None or time.time() - last_reply_time > 60*5:
|
| 52 |
response = f'Hello <a href="tg://user?id={sender_id}">{sender_name}</a> @ <a href="https://t.me/c/{chat_id}">{chat.title}</a>,\n I received your message and will reply as soon as possible. Thank you for your understanding.'
|
|
|
|
| 3 |
import datetime
|
| 4 |
import socks
|
| 5 |
import time
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
|
| 9 |
proxy_server = '142.93.68.63'
|
| 10 |
proxy_port = 2434
|
|
|
|
| 20 |
'unlimited'
|
| 21 |
)
|
| 22 |
|
| 23 |
+
#api_id = '10086982'
|
| 24 |
+
#api_hash = '3ed461889a88b31fcbc323d13e43cf7e'
|
| 25 |
+
#phone = '+963994935356'
|
| 26 |
+
api_id=os.environ['apiID']
|
| 27 |
+
api_hash=os.environ['apiHash']
|
| 28 |
+
phone=os.environ['phone']
|
| 29 |
+
username=os.environ['username']
|
| 30 |
+
|
| 31 |
+
|
| 32 |
|
| 33 |
# Dictionary to track the times when senders were last replied to
|
| 34 |
reply_times = {}
|
|
|
|
| 54 |
reply_times[str(sender_id)] = time.time() # update the last reply time
|
| 55 |
|
| 56 |
# Group message
|
| 57 |
+
elif username in text:
|
| 58 |
last_reply_time = reply_times.get(str(str(chat_id)+str(sender_id)), None)
|
| 59 |
if last_reply_time is None or time.time() - last_reply_time > 60*5:
|
| 60 |
response = f'Hello <a href="tg://user?id={sender_id}">{sender_name}</a> @ <a href="https://t.me/c/{chat_id}">{chat.title}</a>,\n I received your message and will reply as soon as possible. Thank you for your understanding.'
|