diff --git a/src/callbacks.py b/src/callbacks.py index 4f06e4023..2642bfa7f 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -721,6 +721,9 @@ class IrcObjectProxy(RichReplyMethods): if self.finalEvaled: try: if not isinstance(self.irc, irclib.Irc): + s = s[:conf.supybot.reply.maximumLength()] + if conf.get(supybot.reply.truncate, self.msg.args[0]): + s = s[:512] self.irc.reply(s, to=self.to, notice=self.notice, action=self.action, diff --git a/src/conf.py b/src/conf.py index 6c64207e3..d2bdab66c 100644 --- a/src/conf.py +++ b/src/conf.py @@ -261,6 +261,10 @@ registerGlobalValue(supybot, 'channels', ### registerGroup(supybot, 'reply') +registerGlobalValue(supybot.reply, 'maximumLength', + registry.Integer(512*256, """Determines the absolute maximum length of the + bot's reply -- no reply will passed through the bot greater than this.""")) + registerChannelValue(supybot.reply, 'truncate', registry.Boolean(False, """Determines whether the bot will simply truncate messages instead of breaking up long messages and using the 'more' command