Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions src/tgbot/handlers/upload/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,19 @@ async def handle_uploaded_meme_review_button(
)

if action == "approve":
await update.callback_query.message.edit_caption(
caption=prev_caption + "\n✅ Approved by {}".format(update.effective_user.name),
reply_markup=None,
)
new_caption = prev_caption + "\n✅ Approved by {}".format(update.effective_user.name)
if (
update.callback_query.message.caption != new_caption
or update.callback_query.message.reply_markup is not None
):
try:
await update.callback_query.message.edit_caption(
caption=new_caption,
reply_markup=None,
)
except BadRequest as exc:
if exc.message != "Message is not modified":
raise

await create_user_meme_reaction( # author auto like for the uploaded meme
meme_upload["user_id"],
Expand Down Expand Up @@ -296,10 +305,19 @@ async def handle_uploaded_meme_review_button(

else:
await update_meme_by_upload_id(upload_id, status=MemeStatus.REJECTED)
await update.callback_query.message.edit_caption(
caption=prev_caption + "\n❌ Rejected by {}".format(update.effective_user.name),
reply_markup=None,
)
new_caption = prev_caption + "\n❌ Rejected by {}".format(update.effective_user.name)
if (
update.callback_query.message.caption != new_caption
or update.callback_query.message.reply_markup is not None
):
try:
await update.callback_query.message.edit_caption(
caption=new_caption,
reply_markup=None,
)
except BadRequest as exc:
if exc.message != "Message is not modified":
raise
try:
await context.bot.send_message(
chat_id=meme_upload["user_id"],
Expand Down
Loading