import plugin,subprocess,dictdata def do_toot(s,json="/usr/local/bin/tildeverse"): return subprocess.run(["/usr/local/bin/toot",s],env=dict(TOOT_JSON_PATH=json,LC_ALL="C.UTF-8",LANG="C.UTF-8")).returncode toot_paths = dictdata.DictData("toot_paths.json") @plugin.command("toot") def toot(bot,channel,nick,*args): if do_toot(" ".join(args),toot_paths.get(channel,"/usr/local/bin/tildeverse"))!=0: bot.say(channel,"{}: Toot failed!".format(nick)) else: bot.say(channel,"{}: Toot sent!".format(nick))