Improved logging
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
@@ -43,6 +43,10 @@ async def get_submission(app: PosterClient, msg: Message):
|
||||
return
|
||||
|
||||
if msg.document is not None:
|
||||
logWrite(
|
||||
f"User {msg.from_user.id} is trying to submit a file of type '{msg.document.mime_type}' with name '{msg.document.file_name}' and size of {msg.document.file_size / 1024 / 1024} MB",
|
||||
debug=True,
|
||||
)
|
||||
if msg.document.mime_type not in configGet("mime_types", "submission"):
|
||||
await msg.reply_text(
|
||||
locale("mime_not_allowed", "message", locale=user_locale),
|
||||
@@ -65,6 +69,10 @@ async def get_submission(app: PosterClient, msg: Message):
|
||||
) # , msg.document.file_name
|
||||
|
||||
if msg.video is not None:
|
||||
logWrite(
|
||||
f"User {msg.from_user.id} is trying to submit a video with name '{msg.video.file_name}' and size of {msg.video.file_size / 1024 / 1024} MB",
|
||||
debug=True,
|
||||
)
|
||||
if msg.video.file_size > configGet("file_size", "submission"):
|
||||
await msg.reply_text(
|
||||
locale("document_too_large", "message", locale=user_locale).format(
|
||||
@@ -78,6 +86,10 @@ async def get_submission(app: PosterClient, msg: Message):
|
||||
contents = msg.video.file_id, SubmissionType.VIDEO # , msg.video.file_name
|
||||
|
||||
if msg.animation is not None:
|
||||
logWrite(
|
||||
f"User {msg.from_user.id} is trying to submit an animation with name '{msg.animation.file_name}' and size of {msg.animation.file_size / 1024 / 1024} MB",
|
||||
debug=True,
|
||||
)
|
||||
if msg.animation.file_size > configGet("file_size", "submission"):
|
||||
await msg.reply_text(
|
||||
locale("document_too_large", "message", locale=user_locale).format(
|
||||
@@ -94,6 +106,10 @@ async def get_submission(app: PosterClient, msg: Message):
|
||||
) # , msg.animation.file_name
|
||||
|
||||
if msg.photo is not None:
|
||||
logWrite(
|
||||
f"User {msg.from_user.id} is trying to submit a photo with ID '{msg.photo.file_id}' and size of {msg.photo.file_size / 1024 / 1024} MB",
|
||||
debug=True,
|
||||
)
|
||||
contents = msg.photo.file_id, SubmissionType.PHOTO # , "please_generate"
|
||||
|
||||
if save_tmp is not None:
|
||||
|
Reference in New Issue
Block a user