diff --git a/src/api/v2/user_api.py b/src/api/v2/user_api.py index dc5f794..bba9363 100644 --- a/src/api/v2/user_api.py +++ b/src/api/v2/user_api.py @@ -17,7 +17,7 @@ class UserAPI: status, json_data = await self.__fetcher.send_json(endpoint, { 'username': username, - 'matrix_username': matrix_username, + 'matrixUsername': matrix_username, 'phone': phone, }) diff --git a/src/handlers/__init__.py b/src/handlers/__init__.py index c41d64a..b6eea86 100644 --- a/src/handlers/__init__.py +++ b/src/handlers/__init__.py @@ -2,7 +2,7 @@ import nio import simplematrixbotlib as botlib from src.handlers.help import help_handler -from src.handlers.city import list_cities_handler, select_city_handler +from src.handlers.city import city_list_handler, select_city_handler from src.handlers.user import register_handler from src.fmt.city_formatter import CityFormatter @@ -18,11 +18,13 @@ def setup(bot: botlib.Bot, prefix: str): if not match.prefix(): return + # No registered user required + if match.command('help'): await help_handler(bot=bot, room_id=room.room_id, sender=message.sender, admin_id=bot.config.admin_id) - if match.command('cities-list'): - await list_cities_handler(bot=bot, room_id=room.room_id, sender=message.sender, admin_id=bot.config.admin_id) + if match.command('city-list'): + await city_list_handler(bot=bot, room_id=room.room_id, sender=message.sender, admin_id=bot.config.admin_id) if match.command('select-city'): formatter = CityFormatter() diff --git a/src/handlers/city.py b/src/handlers/city.py index 771a18b..10de3bb 100644 --- a/src/handlers/city.py +++ b/src/handlers/city.py @@ -10,7 +10,7 @@ from src.fmt.city_formatter import CityFormatter dots_bot_api_config = DotsBotApiConfig() -async def list_cities_handler(room_id: str, bot: botlib.Bot, sender: str, admin_id: str): +async def city_list_handler(room_id: str, bot: botlib.Bot, sender: str, admin_id: str): session = aiohttp.ClientSession(json_serialize=ujson.dumps) apiFetcher = ApiFetcher(dots_bot_api_config.get_base_url(), session)