-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
|
||
from .dev import H_DEV | ||
from .misc import H_MISC | ||
from .sendall import H_SENDALL_CONV | ||
from .shop import H_SHOP | ||
|
||
HANDLERS_ADMIN = [ | ||
*H_MISC, | ||
*H_SHOP, | ||
*H_DEV, | ||
H_SENDALL_CONV | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
import logging | ||
|
||
from deps import require_admin | ||
from settings import DATABASE_PATH | ||
from telegram import Update | ||
from telegram.ext import CommandHandler, ContextTypes | ||
|
||
Ctx = ContextTypes.DEFAULT_TYPE | ||
|
||
|
||
MAX_FILE_SIZE = 50 * 1024 * 1024 | ||
|
||
|
||
@require_admin | ||
async def backup(update: Update, ctx: Ctx): | ||
msg = update.effective_message | ||
|
||
if DATABASE_PATH.stat().st_size < 50 * 1024 * 10: | ||
await msg.reply_document(DATABASE_PATH, caption='main db') | ||
logging.info('a backup was made') | ||
else: | ||
await msg.reply_text('main db is too big ❌') | ||
|
||
|
||
H_DEV = [ | ||
CommandHandler(['backup'], backup) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters