🐛 Fix floodwait error
This commit is contained in:
parent
bd2d03f9e7
commit
b126213c49
@ -4,5 +4,5 @@ from pyrogram.types import Message
|
||||
|
||||
@Client.on_message(filters.incoming & filters.private &
|
||||
filters.command(["ping", ]))
|
||||
async def force_update(bot: Client, message: Message):
|
||||
async def ping_check(bot: Client, message: Message):
|
||||
await message.reply("poi ~", quote=True)
|
||||
|
@ -15,18 +15,18 @@ from defs.source import update_data, compare, download
|
||||
async def send_track_msg(file, track_msg):
|
||||
if file:
|
||||
await app.send_document(channel_id, file,
|
||||
caption=track_msg.text,
|
||||
caption=track_msg.text[:1000],
|
||||
file_name=track_msg.name,
|
||||
force_document=True,
|
||||
parse_mode="html",
|
||||
reply_markup=track_msg.button)
|
||||
else:
|
||||
await app.send_message(channel_id, track_msg.text,
|
||||
await app.send_message(channel_id, track_msg.text[:1000],
|
||||
parse_mode="html",
|
||||
reply_markup=track_msg.button)
|
||||
|
||||
|
||||
# @scheduler.scheduled_job("cron", minute="*/30", id="0")
|
||||
@scheduler.scheduled_job("cron", minute="*/30", id="0")
|
||||
async def run_every_30_minute():
|
||||
await update_data()
|
||||
need_update = compare()
|
||||
@ -58,13 +58,14 @@ async def run_every_30_minute():
|
||||
await send_track_msg(None, track_msg)
|
||||
except FloodWait as e:
|
||||
print(f"Send document flood - Sleep for {e.x} second(s)")
|
||||
await sleep(uniform(0.5, 1.0))
|
||||
await sleep(e.x + uniform(0.5, 1.0))
|
||||
await send_track_msg(None, track_msg)
|
||||
except ButtonUrlInvalid:
|
||||
print(f"Send button error")
|
||||
await app.send_message(channel_id, track_msg.text, parse_mode="html",)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
await sleep(uniform(0.5, 2.0))
|
||||
|
||||
|
||||
@Client.on_message(filters.incoming & filters.private & filters.chat(admin_id) &
|
||||
|
Loading…
Reference in New Issue
Block a user