about summary refs log tree commit diff
path: root/tooter.py
diff options
context:
space:
mode:
Diffstat (limited to 'tooter.py')
-rwxr-xr-xtooter.py15
1 files changed, 7 insertions, 8 deletions
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<nick>[^ ]+)!.*PRIVMSG #(?P<chan>\w+) :(?P<msg>.*)", 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"])
+