Avoid highlighting users mentioned in `roster`

This commit is contained in:
Alexis Marie Wright 2018-12-02 15:42:59 -05:00
parent 88f2b51405
commit af74c14936
1 changed files with 4 additions and 1 deletions

5
bot.py
View File

@ -1,5 +1,8 @@
import teambot,tasks,rss,time,sys,subprocess,re
def unhighlight_nick (nick):
return nick[0] + "\u200b" + nick[1:]
class CosmicBot(teambot.Handler):
def __init__(self,bot):
super(CosmicBot,self).__init__(bot)
@ -51,7 +54,7 @@ class CosmicBot(teambot.Handler):
output = subprocess.check_output(["/usr/local/bin/roster",namecnt]).decode("ascii").split("\n")
for line in output:
line = re.sub("\s+"," ",line).split()
self.say(channel,"{}: {} (by {})".format(nick,line[1],line[0]))
self.say(channel,"{}: {} (by {})".format(unhighlight_nick(nick),line[1],unhighlight_nick(line[0])))
if __name__=="__main__":
channels = "#cosmic".split()