diff options
Diffstat (limited to 'include/py/homekit/telegram')
-rw-r--r-- | include/py/homekit/telegram/bot.py | 2 | ||||
-rw-r--r-- | include/py/homekit/telegram/config.py | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/include/py/homekit/telegram/bot.py b/include/py/homekit/telegram/bot.py index 2efd9e4..f5f620a 100644 --- a/include/py/homekit/telegram/bot.py +++ b/include/py/homekit/telegram/bot.py @@ -266,7 +266,7 @@ class conversation: return self.invoke(state, ctx) return _invoke - def invoke(self, state, ctx: Context): + async def invoke(self, state, ctx: Context): self._logger.debug(f'invoke, state={state}') for item in dir(self): f = getattr(self, item) diff --git a/include/py/homekit/telegram/config.py b/include/py/homekit/telegram/config.py index 4c7d74b..5f41008 100644 --- a/include/py/homekit/telegram/config.py +++ b/include/py/homekit/telegram/config.py @@ -51,15 +51,15 @@ class TelegramBotConfig(ConfigUnit, ABC): 'type': 'dict', 'schema': { 'token': {'type': 'string', 'required': True}, - TelegramUserListType.USERS: {**TelegramBotConfig._userlist_schema(), 'required': True}, - TelegramUserListType.NOTIFY: TelegramBotConfig._userlist_schema(), + TelegramUserListType.USERS.value: {**TelegramBotConfig._userlist_schema(), 'required': True}, + TelegramUserListType.NOTIFY.value: TelegramBotConfig._userlist_schema(), } } } @staticmethod def _userlist_schema() -> dict: - return {'type': 'list', 'schema': {'type': ['string', 'int']}} + return {'type': 'list', 'schema': {'type': ['string', 'integer']}} @staticmethod def custom_validator(data): @@ -72,4 +72,7 @@ class TelegramBotConfig(ConfigUnit, ABC): def get_user_ids(self, ult: TelegramUserListType = TelegramUserListType.USERS) -> list[int]: - return list(map(_user_id_mapper, self['bot'][ult.value]))
\ No newline at end of file + try: + return list(map(_user_id_mapper, self['bot'][ult.value])) + except KeyError: + return []
\ No newline at end of file |