Skip to content

Commit f11df72

Browse files
committed
Fix
1 parent 1b7aea4 commit f11df72

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

actions.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from datetime import datetime
77

88
from telegram import Message, Chat
9+
from telegram.ext import CallbackContext
910

1011
from config import TIME_REMOVAL_AFTER_SKIP, MIN_FAST_TURN_TIME
1112
from errors import DeckEmptyError, NotEnoughPlayersError
@@ -205,9 +206,9 @@ def start_player_countdown(bot, game, job_queue):
205206
player.game.job = job
206207

207208

208-
def skip_job(bot, job):
209-
player = job.context.player
209+
def skip_job(context: CallbackContext):
210+
player = context.job.context.player
210211
game = player.game
211212
if game_is_running(game):
212-
job_queue = job.context.job_queue
213-
do_skip(bot, player, job_queue)
213+
job_queue = context.job.context.job_queue
214+
do_skip(context.bot, player, job_queue)

bot.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -299,16 +299,15 @@ def select_game(update: Update, context: CallbackContext):
299299
text=_("Game not found."))
300300
return
301301

302-
@run_async
303-
def selected(bot):
302+
def selected():
304303
back = [[InlineKeyboardButton(text=_("Back to last group"),
305304
switch_inline_query='')]]
306-
context.bot.answerCallbackQuery(update.callback_query.id,
305+
dispatcher.run_async(context.bot.answerCallbackQuery, update.callback_query.id,
307306
text=_("Please switch to the group you selected!"),
308307
show_alert=False,
309308
timeout=TIMEOUT)
310309

311-
context.bot.editMessageText(chat_id=update.callback_query.message.chat_id,
310+
dispatcher.run_async(context.bot.editMessageText, chat_id=update.callback_query.message.chat_id,
312311
message_id=update.callback_query.message.message_id,
313312
text=_("Selected group: {group}\n"
314313
"<b>Make sure that you switch to the correct "
@@ -318,7 +317,7 @@ def selected(bot):
318317
parse_mode=ParseMode.HTML,
319318
timeout=TIMEOUT)
320319

321-
selected(bot)
320+
selected()
322321

323322

324323
@game_locales
@@ -383,15 +382,14 @@ def start_game(update: Update, context: CallbackContext):
383382
multi=game.translate)
384383
.format(name=display_name(game.current_player.user)))
385384

386-
@run_async
387385
def send_first():
388386
"""Send the first card and player"""
389387

390-
context.bot.sendSticker(chat.id,
388+
dispatcher.run_async(context.bot.sendSticker, chat.id,
391389
sticker=c.STICKERS[str(game.last_card)],
392390
timeout=TIMEOUT)
393391

394-
context.bot.sendMessage(chat.id,
392+
dispatcher.run_async(context.bot.sendMessage, chat.id,
395393
text=first_message,
396394
reply_markup=InlineKeyboardMarkup(choice),
397395
timeout=TIMEOUT)
@@ -702,7 +700,7 @@ def process_result(update: Update, context: CallbackContext):
702700
send_async(context.bot, chat.id,
703701
text=nextplayer_message,
704702
reply_markup=InlineKeyboardMarkup(choice))
705-
start_player_countdown(context.bot, game, job_queue)
703+
start_player_countdown(context.bot, game, context.job_queue)
706704

707705

708706
def reset_waiting_time(bot, player):

0 commit comments

Comments
 (0)