Floodwait handling for log_reports and log_forwards

This commit is contained in:
blank X 2020-11-30 15:35:28 +07:00
parent 2086c7b138
commit 0766868d2b
2 changed files with 14 additions and 2 deletions

View File

@ -71,5 +71,11 @@ async def log_forwards(client, message):
if forwardee.is_scam:
user_text += ' <code>[SCAM]</code>'
text += f'{user_text} [<code>{forwardee.id}</code>]'
await slave.send_message(config['config']['log_chat'], text, disable_web_page_preview=True)
while True:
try:
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)

View File

@ -67,6 +67,12 @@ async def log_reports(client, message):
if mtext.strip():
text += ':'
text += f'</a></b> {html.escape(mtext.strip()[:1000])}'
reply = await slave.send_message(config['config']['log_chat'], text, disable_web_page_preview=True)
while True:
try:
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((reply.chat.id, reply.message_id))