breaking change, support ircrobots >= 0.6

tls option in config is no longer required
This commit is contained in:
xfnw 2022-08-26 08:08:10 -04:00
parent e82956fd4a
commit 7e1206a3fc
2 changed files with 9 additions and 10 deletions

11
bot.py
View File

@ -25,9 +25,8 @@ class Server(BaseServer):
reader, writer = await transport.connect( reader, writer = await transport.connect(
params.host, params.host,
params.port, params.port,
tls =params.tls, tls =params.tls,
tls_verify=params.tls_verify, bindhost =params.bindhost)
bindhost =params.bindhost)
self._reader = reader self._reader = reader
self._writer = writer self._writer = writer
@ -55,7 +54,7 @@ class Server(BaseServer):
if text[:len(self.nickname)+2].lower() == f'{self.nickname}: '.lower(): if text[:len(self.nickname)+2].lower() == f'{self.nickname}: '.lower():
args = text[len(self.nickname)+2:].split(' ') args = text[len(self.nickname)+2:].split(' ')
if args[0] == 'connect' and len(args) > 4: if args[0] == 'connect' and len(args) > 4:
await self.bot.add_server(args[1],ConnectionParams(NICKNAME,args[2],args[3],bool(int(args[4])))) await self.bot.add_server(args[1],ConnectionParams(NICKNAME,args[2],args[3]))
await self.send(build("PRIVMSG",[self.chan,"Connected to {} :3".format(args[1])])) await self.send(build("PRIVMSG",[self.chan,"Connected to {} :3".format(args[1])]))
return return
if args[0] == 'unlink' and len(args) > 1: if args[0] == 'unlink' and len(args) > 1:
@ -120,8 +119,8 @@ def find_all_indexes(input_str, search_str):
async def main(): async def main():
bot = Bot() bot = Bot()
for name, host, port, ssl in SERVERS: for name, host, port in SERVERS:
params = ConnectionParams(NICKNAME, host, port, ssl) params = ConnectionParams(NICKNAME, host, port)
await bot.add_server(name, params) await bot.add_server(name, params)
await bot.run() await bot.run()

View File

@ -1,10 +1,10 @@
# name hostname port tls # name hostname port tls
SERVERS = [ SERVERS = [
("tilde", "irc.tilde.chat.invalid", 6697, True), ("tilde", "irc.tilde.chat.invalid", 6697),
("technet","irc.technet.xi.ht.invalid", 6697, True), ("technet","irc.technet.xi.ht.invalid", 6697),
("vulpineawoo","foxes.are.allowed.org.invalid", 6697, True), ("vulpineawoo","foxes.are.allowed.org.invalid", 6697),
("alphachat","irc.alphachat.net.invalid", 6697, True), ("alphachat","irc.alphachat.net.invalid", 6697),
] ]
NICKNAME = 'testrelay' NICKNAME = 'testrelay'