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")
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)")
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")
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")
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")
def ExecuteFindSong(self, msg): self.CheckGetAccessToken() if (regMatch := self.findSongRegex.match(msg.message)) is None: return util.GetSyntax(msg.user, "findsong TEXT")
def ExecuteSwapScore(self, msg): if (regMatch := self.swapScoreRegex.match(msg.message)) is None: return util.GetSyntax(msg.user, "swapscore USER")
def ExecuteRoll(self, msg): if (regMatch := self.rollRegex.match(msg.message)) is None: return util.GetSyntax(msg.user, "roll NUMdNUM (roll 1d20)")
def ExecuteQuoteChange(self, msg): if (regMatch := self.quoteChangeRegex.match(msg.message)) is None: return util.GetSyntax(msg.user, "quote change NUMBER TEXT")
def ExecuteQuoteDel(self, msg): if (regMatch := self.quoteDelRegex.match(msg.message)) is None: return util.GetSyntax(msg.user, "quote del NUMBER")
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")