From ebfc76f17b64cfca38ffafea4e2cbd6ed2800e0b Mon Sep 17 00:00:00 2001 From: Yuuki Chan Date: Thu, 22 Feb 2024 20:31:54 +0900 Subject: [PATCH 1/2] Updated db.py --- src/db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/db.py b/src/db.py index 2e252b0..5ad154e 100644 --- a/src/db.py +++ b/src/db.py @@ -16,7 +16,7 @@ class Database: if not inspect(self.engine).has_table(table_name): self.meta.create_all(self.engine) - def set(self, user: str, values: dict): + def set_user(self, user: str, values: dict): with self.engine.connect() as conn: stmt = select(self.table).where(self.table.c.name == user) cnt = len(conn.execute(stmt).fetchall()) @@ -28,7 +28,7 @@ class Database: )) conn.commit() - def get(self, user: str, index: int): + def get_user(self, user: str, index: int): with self.engine.connect() as conn: stmt = select(self.table).where(self.table.c.name == user) cnt = len(conn.execute(stmt).fetchall()) -- 2.34.1 From 4b6c7681263514762d8875d9fb8e638d3aaf0641 Mon Sep 17 00:00:00 2001 From: Yuuki Chan Date: Thu, 22 Feb 2024 23:45:28 +0900 Subject: [PATCH 2/2] Possibly fixed SASL timeout, needs further testing. --- src/bot.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/bot.py b/src/bot.py index e32f5ad..2dd69f6 100644 --- a/src/bot.py +++ b/src/bot.py @@ -135,6 +135,7 @@ class Bot: ssl=ssl_context ) + await self.ircsend('CAP LS 302') await self.ircsend(f'NICK {self.config["Connection"].get("Nick")}') await self.ircsend( f'USER {self.config["Connection"].get("Ident")} * * :{self.config["Connection"].get("Name")}') @@ -177,6 +178,9 @@ class Bot: self.logger.debug(f'Received: source: {source} | command: {command} | args: {args}') match command: + case 'CAP': + if args[1] == 'ACK' and 'sasl' in args[2]: + await handle_sasl(self.config, self.ircsend) case 'PING': nospoof = args[0][1:] if args[0].startswith(':') else args[0] await self.ircsend(f'PONG :{nospoof}') @@ -195,9 +199,6 @@ class Bot: for plugin in self.plugins: await plugin.handle_message(source_nick, channel, message) - case 'CAP': - if args[1] == 'ACK' and 'sasl' in args[2]: - await handle_sasl(self.config, self.ircsend) case 'AUTHENTICATE': await handle_authenticate(args, self.config, self.ircsend) case 'INVITE': @@ -207,8 +208,9 @@ class Bot: case 'VERSION': await self.ircsend(f'NOTICE {source_nick} :I am a bot version 1.0.0') case '001': - for channel in self.channel_manager.get_channels(): - await self.ircsend(f'JOIN {channel}') + await self.ircsend(f'JOIN #YuukiTest') + # for channel in self.channel_manager.get_channels(): + # await self.ircsend(f'JOIN {channel}') case '903': await handle_903(self.ircsend) case _: -- 2.34.1