2019-06-24 04:32:00 +00:00
|
|
|
import plugin, re, subprocess
|
2019-06-24 04:23:26 +00:00
|
|
|
|
|
|
|
unhighlight_nick = lambda nick: "_{!s}_".format(nick)
|
|
|
|
|
2019-06-24 04:32:00 +00:00
|
|
|
@plugin.command("roster","<filter>")
|
2019-06-24 04:23:26 +00:00
|
|
|
def on_roster(self,channel,nick,*namecnt):
|
2020-11-16 22:25:40 +00:00
|
|
|
if not namecnt:
|
|
|
|
self.say(channel,"{}: Must supply a filter!".format(nick))
|
|
|
|
return
|
2021-04-29 17:47:06 +00:00
|
|
|
try:
|
|
|
|
output = subprocess.check_output(["/usr/local/bin/roster",' '.join(namecnt)]).decode("utf-8").split("\n")
|
|
|
|
except subprocess.CalledProcessError:
|
|
|
|
self.say(channel,"{}: No such ship/user!".format(nick))
|
|
|
|
return
|
2019-06-24 04:23:26 +00:00
|
|
|
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])))
|