mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-22 07:06:26 +01:00
Add user to MessageEntity #302
This commit is contained in:
parent
68b5562c49
commit
108e4264fc
1 changed files with 5 additions and 1 deletions
|
@ -18,7 +18,7 @@
|
||||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||||
"""This module contains a object that represents a Telegram MessageEntity."""
|
"""This module contains a object that represents a Telegram MessageEntity."""
|
||||||
|
|
||||||
from telegram import TelegramObject
|
from telegram import User, TelegramObject
|
||||||
|
|
||||||
|
|
||||||
class MessageEntity(TelegramObject):
|
class MessageEntity(TelegramObject):
|
||||||
|
@ -31,6 +31,7 @@ class MessageEntity(TelegramObject):
|
||||||
offset (int):
|
offset (int):
|
||||||
length (int):
|
length (int):
|
||||||
url (Optional[str]):
|
url (Optional[str]):
|
||||||
|
user (Optional[:class:`telegram.User`]):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, type, offset, length, **kwargs):
|
def __init__(self, type, offset, length, **kwargs):
|
||||||
|
@ -40,11 +41,14 @@ class MessageEntity(TelegramObject):
|
||||||
self.length = length
|
self.length = length
|
||||||
# Optionals
|
# Optionals
|
||||||
self.url = kwargs.get('url')
|
self.url = kwargs.get('url')
|
||||||
|
self.user = kwargs.get('user')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def de_json(data):
|
def de_json(data):
|
||||||
data = super(MessageEntity, MessageEntity).de_json(data)
|
data = super(MessageEntity, MessageEntity).de_json(data)
|
||||||
|
|
||||||
|
data['user'] = User.de_json(data.get('user'))
|
||||||
|
|
||||||
return MessageEntity(**data)
|
return MessageEntity(**data)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in a new issue