Example #1
0
    def ExecuteVote(self, msg):
        if not self.pollRunning:
            return f"[{msg.user}]: Nothing to vote for"

        if msg.user in self.voters:
            return f"[{msg.user}]: You already voted in this poll"

        if (regMatch := self.voteRegex.match(msg.message)) is None:
            return util.GetSyntax(msg.user, "vote LETTER")
Example #2
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)")
Example #3
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 ExecuteFindFood(self, msg):
     if (regMatch := self.findFoodRegex.match(msg.message)) is None:
         return util.GetSyntax(msg.user, "findfood 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")
Example #6
0
    def ExecuteWhoAdd(self, msg):
        if not util.CheckPrivSub(msg.tags):
            return f"[{msg.user}]: Only mods and subs can add a who quote"

        if (regMatch := self.whoAddRegex.match(msg.message)) is None:
            return util.GetSyntax(msg.user, "who add USER TEXT")
Example #7
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")
Example #8
0
    def ExecuteFindSong(self, msg):
        self.CheckGetAccessToken()

        if (regMatch := self.findSongRegex.match(msg.message)) is None:
            return util.GetSyntax(msg.user, "findsong TEXT")
Example #9
0
 def ExecuteSwapScore(self, msg):
     if (regMatch := self.swapScoreRegex.match(msg.message)) is None:
         return util.GetSyntax(msg.user, "swapscore USER")
Example #10
0
 def ExecuteRoll(self, msg):
     if (regMatch := self.rollRegex.match(msg.message)) is None:
         return util.GetSyntax(msg.user, "roll NUMdNUM (roll 1d20)")
Example #11
0
 def ExecuteQuoteChange(self, msg):
     if (regMatch := self.quoteChangeRegex.match(msg.message)) is None:
         return util.GetSyntax(msg.user, "quote change NUMBER TEXT")
Example #12
0
 def ExecuteQuoteDel(self, msg):
     if (regMatch := self.quoteDelRegex.match(msg.message)) is None:
         return util.GetSyntax(msg.user, "quote del NUMBER")
Example #13
0
    def ExecuteVoteBan(self, msg):
        if self.threadRunning:
            return f"[{msg.user}]: Busy banning someone else."

        if (regMatch := self.voteBanRegex.match(msg.message)) is None:
            return util.GetSyntax(msg.user, "voteban USER")