15 lines
492 B
Python
15 lines
492 B
Python
import plugin, subprocess, requests
|
|
|
|
def register_command_call(command,cli,use_args=False,verify_args=lambda args: args):
|
|
@plugin.command(command)
|
|
def on_call(self,channel,nick,*args):
|
|
output = subprocess.check_output([cli]+list(verify_args(args) if use_args else [])).decode("utf-8").split("\n")
|
|
output = filter(None,output)
|
|
for line in output:
|
|
self.say(channel,"{}".format(line))
|
|
|
|
def get(*args,**kwargs):
|
|
r = requests.get(*args,**kwargs)
|
|
r.raise_for_status()
|
|
return r.json()
|