mirror of
https://github.com/omg-xtao/ytdlbot.git
synced 2024-11-16 03:45:23 +00:00
random delay
This commit is contained in:
parent
955fe2ad1f
commit
5c792aa0c4
@ -10,6 +10,7 @@ __author__ = "Benny <benny.think@gmail.com>"
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
import random
|
||||
import re
|
||||
import subprocess
|
||||
import time
|
||||
@ -43,6 +44,7 @@ def sizeof_fmt(num: int, suffix='B'):
|
||||
|
||||
def edit_text(bot_msg, text):
|
||||
key = f"{bot_msg.chat.id}-{bot_msg.message_id}"
|
||||
time.sleep(random.random())
|
||||
# if the key exists, we shouldn't send edit message
|
||||
if not r.exists(key):
|
||||
r.set(key, "ok", ex=3)
|
||||
|
@ -246,6 +246,7 @@ def download_handler(client: "Client", message: "types.Message"):
|
||||
|
||||
red.update_metrics("video_request")
|
||||
text = bot_text.get_receive_link_text()
|
||||
time.sleep(random.random() * 3)
|
||||
bot_msg: typing.Union["types.Message", "typing.Any"] = message.reply_text(text, quote=True)
|
||||
client.send_chat_action(chat_id, 'upload_video')
|
||||
ytdl_download_entrance(bot_msg, client, url)
|
||||
|
Loading…
Reference in New Issue
Block a user