Skip to content

Commit

Permalink
add backup bot
Browse files Browse the repository at this point in the history
  • Loading branch information
BennyThink committed Dec 13, 2023
1 parent 5df6ab3 commit 23f617e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 74 deletions.
3 changes: 1 addition & 2 deletions ytdlbot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@
ENABLE_ARIA2 = os.getenv("ENABLE_ARIA2", False)

RATE_LIMIT = os.getenv("RATE_LIMIT", 120)

IS_BACKUP_BOT = os.getenv("IS_BACKUP_BOT")
RCLONE_PATH = os.getenv("RCLONE")
INSTAGRAM_SESSION = os.getenv("INSTAGRAM_SESSION", "")
# This will set the value for the tmpfile path(download path) if it is set.
# If TMPFILE is not set, it will return None and use system’s default temporary file path.
# Please ensure that the directory exists and you have necessary permissions to write to it.
Expand Down
5 changes: 4 additions & 1 deletion ytdlbot/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@


class BotText:
start = "Welcome to YouTube Download bot. Type /help for more information. Join https://t.me/+OGRC8tp9-U9mZDZl for updates."
start = """
Welcome to YouTube Download bot. Type /help for more information.
Backup bot: @benny_2ytdlbot
Join https://t.me/+OGRC8tp9-U9mZDZl for updates."""

help = f"""
1. If the bot doesn't work, try again or join https://t.me/+OGRC8tp9-U9mZDZl for updates.
Expand Down
66 changes: 0 additions & 66 deletions ytdlbot/instagram.py

This file was deleted.

12 changes: 7 additions & 5 deletions ytdlbot/ytdl_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
ENABLE_CELERY,
ENABLE_FFMPEG,
ENABLE_VIP,
IS_BACKUP_BOT,
M3U8_SUPPORT,
OWNER,
PLAYLIST_SUPPORT,
Expand Down Expand Up @@ -126,7 +127,7 @@ def start_handler(client: Client, message: types.Message):
else:
info = ""
text = f"{BotText.start}\n\n{info}\n{BotText.custom_text}"
client.send_message(message.chat.id, text)
client.send_message(message.chat.id, text, disable_web_page_preview=True)


@app.on_message(filters.command(["help"]))
Expand Down Expand Up @@ -547,12 +548,13 @@ def trx_notify(_, **kwargs):
if __name__ == "__main__":
MySQL()
TRX_SIGNAL.connect(trx_notify)
scheduler = BackgroundScheduler(timezone="Asia/Shanghai", job_defaults={"max_instances": 5})
scheduler.add_job(redis.reset_today, "cron", hour=0, minute=0)
scheduler = BackgroundScheduler(timezone="Europe/London", job_defaults={"max_instances": 6})
scheduler.add_job(auto_restart, "interval", seconds=600)
scheduler.add_job(clean_tempfile, "interval", seconds=120)
scheduler.add_job(InfluxDB().collect_data, "interval", seconds=120)
scheduler.add_job(TronTrx().check_payment, "interval", seconds=60, max_instances=1)
if not IS_BACKUP_BOT:
scheduler.add_job(redis.reset_today, "cron", hour=0, minute=0)
scheduler.add_job(InfluxDB().collect_data, "interval", seconds=120)
scheduler.add_job(TronTrx().check_payment, "interval", seconds=60, max_instances=1)
# default quota allocation of 10,000 units per day
scheduler.add_job(periodic_sub_check, "interval", seconds=3600)
scheduler.start()
Expand Down

0 comments on commit 23f617e

Please sign in to comment.