示例#1
0
 async def modkill(self, ctx, *, player: PlayerConverter()):
     """Modkill command"""
     await player.exec_real_death()
     player.ghost_vote = 0
     globvars.master_state.game.invalidated = True
     feedback = documentation["doc"]["modkill"]["feedback"]
     await ctx.send(feedback.format(check_emoji, player.game_nametag))
 async def whisper(self, ctx, recipient: PlayerConverter(), *, content: WhisperConverter()):
     """Whisper command"""
     player = BOTCUtils.get_player_from_id(ctx.author.id)
     try:
         msg = from_str.format(
             botutils.BotEmoji.unread_message,
             player.game_nametag,
             content
         )
         await recipient.user.send(msg)
     except discord.Forbidden:
         msg = recipient_blocked.format(botutils.BotEmoji.warning_sign)
         await ctx.send(msg)
     else:
         msg = to_str.format(
             botutils.BotEmoji.whisper,
             recipient.game_nametag,
             content
         )
         await ctx.send(msg)
         announcement_msg = whisper_announcement.format(
             botutils.BotEmoji.opened_letter,
             player.game_nametag,
             recipient.game_nametag,
         )
         lobby_message = await botutils.send_lobby(announcement_msg)
         await asyncio.sleep(WHISPER_SHOW_TIME)
         await lobby_message.delete()
示例#3
0
    async def modkill(self, ctx, *, player: PlayerConverter):
        """Modkill command"""
        if player.role.social_self.category == Category.demon:
            if player.is_alive():
                # If 5 or more players alive (not counting travelers), scarlet woman gets
                # promoted to demonhood
                if globvars.master_state.game.nb_alive_players >= 5:

                    from botc.gamemodes.troublebrewing import ScarletWoman

                    # This list of scarletwomen could contain dead players
                    scarletwomen = BOTCUtils.get_players_from_role_name(
                        ScarletWoman()._role_enum)

                    if scarletwomen:
                        # We only want the alive, and not poisoned scarlet women
                        alive_scarletwomen = [
                            player for player in scarletwomen
                            if player.is_alive() and not player.is_droisoned()
                        ]
                        if alive_scarletwomen:
                            promoted = random.choice(alive_scarletwomen)
                            promoted._old_role_obj = promoted._role_obj
                            await promoted.exec_change_role(Imp())

                            if not DISABLE_DMS:
                                embed = Imp._make_demonhood_promo_embed(
                                    Imp(), promoted)
                                try:
                                    await promoted.user.send(embed=embed)
                                except discord.Forbidden:
                                    pass

        await player.exec_real_death()
        player.ghost_vote = 0
        if not NO_INVALIDATE:
            globvars.master_state.game.invalidated = True
        feedback = game_text["doc"]["modkill"]["feedback"]
        await ctx.send(feedback.format(check_emoji, player.game_nametag))
示例#4
0
 async def frole(self, ctx, player: PlayerConverter(),
                 role: RoleConverter()):
     """Frole command"""
     import globvars
     old_role = player.role.true_self
     await player.exec_change_role(role)
     player.role.exec_init_role(globvars.master_state.game.setup)
     try:
         await player.role.ego_self.send_opening_dm_embed(player.user)
     except discord.Forbidden:
         pass
     feedback = documentation["doc"]["frole"]["feedback"]
     await ctx.send(
         feedback.format(check_emoji, player.game_nametag, old_role,
                         role.emoji, role))
    async def nominate(self, ctx, *, nominated: PlayerConverter()):
        """Nominate command
        usage: nominate <player> 
        characters: living players
        """
        import globvars
        from botc.gameloops import nomination_loop, base_day_loop
        player = BOTCUtils.get_player_from_id(ctx.author.id)

        # A nomination is currently going on. The player cannot nominate.
        if nomination_loop.is_running():
            msg = nomination_ongoing.format(ctx.author.mention,
                                            botutils.BotEmoji.cross)
            await ctx.send(msg)
            return

        # The day has not reached nomination phase yet. The player cannot nominate.
        elif base_day_loop.is_running():
            msg = nominations_not_open.format(ctx.author.mention,
                                              botutils.BotEmoji.cross)
            await ctx.send(msg)
            return

        if player.can_nominate():
            if nominated.can_be_nominated():
                # The player cannot nominate again today
                player.toggle_has_nominated()
                # The nominated player cannot be nominated again today
                nominated.toggle_was_nominated()
                await nominated.role.true_self.on_being_nominated(
                    player, nominated)
            else:
                msg = cannot_be_nominated_again.format(ctx.author.mention,
                                                       botutils.BotEmoji.cross,
                                                       nominated.game_nametag)
                await ctx.send(msg)
        else:
            msg = cannot_nominate_again.format(ctx.author.mention,
                                               botutils.BotEmoji.cross)
            await ctx.send(msg)
示例#6
0
    async def info_remove(self, ctx, player_or_id: Union[int, PlayerConverter] = None, id: PlayerConverter() = None):
        invoking_player = BOTCUtils.get_player_from_id(ctx.author.id)

        if isinstance(player_or_id, int):
            id = player_or_id
            player_or_id = None

        if player_or_id is None:
            if globvars.master_state.game._chrono.phase == Phase.night:
                raise NotNight("Command is allowed during night phase only (BoTC)")
            globvars.master_state.game.note_manager.rm_info(invoking_player, id)
        else:
            globvars.master_state.game.note_manager.rm_info(player_or_id, id, invoking_player)

        await ctx.send(info_remove_feedback_str.format(BotEmoji.check))
 async def modkill(self, ctx, *, player: PlayerConverter()):
     """Modkill command"""
     await player.exec_real_death()
     feedback = documentation["doc"]["modkill"]["feedback"]
     await ctx.send(feedback.format(check_emoji, player.game_nametag, player.role.emoji, 
         player.role.true_self))
示例#8
0
 async def info_remove(self,
                       ctx,
                       n_or_player: Union[int, PlayerConverter] = None,
                       player: PlayerConverter() = None):
     await self.notes_info_remove_command.callback(self, ctx, n_or_player,
                                                   player)