async def _request_help_from_audience(self): if self.arg != Cogs.Game.audience: return if self.user_id not in self.bot.games.keys(): await self.ctx.send(Reply.not_in_game(self.user_id)) return True player_game = self.bot.games[self.user_id] if not player_game.audience: await self.ctx.send(Reply.used_audience(self.user_id)) embed = JokersEmbed(player_game.user.name, player_game.user.avatar_url, player_game.jokers_left()) await self.ctx.send(embed=embed) return True msg = await self.ctx.send(Reply.audience_help(30)) player_game.audience = False player_game.audience_channel = self.ctx.channel player_game.waiting_audience_help = True await self._count_seconds_down_audience(player_game, msg) if player_game.waiting_audience_help: audience_data = player_game.get_audience_votes() embed = AudienceEmbed(**audience_data) await self.ctx.send(embed=embed) player_game.waiting_audience_help = False await msg.add_reaction(Emoji.clock)
async def jokers(self, ctx): self.user_id = str(ctx.author.id) if self.user_id not in self.bot.games.keys(): await ctx.send(Reply.not_in_game(self.user_id)) return player_id = self.user_id game = self.bot.games[player_id] embed = JokersEmbed(game.user.name, game.user.avatar_url, game.jokers_left()) await ctx.send(embed=embed)
async def _request_help_from_friend(self): if self.user_id not in self.bot.games.keys(): await self.ctx.send(Reply.not_in_game(self.user_id)) return player_game = self.bot.games[self.user_id] helper_id = self._extract_id_from_tag(self.arg) if not helper_id: await self.ctx.send(Reply.unknown_2_arg(self.user_id)) return if not player_game.friend: await self.ctx.send(Reply.used_friend(self.user_id)) embed = JokersEmbed(player_game.user.name, player_game.user.avatar_url, player_game.jokers_left()) await self.ctx.send(embed=embed) return if str(helper_id) == self.user_id: await self.ctx.send(Reply.no_yourself(self.user_id)) return if str(helper_id) in self.bot.games.keys(): await self.ctx.send(Reply.no_player(self.user_id)) return helper = self.bot.get_user(helper_id) # get discord.User object of the helper if helper.bot: await self.ctx.send(Reply.no_bot(self.user_id)) return # Asserts that the helper is not a bot or the player itself msg = await self.ctx.send(Reply.friend_help(helper.name, 30)) player_game.friend = False # the joker is gone self.bot.helping_friends[str(helper_id)] = self.user_id # add the helper to the queue and bind the player id player_game.waiting_friend_help = True await self._count_seconds_down_friend(player_game, helper.name, msg) player_game.waiting_friend_help = False await msg.add_reaction(Emoji.clock) del self.bot.helping_friends[str(helper_id)]
async def cut_2_answers(self, ctx): self.user_id = str(ctx.author.id) if self.user_id not in self.bot.games.keys(): await ctx.send(Reply.not_in_game(self.user_id)) return game = self.bot.games[self.user_id] if game.fifty: game.remove_2_choices() game.last_embed = QuestionEmbed(**game.last_question) await game.last_message.edit(embed=game.last_embed) game.fifty = False else: await ctx.send(Reply.used_50(self.user_id)) embed = JokersEmbed(game.user.name, game.user.avatar_url, game.jokers_left()) await ctx.send(embed=embed)
async def _request_help_from_audience(self): if self.arg != Cogs.Game.audience: return if self.user_id not in self.bot.games.keys(): await self.ctx.send(Reply.not_in_game(self.user_id)) return True player_game = self.bot.games[self.user_id] if not player_game.audience: await self.ctx.send(Reply.used_audience(self.user_id)) embed = JokersEmbed(player_game.user.name, player_game.user.avatar_url, player_game.jokers_left()) await self.ctx.send(embed=embed) return True player_game.audience_msg = await self.ctx.send(Reply.audience_help(10)) player_game.audience = False player_game.audience_channel = self.ctx.channel player_game.start_audience_help = self.bot.time player_game.waiting_audience_help = True