diff --git a/hikka/modules/hikka_backup.py b/hikka/modules/hikka_backup.py index f930798..b3f3d4e 100644 --- a/hikka/modules/hikka_backup.py +++ b/hikka/modules/hikka_backup.py @@ -19,9 +19,7 @@ import asyncio import io import json import datetime -from telethon.tl.functions.channels import ( - EditPhotoRequest -) +from telethon.tl.functions.channels import EditPhotoRequest import requests @@ -36,7 +34,8 @@ class HikkaBackupMod(loader.Module): "name": "HikkaBackup", "period": "⌚️ Hewwo! I'm Asuna - your personal backup manager. Please, select the periodicity of automatic database backups", "saved": "✅ Backup period saved. You can re-configure it later with .set_backup_period", - "invalid_args": "🚫 Specify correct backup period in hours", + "never": "✅ I will not make automatic backups. You can re-configure it later with .set_backup_period", + "invalid_args": "🚫 Specify correct backup period in hours, or `0` to disable", } async def on_unload(self) -> None: @@ -59,6 +58,7 @@ class HikkaBackupMod(loader.Module): ], 3, ) + + [[{"text": "🚫 Never", "data": "backup_period/never"}]] ), parse_mode="HTML", ) @@ -97,6 +97,16 @@ class HikkaBackupMod(loader.Module): if not call.data.startswith("backup_period"): return + if call.data == "backup_period/never": + self.set("period", "disabled") + await call.answer(self.strings("never"), show_alert=True) + + await self.inline.bot.delete_message( + call.message.chat.id, + call.message.message_id, + ) + return + period = int(call.data.split("/")[1]) * 60 * 60 self.set("period", period) @@ -112,10 +122,15 @@ class HikkaBackupMod(loader.Module): async def set_backup_periodcmd(self, message: Message) -> None: """