From b491baae1eef196d63ee4f6e85699547fe7f33e4 Mon Sep 17 00:00:00 2001 From: Yizhe Shen Date: Wed, 25 Jun 2014 11:51:39 -0400 Subject: [PATCH] Fixed MVP voicing to voice by nick instead of username. - Switched the actual voicing of players to use the player's nick - Some small formatting changes --- plugin.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/plugin.py b/plugin.py index 8a3e27f..394b20d 100644 --- a/plugin.py +++ b/plugin.py @@ -159,12 +159,12 @@ class TriviaTime(callbacks.Plugin): # check the answer game.checkAnswer(msg) - def doJoin(self,irc,msg): + def doJoin(self, irc, msg): username = self.getUsername(msg.nick, msg.prefix) channel = msg.args[0] - self.handleVoice(irc, username, channel) + self.handleVoice(irc, msg.nick, username, channel) - def doNotice(self,irc,msg): + def doNotice(self, irc, msg): username = msg.nick if msg.args[1][1:5] == "PING": pingMsg = msg.args[1][6:] @@ -184,12 +184,12 @@ class TriviaTime(callbacks.Plugin): else: irc.sendMsg(ircmsgs.privmsg(channel, '%s: Ping reply: %0.2f seconds' % (username, pingTime))) - def voiceUser(self, irc, username, channel): + def voiceUser(self, irc, nick, username, channel): usernameCanonical = ircutils.toLower(username) - irc.queueMsg(ircmsgs.voice(channel, username)) + irc.queueMsg(ircmsgs.voice(channel, nick)) self.voiceTimeouts.append(usernameCanonical) - def handleVoice(self, irc, username, channel): + def handleVoice(self, irc, nick, username, channel): if not self.registryValue('voice.enableVoice'): return @@ -212,14 +212,14 @@ class TriviaTime(callbacks.Plugin): minPointsVoiceWeek = self.registryValue('voice.minPointsVoiceWeek') if rank['year'] <= numTopToVoice and stat['points_year'] >= minPointsVoiceYear: - self.voiceUser(irc, username, channel) - irc.sendMsg(ircmsgs.privmsg(channel, 'Giving voice to %s for being MVP this YEAR (#%d)' % (username, rank['year']))) + self.voiceUser(irc, nick, username, channel) + irc.sendMsg(ircmsgs.privmsg(channel, 'Giving voice to %s for being MVP this YEAR (#%d)' % (nick, rank['year']))) elif rank['month'] <= numTopToVoice and stat['points_month'] >= minPointsVoiceMonth: - self.voiceUser(irc, username, channel) - irc.sendMsg(ircmsgs.privmsg(channel, 'Giving voice to %s for being MVP this MONTH (#%d)' % (username, rank['month']))) + self.voiceUser(irc, nick, username, channel) + irc.sendMsg(ircmsgs.privmsg(channel, 'Giving voice to %s for being MVP this MONTH (#%d)' % (nick, rank['month']))) elif rank['week'] <= numTopToVoice and stat['points_week'] >= minPointsVoiceWeek: - self.voiceUser(irc, username, channel) - irc.sendMsg(ircmsgs.privmsg(channel, 'Giving voice to %s for being MVP this WEEK (#%d)' % (username, rank['week']))) + self.voiceUser(irc, nick, username, channel) + irc.sendMsg(ircmsgs.privmsg(channel, 'Giving voice to %s for being MVP this WEEK (#%d)' % (nick, rank['week']))) def addZeroWidthSpace(self, text): if len(text) <= 1: