diff --git a/plugins/Aka/plugin.py b/plugins/Aka/plugin.py index c93c84ca4..d07d03687 100644 --- a/plugins/Aka/plugin.py +++ b/plugins/Aka/plugin.py @@ -299,6 +299,8 @@ class Aka(callbacks.Plugin): if biggestDollar or biggestAt: args = getArgs(args, required=biggestDollar, optional=biggestAt, wildcard=wildcard) + max_len = conf.supybot.reply.maximumLength() + args = list(map(lambda x:x[:max_len], args)) def regexpReplace(m): idx = int(m.group(1)) return args[idx-1] @@ -331,6 +333,9 @@ class Aka(callbacks.Plugin): ret = True return (ret, new_tokens) (ret, tokens) = everythingReplace(tokens) + if maxNesting and irc.nested+1 > maxNesting: + irc.error(_('You\'ve attempted more nesting than is ' + 'currently allowed on this bot.'), Raise=True) self.Proxy(irc, msg, tokens) if biggestDollar and (wildcard or biggestAt): flexargs = _(' at least') diff --git a/plugins/Alias/plugin.py b/plugins/Alias/plugin.py index f614dd1e7..187e5674a 100644 --- a/plugins/Alias/plugin.py +++ b/plugins/Alias/plugin.py @@ -178,6 +178,8 @@ def makeNewAlias(name, alias): if biggestDollar or biggestAt: args = getArgs(args, required=biggestDollar, optional=biggestAt, wildcard=wildcard) + max_len = conf.supybot.reply.maximumLength() + args = list(map(lambda x:x[:max_len], args)) def regexpReplace(m): idx = int(m.group(1)) return args[idx-1] @@ -212,7 +214,11 @@ def makeNewAlias(name, alias): return True return False everythingReplace(tokens) - self.Proxy(irc, msg, tokens) + maxNesting = conf.supybot.commands.nested.maximum() + if maxNesting and irc.nested+1 > maxNesting: + irc.error(_('You\'ve attempted more nesting than is ' + 'currently allowed on this bot.'), Raise=True) + self.Proxy(irc, msg, tokens, nested=irc.nested+1) flexargs = '' if biggestDollar and (wildcard or biggestAt): flexargs = _(' at least')