[BUGFIX] IRC bridge: Use connection initialized from aio_reactor.

Additionally, pin the irc library version to 18.0 because the newer
version has an error in the AioReactor:
```
  File "/home/rht/code/venv/lib/python3.8/site-packages/irc/bot.py", line 108, in run
    self.bot.reactor.scheduler.execute_after(intvl, self.check)
AttributeError: 'AioReactor' object has no attribute 'scheduler'
```
This commit is contained in:
rht 2020-08-09 04:13:08 -04:00 committed by Tim Abbott
parent 36071821c3
commit fe2a4d6fe8
2 changed files with 5 additions and 5 deletions

View file

@ -30,7 +30,7 @@ class IRCBot(irc.bot.SingleServerIRCBot):
# Taken from # Taken from
# https://github.com/jaraco/irc/blob/master/irc/client_aio.py, # https://github.com/jaraco/irc/blob/master/irc/client_aio.py,
# in particular the method of AioSimpleIRCClient # in particular the method of AioSimpleIRCClient
self.reactor.loop.run_until_complete( self.c = self.reactor.loop.run_until_complete(
self.connection.connect(*args, **kwargs) self.connection.connect(*args, **kwargs)
) )
print("Listening now. Please send an IRC message to verify operation") print("Listening now. Please send an IRC message to verify operation")
@ -65,16 +65,16 @@ class IRCBot(irc.bot.SingleServerIRCBot):
at_the_specified_subject = msg["subject"].casefold() == self.topic.casefold() at_the_specified_subject = msg["subject"].casefold() == self.topic.casefold()
if in_the_specified_stream and at_the_specified_subject: if in_the_specified_stream and at_the_specified_subject:
msg["content"] = ("@**%s**: " % msg["sender_full_name"]) + msg["content"] msg["content"] = ("@**%s**: " % msg["sender_full_name"]) + msg["content"]
send = lambda x: c.privmsg(self.channel, x) send = lambda x: self.c.privmsg(self.channel, x)
else: else:
return return
else: else:
recipients = [u["short_name"] for u in msg["display_recipient"] if recipients = [u["short_name"] for u in msg["display_recipient"] if
u["email"] != msg["sender_email"]] u["email"] != msg["sender_email"]]
if len(recipients) == 1: if len(recipients) == 1:
send = lambda x: c.privmsg(recipients[0], x) send = lambda x: self.c.privmsg(recipients[0], x)
else: else:
send = lambda x: c.privmsg_many(recipients, x) send = lambda x: self.c.privmsg_many(recipients, x)
for line in msg["content"].split("\n"): for line in msg["content"].split("\n"):
send(line) send(line)

View file

@ -1 +1 @@
irc>=16.4 irc==18.0