def handle_aliasset(bot, ievent): """ alias-set <from> <to> .. set alias. """ global aliases try: (aliasfrom, aliasto) = (ievent.args[0], ' '.join(ievent.args[1:])) except IndexError: ievent.missing('<from> <to>') return if not aliasto: ievent.missing('<from> <to>') return if aliases.data.has_key(aliasto): ievent.reply("can't alias an alias") return if cmnds.has_key(aliasfrom): ievent.reply('command with same name already exists.') return # add alias and save aliasset(aliasfrom, aliasto) aliases.save() ievent.reply('alias added')
def undefine(self, key, throw=False): try: option = self.data[key] if option.exposed: if cmnds.has_key(option.name): del cmnds[option.name] if examples.has_key(option.name): del examples[option.name] del self.data[key] self.save() return True except KeyError, e: if throw: raise