mirror of
https://github.com/evennia/evennia.git
synced 2026-04-05 23:47:16 +02:00
Fixing the strange edge-case of trying to define a command with the same alias being defined multiple times or aliases being the same as the command key. This is now excluded at the Command metaclass level.
This commit is contained in:
parent
f95198fbdb
commit
a8dcfff248
1 changed files with 3 additions and 2 deletions
|
|
@ -23,10 +23,11 @@ class CommandMeta(type):
|
|||
mcs.key = mcs.key.lower()
|
||||
if mcs.aliases and not is_iter(mcs.aliases):
|
||||
try:
|
||||
mcs.aliases = mcs.aliases.split(',')
|
||||
mcs.aliases = [str(alias).strip().lower() for alias in mcs.aliases.split(',')]
|
||||
except Exception:
|
||||
mcs.aliases = []
|
||||
mcs.aliases = [str(alias).strip().lower() for alias in mcs.aliases]
|
||||
mcs.aliases = list(set(alias for alias in mcs.aliases if alias != mcs.key))
|
||||
|
||||
# optimization - a set is much faster to match against than a list
|
||||
mcs._matchset = set([mcs.key] + mcs.aliases)
|
||||
# optimization for looping over keys+aliases
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue