def burst(self): for card in self.hand: self.game.discard(self.card) self.send_message(Strings.YOU_BURST) self.game.send_message(Strings.BURST.format('@' + self.user.username), without=self) send_group_message(Strings.BURST.format('@' + self.user.username))
def join(bot, update): if update.message.chat.type == 'private': if update.message.text == '/start join': status = game.status game.add_player(update.message.from_user, update.message.chat) enqueue(update.message.reply_text, Strings.JOINED) send_group_message( Strings.NAMED_JOINED.format('@' + update.message.from_user.username)) if status is game.Status.PREPARING and game.status is game.Status.OPEN: enqueue(join_message.edit_text, Strings.JOIN, reply_markup=InlineKeyboardMarkup([[ InlineKeyboardButton(Strings.JOIN_BUTTON, url=Settings.BOT_URL + '?start=join'), InlineKeyboardButton(Strings.WATCH_BUTTON, url=Settings.BOT_URL + '?start=watch') ]])) send_message(update.message.chat.id, Strings.START, reply_markup=InlineKeyboardMarkup([[ InlineKeyboardButton(Strings.START_BUTTON, callback_data='start') ]])) elif update.message.text == '/start watch': game.add_audience(update.message.from_user, update.message.chat) enqueue(update.message.reply_text, Strings.WATCHED) send_group_message( Strings.NAMED_WATCHED.format( '@' + update.message.from_user.username)) else: raise
def win(self): self.send_message(Strings.YOU_WIN) self.game.send_message(Strings.WIN.format('@' + self.user.username), without=self) send_group_message(Strings.WIN.format('@' + self.user.username))
def start(bot, update): game.start(update.callback_query.from_user) enqueue(join_message.edit_reply_markup) enqueue(update.callback_query.edit_message_reply_markup) send_group_message(Strings.STARTED) game.next()
def quit(bot, update): game.quit(update.message.from_user) send_group_message( Strings.QUIT.format('@' + update.message.from_user.username))