Updated bot.py

This commit is contained in:
Yuuki Chan 2024-02-25 22:17:04 +09:00
parent ba8929164d
commit e490b80415

View file

@ -103,6 +103,12 @@ class Bot:
self.logger.error(f'Error sending IRC message: {e}') self.logger.error(f'Error sending IRC message: {e}')
raise 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): def parse_message(self, message):
parts = message.split() parts = message.split()
if not parts: if not parts:
@ -135,10 +141,11 @@ class Bot:
ssl=ssl_context 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'NICK {self.config["Connection"].get("Nick")}')
await self.ircsend( await self.ircsend(f'USER {self.config["Connection"].get("Ident")} * * :'
f'USER {self.config["Connection"].get("Ident")} * * :{self.config["Connection"].get("Name")}') f'{self.config["Connection"].get("Name")}')
if self.config['SASL'].get('UseSASL'): if self.config['SASL'].get('UseSASL'):
await self.ircsend('CAP REQ :sasl') await self.ircsend('CAP REQ :sasl')
except Exception as e: except Exception as e: