mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Restricted the characters that a prefix character can be.
This commit is contained in:
parent
7642def926
commit
877d376988
@ -439,7 +439,12 @@ def main():
|
|||||||
import callbacks
|
import callbacks
|
||||||
conf.prefixChars = anything('What would you like your bot\'s '
|
conf.prefixChars = anything('What would you like your bot\'s '
|
||||||
'prefix character(s) to be?')
|
'prefix character(s) to be?')
|
||||||
while callbacks.canonicalName(conf.prefixChars) != conf.prefixChars:
|
invalidPrefixChar = True
|
||||||
|
while invalidPrefixChar:
|
||||||
|
for c in conf.prefixChars:
|
||||||
|
if c not in conf.validPrefixChars:
|
||||||
|
invalidPrefixChar = True
|
||||||
|
myPrint('%r is not a valid prefixChar.' % c)
|
||||||
conf.prefixChars = anything('That includes one or more invalid '
|
conf.prefixChars = anything('That includes one or more invalid '
|
||||||
'prefix characters. What would you'
|
'prefix characters. What would you'
|
||||||
'like your bot\'s prefix character(s)'
|
'like your bot\'s prefix character(s)'
|
||||||
|
@ -244,8 +244,10 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
Sets the prefix chars by which the bot can be addressed.
|
Sets the prefix chars by which the bot can be addressed.
|
||||||
"""
|
"""
|
||||||
s = privmsgs.getArgs(args)
|
s = privmsgs.getArgs(args)
|
||||||
if s.translate(string.ascii, string.ascii_letters) == '':
|
for c in s:
|
||||||
irc.error(msg, 'Prefixes cannot contain letters.')
|
if c not in conf.validPrefixChars:
|
||||||
|
s = 'PrefixChars must be something in %r'%conf.validPrefixChars
|
||||||
|
irc.error(msg, s)
|
||||||
else:
|
else:
|
||||||
conf.prefixChars = s
|
conf.prefixChars = s
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
|
@ -222,6 +222,12 @@ ignores = []
|
|||||||
###
|
###
|
||||||
prefixChars = '@'
|
prefixChars = '@'
|
||||||
|
|
||||||
|
###
|
||||||
|
# validPrefixChars: A string of chars that are allowed to be used as
|
||||||
|
# prefixChars.
|
||||||
|
###
|
||||||
|
validPrefixChars = '`~!@#$%^&*()_-+=[{}]\\|\'";:,<.>/?'
|
||||||
|
|
||||||
###
|
###
|
||||||
# detailedTracebacks: A boolean describing whether or not the bot will give
|
# detailedTracebacks: A boolean describing whether or not the bot will give
|
||||||
# *extremely* detailed tracebacks. Be cautioned, this eats
|
# *extremely* detailed tracebacks. Be cautioned, this eats
|
||||||
|
Loading…
Reference in New Issue
Block a user