Floodwait handling for log_reports and log_forwards
This commit is contained in:
parent
2086c7b138
commit
0766868d2b
|
@ -71,5 +71,11 @@ async def log_forwards(client, message):
|
||||||
if forwardee.is_scam:
|
if forwardee.is_scam:
|
||||||
user_text += ' <code>[SCAM]</code>'
|
user_text += ' <code>[SCAM]</code>'
|
||||||
text += f'{user_text} [<code>{forwardee.id}</code>]'
|
text += f'{user_text} [<code>{forwardee.id}</code>]'
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
await slave.send_message(config['config']['log_chat'], text, disable_web_page_preview=True)
|
await slave.send_message(config['config']['log_chat'], text, disable_web_page_preview=True)
|
||||||
|
except FloodWait as ex:
|
||||||
|
await asyncio.sleep(ex.x + 1)
|
||||||
|
else:
|
||||||
|
break
|
||||||
logged.add(identifier)
|
logged.add(identifier)
|
||||||
|
|
|
@ -67,6 +67,12 @@ async def log_reports(client, message):
|
||||||
if mtext.strip():
|
if mtext.strip():
|
||||||
text += ':'
|
text += ':'
|
||||||
text += f'</a></b> {html.escape(mtext.strip()[:1000])}'
|
text += f'</a></b> {html.escape(mtext.strip()[:1000])}'
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
reply = await slave.send_message(config['config']['log_chat'], text, disable_web_page_preview=True)
|
reply = await slave.send_message(config['config']['log_chat'], text, disable_web_page_preview=True)
|
||||||
|
except FloodWait as ex:
|
||||||
|
await asyncio.sleep(ex.x + 1)
|
||||||
|
else:
|
||||||
|
break
|
||||||
reported.add(identifier)
|
reported.add(identifier)
|
||||||
reported.add((reply.chat.id, reply.message_id))
|
reported.add((reply.chat.id, reply.message_id))
|
||||||
|
|
Loading…
Reference in New Issue