add delay between image sends

This commit is contained in:
bakatrouble 2024-09-25 18:37:37 +03:00
parent 07d927ef4d
commit 8320933422

View File

@ -2,6 +2,7 @@ import json
import logging import logging
import os import os
import traceback import traceback
from time import sleep
from telegram import Bot, InlineKeyboardMarkup, InlineKeyboardButton from telegram import Bot, InlineKeyboardMarkup, InlineKeyboardButton
from telegram.error import RetryAfter from telegram.error import RetryAfter
@ -38,6 +39,7 @@ def upload_image_rpc(self, queued_image_pk, fpath, caption):
qi.processed = True qi.processed = True
qi.save() qi.save()
os.unlink(fpath) os.unlink(fpath)
sleep(.3)
except RetryAfter as e: except RetryAfter as e:
raise self.retry(exc=e, countdown=int(e.retry_after)) raise self.retry(exc=e, countdown=int(e.retry_after))
except Exception as e: except Exception as e: