Skip to content

Commit

Permalink
Create task to cleanup report award message
Browse files Browse the repository at this point in the history
  • Loading branch information
Desiders committed Nov 25, 2023
1 parent ab00915 commit 7f59c95
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/handlers/moderator.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ async def approve_report_handler(
reward_amount=config.report_karma_award,
bot=bot,
)
await bot.edit_message_text(
message = await bot.edit_message_text(
"<b>{reporter}</b> получил <b>+{reward_amount}</b> кармы "
"в награду за репорт{admin_url}".format(
reporter=hd.quote(karma_change_result.karma_event.user_to.fullname),
Expand All @@ -349,6 +349,13 @@ async def approve_report_handler(
chat_id=first_report.chat.chat_id,
message_id=first_report.bot_reply_message_id,
)
if config.report_award_cleanup_delay > 0:
asyncio.create_task(
delete_message(
message,
sleep_time=config.report_award_cleanup_delay,
)
)

await callback_query.answer("Вы подтвердили репорт", show_alert=not award_enabled)
await cleanup_reports_dialog(
Expand Down

0 comments on commit 7f59c95

Please sign in to comment.