From 7eeb670a59ccfe8242a1bbf6754da42131028979 Mon Sep 17 00:00:00 2001 From: Bibo-Joshi Date: Wed, 5 Dec 2018 00:12:43 +0100 Subject: [PATCH] Fix check for effective chat/user in persistence (#1303) --- telegram/ext/dispatcher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telegram/ext/dispatcher.py b/telegram/ext/dispatcher.py index de7af4e4f..2ee47f11d 100644 --- a/telegram/ext/dispatcher.py +++ b/telegram/ext/dispatcher.py @@ -300,13 +300,13 @@ class Dispatcher(object): for handler in (x for x in self.handlers[group] if x.check_update(update)): handler.handle_update(update, self) if self.persistence and isinstance(update, Update): - if self.persistence.store_chat_data and update.effective_chat.id: + if self.persistence.store_chat_data and update.effective_chat: chat_id = update.effective_chat.id try: self.persistence.update_chat_data(chat_id, self.chat_data[chat_id]) except Exception: self.logger.exception('Saving chat data raised an error') - if self.persistence.store_user_data and update.effective_user.id: + if self.persistence.store_user_data and update.effective_user: user_id = update.effective_user.id try: self.persistence.update_user_data(user_id, self.user_data[user_id])