1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00
This commit is contained in:
Steffo 2019-10-17 12:09:11 +02:00
parent 5e8756df2d
commit 7f023ff60b

View file

@ -69,10 +69,10 @@ class TelegramBot(GenericBot):
elif data.update.callback_query is not None: elif data.update.callback_query is not None:
user: telegram.user = data.update.callback_query.from_user user: telegram.user = data.update.callback_query.from_user
else: else:
raise UnregisteredError("Author can not be determined") raise CommandError("Command caller can not be determined")
if user is None: if user is None:
if error_if_none: if error_if_none:
raise UnregisteredError("No author for this message") raise CommandError("No command caller for this message")
return None return None
query = data.interface.session.query(self.master_table) query = data.interface.session.query(self.master_table)
for link in self.identity_chain: for link in self.identity_chain:
@ -80,7 +80,7 @@ class TelegramBot(GenericBot):
query = query.filter(self.identity_column == user.id) query = query.filter(self.identity_column == user.id)
result = await asyncify(query.one_or_none) result = await asyncify(query.one_or_none)
if result is None and error_if_none: if result is None and error_if_none:
raise UnregisteredError("Author is not registered") raise CommandError("Command caller is not registered")
return result return result
async def keyboard(data, text: str, keyboard: typing.Dict[str, typing.Callable]) -> None: async def keyboard(data, text: str, keyboard: typing.Dict[str, typing.Callable]) -> None: