Ejemplo n.º 1
0
    def __init__(self, race_discord_channel, race_info):
        BotChannel.__init__(self)
        self._channel = race_discord_channel  # The necrobot in which this race is taking place
        self._race_info = race_info  # The type of races to be run in this room

        self._current_race = None  # The current race
        self._previous_race = None  # The previous race

        self._race_number = 0  # The number of races we've done
        self._mention_on_new_race = [
        ]  # A list of users that should be @mentioned when a rematch is created
        self._mentioned_users = [
        ]  # A list of users that were @mentioned when this race was created
        self._nopoke = False  # When True, the .poke command fails

        self.channel_commands = [
            cmd_race.Enter(self),
            cmd_race.Unenter(self),
            cmd_race.Ready(self),
            cmd_race.Unready(self),
            cmd_race.Done(self),
            cmd_race.Undone(self),
            cmd_race.Forfeit(self),
            cmd_race.Unforfeit(self),
            cmd_race.Comment(self),
            cmd_race.Death(self),
            cmd_race.Igt(self),
            cmd_race.Time(self),
            cmd_race.ForceForfeit(self),
            cmd_race.ForceForfeitAll(self),
            cmd_race.Pause(self),
            cmd_race.Unpause(self),
            cmd_race.Reseed(self),
            cmd_race.ChangeRules(self),
            cmd_publicrace.Rematch(self),
            cmd_publicrace.Kick(self),
            # cmd_publicrace.DelayRecord(self),
            cmd_publicrace.Notify(self),
            cmd_publicrace.Unnotify(self),
            cmd_publicrace.Missing(self),
            cmd_publicrace.Shame(self),
            cmd_publicrace.Poke(self),
            cmd_publicrace.ForceCancel(self),
            cmd_publicrace.ForceClose(self),
            cmd_test.TestRace(self),
        ]
Ejemplo n.º 2
0
    def __init__(self, match_discord_channel: discord.TextChannel,
                 match: Match):
        """BotChannel where a match is taking place.
        
        Parameters
        ----------
        match_discord_channel: discord.Channel
            The discord channel corresponding to this BotChannel.
        match: Match
            The Match object for the match.
        """
        BotChannel.__init__(self)
        self._channel = match_discord_channel  # type: discord.TextChannel
        self._match = match  # type: Match

        self._current_race = None  # type: Optional[Race]
        self._last_begun_race = None  # type: Optional[Race]

        self._countdown_to_match_future = None  # type: Optional[asyncio.Future]

        self._current_race_number = None  # type: Optional[int]

        self._last_begun_race_number = None  # type: Optional[int]
        self._current_race_contested = False  # type: bool

        self._match_race_data = None  # type: Optional[MatchRaceData]

        self._prematch_channel_commands = [
            cmd_match.Confirm(self),
            cmd_match.GetMatchInfo(self),
            cmd_match.Suggest(self),
            cmd_match.Unconfirm(self),
            cmd_match.ForceBegin(self),
            cmd_match.ForceCancelMatch(self),
            cmd_match.ForceConfirm(self),
            cmd_match.ForceReschedule(self),
            cmd_match.Postpone(self),
            cmd_match.RebootRoom(self),
            cmd_match.SetMatchType(self),
            cmd_match.Update(self),
            cmd_test.TestMatch(self),
            cmd_user.UserInfo(self),
        ]

        self._during_match_channel_commands = [
            cmd_match.CancelRace(self),
            cmd_match.ChangeWinner(self),
            cmd_match.Contest(self),
            cmd_match.ForceCancelMatch(self),
            cmd_match.ForceNewRace(self),
            cmd_match.ForceRecordRace(self),
            cmd_match.GetMatchInfo(self),
            cmd_match.Postpone(self),
            cmd_match.RebootRoom(self),
            cmd_match.SetMatchType(self),
            cmd_match.Update(self),
            cmd_race.Ready(self),
            cmd_race.Unready(self),
            cmd_race.Done(self),
            cmd_race.Undone(self),
            cmd_race.Time(self),
            cmd_race.Pause(self),
            cmd_race.Unpause(self),
            cmd_race.Reseed(self),
            cmd_race.ChangeRules(self),
            cmd_test.TestMatch(self),
            cmd_user.UserInfo(self),
        ]

        self._postmatch_channel_commands = [
            cmd_match.CancelRace(self),
            cmd_match.ChangeWinner(self),
            cmd_match.Contest(self),
            cmd_match.ForceCancelMatch(self),
            cmd_match.ForceCloseRoom(self),
            cmd_match.ForceNewRace(self),
            cmd_match.ForceRecordRace(self),
            cmd_match.GetMatchInfo(self),
            cmd_match.Postpone(self),
            cmd_match.RebootRoom(self),
            cmd_match.SetMatchType(self),
            cmd_match.Update(self),
            cmd_race.ChangeRules(self),
            cmd_test.TestMatch(self),
            cmd_user.UserInfo(self),
        ]

        self.channel_commands = self._prematch_channel_commands