mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-02-17 02:34:18 +01:00
Fix check for effective chat/user in persistence (#1303)
This commit is contained in:
parent
f23298a13b
commit
7eeb670a59
1 changed files with 2 additions and 2 deletions
|
@ -300,13 +300,13 @@ class Dispatcher(object):
|
||||||
for handler in (x for x in self.handlers[group] if x.check_update(update)):
|
for handler in (x for x in self.handlers[group] if x.check_update(update)):
|
||||||
handler.handle_update(update, self)
|
handler.handle_update(update, self)
|
||||||
if self.persistence and isinstance(update, Update):
|
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
|
chat_id = update.effective_chat.id
|
||||||
try:
|
try:
|
||||||
self.persistence.update_chat_data(chat_id, self.chat_data[chat_id])
|
self.persistence.update_chat_data(chat_id, self.chat_data[chat_id])
|
||||||
except Exception:
|
except Exception:
|
||||||
self.logger.exception('Saving chat data raised an error')
|
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
|
user_id = update.effective_user.id
|
||||||
try:
|
try:
|
||||||
self.persistence.update_user_data(user_id, self.user_data[user_id])
|
self.persistence.update_user_data(user_id, self.user_data[user_id])
|
||||||
|
|
Loading…
Add table
Reference in a new issue