Spaces:
Running
Running
Commit
·
f1c32f6
1
Parent(s):
14d5911
Update app.py
Browse files
app.py
CHANGED
@@ -43,19 +43,19 @@ async def main():
|
|
43 |
# Personal message
|
44 |
if chat_id == sender_id:
|
45 |
# Check the last reply to this sender
|
46 |
-
last_reply_time = reply_times.get(sender_id, None)
|
47 |
if last_reply_time is None or time.time() - last_reply_time > 60: # reply only if not replied in the last minute
|
48 |
response = f'Hello {sender_name}, I received your message and will reply as soon as possible. Thank you for your understanding.'
|
49 |
await client.send_message(chat_id, response)
|
50 |
-
reply_times[sender_id] = time.time() # update the last reply time
|
51 |
|
52 |
# Group message
|
53 |
elif '@Mohammed_Alakhras' in text:
|
54 |
-
last_reply_time = reply_times.get(sender_id, None)
|
55 |
if last_reply_time is None or time.time() - last_reply_time > 60:
|
56 |
response = f'Hello {sender_name}, I received your message and will reply as soon as possible. Thank you for your understanding.'
|
57 |
await client.send_message(chat_id, response)
|
58 |
-
reply_times[sender_id] = time.time()
|
59 |
|
60 |
|
61 |
await client.run_until_disconnected()
|
|
|
43 |
# Personal message
|
44 |
if chat_id == sender_id:
|
45 |
# Check the last reply to this sender
|
46 |
+
last_reply_time = reply_times.get(str(sender_id), None)
|
47 |
if last_reply_time is None or time.time() - last_reply_time > 60: # reply only if not replied in the last minute
|
48 |
response = f'Hello {sender_name}, I received your message and will reply as soon as possible. Thank you for your understanding.'
|
49 |
await client.send_message(chat_id, response)
|
50 |
+
reply_times[str(sender_id)] = time.time() # update the last reply time
|
51 |
|
52 |
# Group message
|
53 |
elif '@Mohammed_Alakhras' in text:
|
54 |
+
last_reply_time = reply_times.get(str(str(chat_id)+str(sender_id)), None)
|
55 |
if last_reply_time is None or time.time() - last_reply_time > 60:
|
56 |
response = f'Hello {sender_name}, I received your message and will reply as soon as possible. Thank you for your understanding.'
|
57 |
await client.send_message(chat_id, response)
|
58 |
+
reply_times[str(str(chat_id)+str(sender_id))] = time.time()
|
59 |
|
60 |
|
61 |
await client.run_until_disconnected()
|