

def func(self):
    'Set the aliases.'
    caller = self.caller
    if (not self.lhs):
        string = 'Usage: @alias <obj> [= [alias[,alias ...]]]'
        self.caller.msg(string)
        return
    objname = self.lhs
    obj = caller.search(objname)
    if (not obj):
        return
    if (self.rhs is None):
        aliases = obj.aliases.all()
        if aliases:
            self.msg(("Aliases for '%s': %s" % (obj.get_display_name(caller), ', '.join(aliases))))
        else:
            caller.msg(("No aliases exist for '%s'." % obj.get_display_name(caller)))
        return
    if (not obj.access(caller, 'edit')):
        caller.msg("You don't have permission to do that.")
        return
    if (not self.rhs):
        old_aliases = obj.aliases.all()
        if old_aliases:
            caller.msg(('Cleared aliases from %s: %s' % (obj.get_display_name(caller), ', '.join(old_aliases))))
            obj.aliases.clear()
        else:
            caller.msg('No aliases to clear.')
        return
    old_aliases = obj.aliases.all()
    new_aliases = [alias.strip().lower() for alias in self.rhs.split(',') if alias.strip()]
    old_aliases.extend(new_aliases)
    aliases = list(set(old_aliases))
    obj.aliases.add(aliases)
    obj.at_cmdset_get(force_init=True)
    caller.msg(("Alias(es) for '%s' set to %s." % (obj.get_display_name(caller), str(obj.aliases))))

dataset/ETHPy150Open evennia/evennia/evennia/commands/default/building.py CmdSetObjAlias.func/VarMisuse@96/130 `caller`->`self`