From 85c0d717dabb10659e36ff8157677867bfedc2df Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 9 Apr 2019 12:41:42 +0200 Subject: [PATCH] Bugfix in call.get_author for telegram bots --- royalnet/bots/telegram.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/royalnet/bots/telegram.py b/royalnet/bots/telegram.py index 0aab1b40..2f3d026d 100644 --- a/royalnet/bots/telegram.py +++ b/royalnet/bots/telegram.py @@ -82,7 +82,10 @@ class TelegramBot: for link in self.identity_chain: query = query.join(link.mapper.class_) query = query.filter(self.identity_column == user.id) - return await asyncify(query.one_or_none) + result = await asyncify(query.one_or_none) + if result is None and error_if_none: + raise UnregisteredError("Author is not registered!") + return result self.TelegramCall = TelegramCall