chat: dymanically allow prefixes
This commit is contained in:
parent
5fccccd206
commit
2f764e00a7
2 changed files with 7 additions and 3 deletions
|
@ -175,7 +175,12 @@ class TTChatInputWhiteList(ChatInputWhiteListFrame):
|
|||
|
||||
def applyFilter(self, keyArgs, strict = False):
|
||||
text = self.chatEntry.get(plain=True)
|
||||
if len(text) > 0 and text[0] in ['~', '>']:
|
||||
prefixes = []
|
||||
if base.cr.magicWordManager and base.cr.wantMagicWords:
|
||||
prefixes.append(base.cr.magicWordManager.chatPrefix)
|
||||
if config.GetBool('exec-chat', 0):
|
||||
prefixes.append('>')
|
||||
if len(text) > 0 and text[0] in prefixes:
|
||||
self.okayToSubmit = True
|
||||
else:
|
||||
words = text.split(' ')
|
||||
|
|
|
@ -49,8 +49,7 @@ class ToontownMagicWordManager(DistributedObject.DistributedObject):
|
|||
DistributedObject.DistributedObject.announceGenerate(self)
|
||||
|
||||
# Only use a custom Magic Word activator if the index is allowed
|
||||
# TODO: Uncomment after adding settings support
|
||||
activatorIndex = 0 # base.settings.getInt('game', 'magic-word-activator', 0)
|
||||
activatorIndex = base.settings.getSetting('magic-word-activator', 0)
|
||||
if 0 <= activatorIndex <= (len(PREFIX_ALLOWED) - 1):
|
||||
self.chatPrefix = PREFIX_ALLOWED[activatorIndex]
|
||||
|
||||
|
|
Loading…
Reference in a new issue