diff options
-rw-r--r-- | tooter.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tooter.py b/tooter.py index 4e98182..117185f 100644 --- a/tooter.py +++ b/tooter.py @@ -9,6 +9,7 @@ import re import socket import sys +HELPTEXT = "helo i can send toots from irc: @tildeverse@tilde.zone - from @tildeteam from the #team channel)" def masto_from_json(conf): conf = json.load(conf) @@ -38,20 +39,20 @@ def think(line): if len(words) > 0 and line.hostmask.nickname != config["botnick"]: cmd = words[0].lower() if cmd == "!toot": - status = emoji.emojize(" ".join(words[1:]), use_aliases=True) - if chan == "#team": - res = tildeteam.toot(status) + if len(words) >= 2: + status = emoji.emojize(" ".join(words[1:]), use_aliases=True) + if chan == "#team": + res = tildeteam.toot(status) + else: + res = tildeverse.toot(status) + print(res) + send(chan, "tooted! {}".format(res["url"])) else: - res = tildeverse.toot(status) - print(res) - send(chan, "tooted! {}".format(res["url"])) + send(chan, HELPTEXT) elif cmd == "!source": send(chan, "https://tildegit.org/ben/tooter") elif cmd in ["!botlist", "!toothelp"]: - send( - chan, - "helo i can send toots from irc: @tildeverse@tilde.zone - from @tildeteam from the #team channel)", - ) + send(chan, HELPTEXT) # do setup |