From 26ed6b7f09f412d706a2d3b5e4590e6278fbd860 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 29 May 2019 21:28:49 -0400 Subject: fix some stuff --- .gitignore | 2 ++ tooter.py | 15 +++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 7f7cccc..0b9039b 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,5 @@ docs/_build/ # PyBuilder target/ +tildeteam.json +tildeverse.json diff --git a/tooter.py b/tooter.py index 66b1afc..fe3f72a 100755 --- a/tooter.py +++ b/tooter.py @@ -9,7 +9,7 @@ import sys from mastodon import Mastodon server = ("127.0.0.1", 6667) -channels = ["#bots", "#meta", "#team"] +channels = [] if len(sys.argv) > 1: for c in sys.argv[1:]: channels.append("#" + c) @@ -53,12 +53,14 @@ def eventloop(chan, nick, msg): words = re.split("[ \t\s]+", msg) if len(words) > 0 and nick != "tooter": if words[0] == "!toot": - status = emoji.emojize(words[2:], use_aliases=True) + status = emoji.emojize("".join(words[1:]), use_aliases=True) + print(f"{status} posted by {nick}") if chan == "#team": res = tildeteam.toot(status) else: res = tildeverse.toot(status) - send(chan, f"tooted! {res.url}") + print(res) + send(chan, "tooted! {}".format(res["url"])) elif words[0] == "!source": send(chan, "https://tildegit.org/ben/tooter") elif words[0] == "!botlist" or words[0] == "!toothelp": @@ -94,8 +96,5 @@ if __name__ == "__main__": m = re.match(":(?P[^ ]+)!.*PRIVMSG #(?P\w+) :(?P.*)", msg) if m and m.groupdict(): m = m.groupdict() - try: - eventloop(m["chan"], m["nick"], m["msg"]) - except Exception as e: - print("ERROR" + str(m)) - print(e) + eventloop(m["chan"], m["nick"], m["msg"]) + -- cgit 1.4.1