Skip to content

Commit

Permalink
closes #35. At least I hope.
Browse files Browse the repository at this point in the history
  • Loading branch information
Poolitzer committed Sep 30, 2019
1 parent ffbc333 commit 7131dc4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion handlers/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from telegram import (Update, InlineKeyboardMarkup, ParseMode, ReplyKeyboardMarkup, ReplyKeyboardRemove,
ChatPermissions, InlineKeyboardButton)
from telegram.error import BadRequest
from telegram.ext import CallbackContext
from telegram.utils.helpers import mention_html

Expand Down Expand Up @@ -340,7 +341,10 @@ def game_end(context, text, chat_id, chameleon_id, winner_ids, lang):
context.bot.send_message(chat_id, text, parse_mode=ParseMode.HTML)
if chat_data["pin"]:
if isinstance(chat_data["pin"], int):
context.bot.pin_chat_message(chat_id, chat_data["pin"], True)
try:
context.bot.pin_chat_message(chat_id, chat_data["pin"], True)
except BadRequest:
context.bot.unpin_chat_message(chat_id)
else:
context.bot.unpin_chat_message(chat_id)
chat_data.clear()
Expand Down

0 comments on commit 7131dc4

Please sign in to comment.