From e490b8041504c90794b6c44e668c6f47b3536dd0 Mon Sep 17 00:00:00 2001 From: Yuuki Chan Date: Sun, 25 Feb 2024 22:17:04 +0900 Subject: [PATCH] Updated bot.py --- src/bot.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/bot.py b/src/bot.py index 8810bb8..8317786 100644 --- a/src/bot.py +++ b/src/bot.py @@ -103,6 +103,12 @@ class Bot: self.logger.error(f'Error sending IRC message: {e}') raise + async def privmsg(self, target, msg): + await self.ircsend(f'PRIVMSG {target} :{msg}') + + async def action(self, target, msg): + await self.ircsend(f'PRIVMSG {target} :\x01ACTION {msg}\x01') + def parse_message(self, message): parts = message.split() if not parts: @@ -135,10 +141,11 @@ class Bot: ssl=ssl_context ) - await self.ircsend('CAP LS 302') + if self.config['SASL'].get('UseSASL'): + 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")}') + await self.ircsend(f'USER {self.config["Connection"].get("Ident")} * * :' + f'{self.config["Connection"].get("Name")}') if self.config['SASL'].get('UseSASL'): await self.ircsend('CAP REQ :sasl') except Exception as e: