Beispiel #1
0
    def ExecutePollEnd(self, msg):
        if not util.CheckPrivMod(msg.tags):
            return f"[{msg.user}]: Only mods can end a poll"

        if not self.pollRunning:
            return f"[{msg.user}]: No poll active"

        self.EndPoll()
        return
Beispiel #2
0
    def CheckModifyQuote(self, action, result, msg):
        if not util.CheckPrivMod(msg.tags):
            if result["user"] != msg.user:
                return f"[{msg.user}]: Only mods can {action} a quote someone else added"

            if result["date"].strftime(
                    "%x") != datetime.datetime.now().strftime("%x"):
                return f"[{msg.user}]: Only mods can {action} a quote on a different day than it was added"

        return None
Beispiel #3
0
    def ExecutePoll(self, msg):
        try:
            subCommand = msg.message.lower().split()[1]
        except IndexError:
            subCommand = None

        if subCommand in self.pollSubCommands:
            return self.pollSubCommands[subCommand](msg)

        if not util.CheckPrivMod(msg.tags):
            return f"[{msg.user}]: Only mods can start a poll"

        if self.pollRunning:
            return f"[{msg.user}]: Poll already active"

        self.pollThread = threading.Thread(target=self.PollAsync)

        # Get the first valid match from pollRegex list
        if (regMatch := next(
            (exp.match(msg.message)
             for exp in self.pollRegex if exp.match(msg.message) != None),
                None)) is None:
            return util.GetSyntax(msg.user, "poll NUM_MINUTES (NUM_CHOICES)")
Beispiel #4
0
    def ExecuteDelCom(self, msg):
        if not util.CheckPrivMod(msg.tags):
            return f"[{msg.user}]: Only mods can delete commands"

        if (regmatch := self.delComRegex.match(msg.message)) is None:
            return util.GetSyntax(msg.user, "delcom TEXT")
    def ExecuteShoutout(self, msg):
        if not util.CheckPrivMod(msg.tags):
            return f"[{msg.user}]: Only mods can shoutout"

        if (regMatch := self.shoutoutRegex.match(msg.message)) is None:
            return util.GetSyntax(msg.user, "shoutout USER")
Beispiel #6
0
    def ExecuteWhoDel(self, msg):
        if not util.CheckPrivMod(msg.tags):
            return f"[{msg.user}]: Only mods can delete a who quote"

        if (regMatch := self.whoDelRegex.match(msg.message)) is None:
            return util.GetSyntax(msg.user, "who del USER NUMBER")
Beispiel #7
0
    def ExecuteClearBoard(self, msg):
        if not util.CheckPrivMod(msg.tags):
            return f"[{msg.user}]: Only mods can clear the leaderboard"

        self.colLeaderboard.remove({})
        return f"[{msg.user}]: Leaderboard cleared"