Recently I was working on a simple Telegram bot written in python (with the python-telegram-bot
library). In this bot I can get the last message object using following command :
bot.getUpdates()[-1].message
and according the Telegram Doc a message object is contains some attributes such as message_id,from,date,chat
,... which the from
attribute returns a User object which is the sender of a message. But since from
is a python keyword (used at import time) thus we can not use it which raise a SyntaxError.
As an alternative way we can use chat
attribute which returns a User object in personal chats and a GroupChat
object in groups that it doesn't contains and information about the user.Also I couldn't find any direct way to report this bug.
So the question is that is there any way to do this job? or any alternative solution maybe?