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:
@@ -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):
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user