Add toot plugin

This commit is contained in:
Robert Miles 2019-02-16 21:35:07 -05:00
parent b98293bdef
commit 2653cc4633
2 changed files with 14 additions and 0 deletions

View File

@ -13,4 +13,5 @@ class DictData(plugin.JSONData):
def __contains__(self,k):
return k in self.value
def get(self,k,default=None):
self.load(self.filename)
return self.value.get(k,default)

13
plugins/toot.py Normal file
View File

@ -0,0 +1,13 @@
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))