From ffb2d4204ec0d99a0085622f4d12af3e3c7c4e56 Mon Sep 17 00:00:00 2001 From: Alek Ratzloff Date: Mon, 23 May 2022 21:11:04 -0700 Subject: [PATCH] Move message size limit logic to base plugin This is beneficial for all plugins so the bot doesn't accidentally spam things because the plugin writer didn't check their inputs Signed-off-by: Alek Ratzloff --- omnibot/plugin.py | 2 +- plugins/linkbot.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/omnibot/plugin.py b/omnibot/plugin.py index 474e785..9fdd5ee 100644 --- a/omnibot/plugin.py +++ b/omnibot/plugin.py @@ -36,7 +36,7 @@ class Plugin: return self.server_config.nick def send_to(self, conn: IrcProtocol, who: str, message: str): - message = Message(None, None, "PRIVMSG", who, message) + message = Message(None, None, "PRIVMSG", who, message[:1024]) conn.send(str(message)) async def on_join(self, conn: IrcProtocol, channel: str, who: Prefix): diff --git a/plugins/linkbot.py b/plugins/linkbot.py index a34882b..ba2f814 100644 --- a/plugins/linkbot.py +++ b/plugins/linkbot.py @@ -105,7 +105,7 @@ class Linkbot(Plugin): message = None if message: - self.send_to(conn, channel, message[:1024]) + self.send_to(conn, channel, message) PLUGIN_TYPE = Linkbot