Improved logging

This commit is contained in:
2023-03-17 14:13:28 +01:00
parent 95351f247c
commit 717586a9f0
3 changed files with 39 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ from classes.poster_client import PosterClient
from classes.user import PosterUser
from modules.app import app
from modules.logger import logWrite
from modules.utils import configGet, locale
from modules.database import col_submitted
from bson import ObjectId
@@ -38,6 +39,10 @@ async def callback_query_yes(app: PosterClient, clb: CallbackQuery):
),
quote=True,
)
logWrite(
f"Submission with ID '{fullclb[2]}' could not be accepted because of the duplicates: {str(exp.duplicates)}",
debug=True,
)
return
if submission[0] is not None:
@@ -83,6 +88,11 @@ async def callback_query_yes(app: PosterClient, clb: CallbackQuery):
reply_markup=InlineKeyboardMarkup(edited_markup)
)
logWrite(
f"Submission with ID '{fullclb[2]}' accepted and uploaded with ID '{submission[1]}'",
debug=True,
)
# try:
# if configGet("api_based", "mode") is True:
# media = await app.download_media(submission, file_name=configGet("tmp", "locations")+sep)
@@ -173,6 +183,10 @@ async def callback_query_no(app: PosterClient, clb: CallbackQuery):
await clb.message.edit_reply_markup(
reply_markup=InlineKeyboardMarkup(edited_markup)
)
logWrite(
f"Submission with ID '{fullclb[2]}' rejected",
debug=True,
)
@app.on_callback_query(filters.regex("sub_block_[\s\S]*"))
@@ -200,6 +214,10 @@ async def callback_query_block(app: PosterClient, clb: CallbackQuery):
await clb.message.edit_reply_markup(
reply_markup=InlineKeyboardMarkup(edited_markup)
)
logWrite(
f"User {fullclb[2]} has been blocked",
debug=True,
)
@app.on_callback_query(filters.regex("sub_unblock_[\s\S]*"))
@@ -227,3 +245,7 @@ async def callback_query_unblock(app: PosterClient, clb: CallbackQuery):
await clb.message.edit_reply_markup(
reply_markup=InlineKeyboardMarkup(edited_markup)
)
logWrite(
f"User {fullclb[2]} has been unblocked",
debug=True,
)