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
9 changes: 7 additions & 2 deletions src/tgbot/handlers/moderator/invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
InlineKeyboardMarkup,
Update,
)
from telegram.error import TelegramError
from telegram.error import BadRequest, TelegramError
from telegram.ext import ContextTypes

from src.tgbot.constants import TELEGRAM_MODERATOR_CHAT_ID, UserType
Expand Down Expand Up @@ -102,7 +102,12 @@ async def handle_moderator_invite_callback(
await query.answer(text="Не получилось выдать ссылку, попробуй позже", show_alert=True)
return

await query.edit_message_reply_markup(reply_markup=None)
if query.message and query.message.reply_markup is not None:
try:
await query.edit_message_reply_markup(reply_markup=None)
except BadRequest as exc:
if exc.message != "Message is not modified":
raise

await context.bot.send_message(
chat_id=user_id,
Expand Down
Loading