about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStef Dunlap <stef@kindrobot.ca>2022-06-14 16:46:52 -0400
committerStef Dunlap <stef@kindrobot.ca>2022-06-14 16:46:52 -0400
commit2e242aea1e06571ec415530b478d240b8f4e316d (patch)
treef3c688233d05445d74dc25fe80b287727c64aa0c
parent8715023f5837b2783ad3da44410f415fbf855ab5 (diff)
Fixes for use off of tilde.chat/tildeverse
- correctly parses channels from config per config.example.yaml
- sets TLS to None in case of no TLS
  - on tilde.town we commonly connect to localhost w/o ssl
  - for ircrobots (and/or it's dependencies) TLS must be none (not
    false) or else it will assume SSL/TLS

I am not a python expert, so please feel free to comment or fix.
-rw-r--r--config.py6
-rw-r--r--tooter.py4
2 files changed, 7 insertions, 3 deletions
diff --git a/config.py b/config.py
index e69528d..0844a1b 100644
--- a/config.py
+++ b/config.py
@@ -26,7 +26,7 @@ def load(filepath: str):
 
     server = config_yaml["server"]
     hostname, port_s = server.split(":", 1)
-    tls = False
+    tls = None
 
     if port_s.startswith("+"):
         tls = True
@@ -42,8 +42,8 @@ def load(filepath: str):
             access_token=acct["access_token"],
             api_base_url=acct["api_base_url"],
         )
-        if "channel" in acct:
-            channels[acct["channel"]] = acct["name"]
+        for channel in acct["channels"]:
+            channels[channel] = acct["name"]
 
     return Config(
         (hostname, port, tls),
diff --git a/tooter.py b/tooter.py
index 9c16e71..f2dba55 100644
--- a/tooter.py
+++ b/tooter.py
@@ -36,6 +36,10 @@ def think(self, line):
                 res = account.toot(f"{status}\n~{author}")
                 if res:
                     return "tooted! {}".format(res["url"])
+                else:
+                    return "tooted failed :("
+            else:
+                return "no account :("
         else:
             return HELP_TEXT