def get_cmd_if_alias(message): aliases = alias_service.get_aliases() if not aliases: return None for alias in aliases: if message['body'].lower() == alias.name.lower(): return alias.command
def get_aliases(message, args): aliases = alias_service.get_aliases() vk_bot = bot.get_bot() if not aliases: vk_bot.answer_on_message(message, "Ещё нет алиасов.") return output = [] for i, a in enumerate(aliases): output.append( "%s. %s, команда = '%s'" % ( a.id, a.name, a.command ) ) vk_bot.answer_on_message(message, '\n'.join(output))