This repository has been archived on 2020-05-11. You can view files and clone it, but cannot push or open issues or pull requests.
minerbot2-older/plugins/toot.py

14 lines
508 B
Python

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))