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 <alekratz@gmail.com>
This commit is contained in:
2022-05-23 21:11:04 -07:00
parent 3476c06e16
commit ffb2d4204e
2 changed files with 2 additions and 2 deletions

View File

@@ -36,7 +36,7 @@ class Plugin:
return self.server_config.nick return self.server_config.nick
def send_to(self, conn: IrcProtocol, who: str, message: str): 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)) conn.send(str(message))
async def on_join(self, conn: IrcProtocol, channel: str, who: Prefix): async def on_join(self, conn: IrcProtocol, channel: str, who: Prefix):

View File

@@ -105,7 +105,7 @@ class Linkbot(Plugin):
message = None message = None
if message: if message:
self.send_to(conn, channel, message[:1024]) self.send_to(conn, channel, message)
PLUGIN_TYPE = Linkbot PLUGIN_TYPE = Linkbot