mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Alias & Aka: Add memory and nesting limits. Closes GH-525.
This commit is contained in:
parent
4c24f30504
commit
ddbadcafff
@ -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')
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user