diff options
Diffstat (limited to 'tooter.py')
-rw-r--r-- | tooter.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tooter.py b/tooter.py index 8a54a68..6447801 100644 --- a/tooter.py +++ b/tooter.py @@ -1,10 +1,11 @@ #!/usr/bin/env python3 -from mastodon import Mastodon -from irctokens import build, Line +from .config import Config from ircrobots import Bot as BaseBot -from ircrobots import Server as BaseServer from ircrobots import ConnectionParams, SASLUserPass +from ircrobots import Server as BaseServer +from irctokens import build, Line +from mastodon import Mastodon import asyncio import emoji import glob @@ -68,6 +69,14 @@ def think(line): class Server(BaseServer): + def __init__(self, + bot: BaseBot, + name: str, + config: Config): + + super().__init__(bot, name) + self._config = config + async def line_send(self, line: Line): print(f"{self.name} > {line.format()}") @@ -102,12 +111,13 @@ class Bot(BaseBot): async def main(): params = ConnectionParams( - config["botnick"], - host=config["address"], - port=config["port"], - tls=config["tls"], + config.get("botnick", "tooter"), + config.get("address", "127.0.0.1"), + config.get("port", 6667), + config.get("tls", False), sasl=SASLUserPass(account["username"], account["password"]), ) + bot = Bot() await bot.add_server("tilde", params) await bot.run() |