[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:
parent
36071821c3
commit
fe2a4d6fe8
|
@ -30,7 +30,7 @@ class IRCBot(irc.bot.SingleServerIRCBot):
|
|||
# Taken from
|
||||
# https://github.com/jaraco/irc/blob/master/irc/client_aio.py,
|
||||
# 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)
|
||||
)
|
||||
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()
|
||||
if in_the_specified_stream and at_the_specified_subject:
|
||||
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:
|
||||
return
|
||||
else:
|
||||
recipients = [u["short_name"] for u in msg["display_recipient"] if
|
||||
u["email"] != msg["sender_email"]]
|
||||
if len(recipients) == 1:
|
||||
send = lambda x: c.privmsg(recipients[0], x)
|
||||
send = lambda x: self.c.privmsg(recipients[0], x)
|
||||
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"):
|
||||
send(line)
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
irc>=16.4
|
||||
irc==18.0
|
||||
|
|
Loading…
Reference in a new issue