forked from khuxkm/cosmicbot
15 lines
540 B
Python
15 lines
540 B
Python
import plugin, re, subprocess
|
|
|
|
unhighlight_nick = lambda nick: "_{!s}_".format(nick)
|
|
|
|
@plugin.command("roster","<filter>")
|
|
def on_roster(self,channel,nick,*namecnt):
|
|
if not namecnt:
|
|
self.say(channel,"{}: Must supply a filter!".format(nick))
|
|
return
|
|
output = subprocess.check_output(["/usr/local/bin/roster",' '.join(namecnt)]).decode("utf-8").split("\n")
|
|
output = filter(None,output)
|
|
for line in output:
|
|
line = re.sub("\s+"," ",line).split(" ",1)
|
|
self.say(channel,"{}: {} (by {})".format(nick,line[1],unhighlight_nick(line[0])))
|