From 85d712d2d832ccb0f9ef7b151786fc1e558583ab Mon Sep 17 00:00:00 2001 From: rootcoma Date: Sun, 17 Nov 2013 19:11:22 -0800 Subject: [PATCH 1/2] Zero width spaceage --- plugin.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/plugin.py b/plugin.py index 71ed675..78689ee 100644 --- a/plugin.py +++ b/plugin.py @@ -160,6 +160,12 @@ class TriviaTime(callbacks.Plugin): ) ) + def addZeroWidthSpace(self, text): + if len(text) < 1: + return text + s = '%s​%s' % (text[:1], text[1:]) # WARNING: this has a zero width space, though its invisible + return s + def acceptedit(self, irc, msg, arg, user, channel, num): """[] Accept a question edit, and remove edit. @@ -255,7 +261,7 @@ class TriviaTime(callbacks.Plugin): offset = num-9 topsList = ['Today\'s Top 10 Players: '] for i in range(len(tops)): - topsList.append('\x02 #%d:\x02 %s %d ' % ((i+offset) , tops[i][1], tops[i][2])) + topsList.append('\x02 #%d:\x02 %s %d ' % ((i+offset) , self.addZeroWidthSpace(tops[i][1]), tops[i][2])) topsText = ''.join(topsList) irc.sendMsg(ircmsgs.privmsg(channel, topsText)) irc.noReply() @@ -381,7 +387,7 @@ class TriviaTime(callbacks.Plugin): irc.reply('%s%s' % (errorMessage, identifyMessage)) else: hasPoints = False - infoList = ['%s\'s Stats: Points (answers)' % (info[1])] + infoList = ['%s\'s Stats: Points (answers)' % (self.addZeroWidthSpace(info[1]))] if info[10] > 0 or info[16] > 0 or info[11] > 0: hasPoints = True infoList.append(' \x02Today:\x02 #%d %d (%d)' % (info[16], info[10], info[11])) @@ -413,10 +419,10 @@ class TriviaTime(callbacks.Plugin): num=10 channel = msg.args[0] tops = self.storage.viewMonthTop10(channel, num) - topsList = ['This MONTHS Top 10 Players: '] + topsList = ['This Month\'s Top 10 Players: '] offset = num-9 for i in range(len(tops)): - topsList.append('\x02 #%d:\x02 %s %d ' % ((i+offset) , tops[i][1], tops[i][2])) + topsList.append('\x02 #%d:\x02 %s %d ' % ((i+offset) , self.addZeroWidthSpace(tops[i][1]), tops[i][2])) topsText = ''.join(topsList) irc.sendMsg(ircmsgs.privmsg(channel, topsText)) irc.noReply() @@ -593,7 +599,7 @@ class TriviaTime(callbacks.Plugin): irc.error("I couldn't find that user in the database.") else: hasPoints = False - infoList = ['%s\'s Stats: Points (answers)' % (info[1])] + infoList = ['%s\'s Stats: Points (answers)' % (self.addZeroWidthSpace(info[1]))] if info[10] > 0 or info[16] > 0 or info[11] > 0: hasPoints = True infoList.append(' \x02Today:\x02 #%d %d (%d)' % (info[16], info[10], info[11])) @@ -798,10 +804,10 @@ class TriviaTime(callbacks.Plugin): num=10 channel = msg.args[0] tops = self.storage.viewWeekTop10(channel, num) - topsList = ['This week\'s Top 10 Players: '] + topsList = ['This Week\'s Top 10 Players: '] offset = num-9 for i in range(len(tops)): - topsList.append('\x02 #%d:\x02 %s %d ' % ((i+offset) , tops[i][1], tops[i][2])) + topsList.append('\x02 #%d:\x02 %s %d ' % ((i+offset) , self.addZeroWidthSpace(tops[i][1]), tops[i][2])) topsText = ''.join(topsList) irc.sendMsg(ircmsgs.privmsg(channel, topsText)) irc.noReply() @@ -818,7 +824,7 @@ class TriviaTime(callbacks.Plugin): topsList = ['This Year\'s Top 10 Players: '] offset = num-9 for i in range(len(tops)): - topsList.append('\x02 #%d:\x02 %s %d ' % ((i+offset) , tops[i][1], tops[i][2])) + topsList.append('\x02 #%d:\x02 %s %d ' % ((i+offset) , self.addZeroWidthSpace(tops[i][1]), tops[i][2])) topsText = ''.join(topsList) irc.sendMsg(ircmsgs.privmsg(channel, topsText)) irc.noReply() From ec97151b5b088a9f0c98ee94519b533d6800dfc5 Mon Sep 17 00:00:00 2001 From: rootcoma Date: Sun, 17 Nov 2013 19:14:34 -0800 Subject: [PATCH 2/2] minor change --- plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.py b/plugin.py index 78689ee..77aecd2 100644 --- a/plugin.py +++ b/plugin.py @@ -161,7 +161,7 @@ class TriviaTime(callbacks.Plugin): ) def addZeroWidthSpace(self, text): - if len(text) < 1: + if len(text) <= 1: return text s = '%s​%s' % (text[:1], text[1:]) # WARNING: this has a zero width space, though its invisible return s