コード例 #1
0
    async def ready(self, user: Member) -> None:
        player = Player(user)
        if player not in self.players:
            await self.add(user)

        if player.is_ready():
            raise UsageException.already_ready(self.channel)

        if self.is_ready():
            raise UsageException.game_is_full(self.channel)

        ind = self.players.index(player)
        self.players[ind].set_ready()
        self.reset_orderings()

        if self.is_ready():
            title = f"Game starting in ({self.channel.mention}))"
            embed = self.get_lobby_message(mention=True, title=title)
            await self.channel.send(embed=embed)
        else:
            await self.show(title=f"{player.get_name()} is ready!")
コード例 #2
0
    async def ready(self, user: Member) -> None:
        player = Player(user)
        if player not in self.players:
            await self.add(user)

        if player.is_ready():
            raise UsageException.already_ready(self.channel)

        if self.is_full():
            raise UsageException.game_is_full(self.channel)

        was_ready = self.is_ready()

        ind = self.players.index(player)
        self.players[ind].set_ready()
        self.clear_cache()

        if self.c.vMax is not None and self.ready_count() == self.c.vMax - 1:
            await self.broadcast_game_almost_full()

        if not was_ready and self.is_ready():
            await self.show(mention=True, desc="The lobby is now ready!")
        else:
            await self.show(desc=f"{player.get_name()} is Ready!")