Small fix for plugins that accept non-channel messages
There's a long explanation in the code of this commit that says this: > TL;DR OF THE BELOW: if the first parameter looks like a channel in > addition to message type, then filter by channel. Otherwise, don't > filter by channel. > > Here's the issue: plugins are *usually* multiplexed by channel. But > that's only for messages that target channels, such as PRIVMSG and JOIN. > For non-channel messages, such as server status messages (such as 001 on > connect, or 372 for MOTD, etc) we want to ignore the channel aspect of > plugin multiplexing. In order to accomplish this, we just check if the > first parameter looks like a channel - i.e., starts with an octothorpe #. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -58,6 +58,9 @@ class Plugin:
|
||||
|
||||
def send_to(self, conn: IrcProtocol, who: str, message: str):
|
||||
message = Message(None, None, "PRIVMSG", who, message[:1024])
|
||||
self.send_message(conn, message)
|
||||
|
||||
def send_message(self, conn: IrcProtocol, message: Message):
|
||||
conn.send(str(message))
|
||||
|
||||
async def on_join(self, conn: IrcProtocol, channel: str, who: Prefix):
|
||||
|
||||
Reference in New Issue
Block a user