Skip to content

Commit

Permalink
Fix missing media_group_id in message.
Browse files Browse the repository at this point in the history
  • Loading branch information
eternnoir committed Jan 24, 2018
1 parent 6d180e3 commit afac177
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions telebot/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ def de_json(cls, json_string):
opts['reply_to_message'] = Message.de_json(obj['reply_to_message'])
if 'edit_date' in obj:
opts['edit_date'] = obj.get('edit_date')
if 'media_group_id' in obj:
opts['media_group_id'] = obj.get('media_group_id')
if 'author_signature' in obj:
opts['author_signature'] = obj.get('author_signature')
if 'text' in obj:
Expand Down Expand Up @@ -398,6 +400,7 @@ def __init__(self, message_id, from_user, date, chat, content_type, options):
self.forward_date = None
self.reply_to_message = None
self.edit_date = None
self.media_group_id = None
self.author_signature = None
self.text = None
self.entities = None
Expand Down
2 changes: 2 additions & 0 deletions tests/test_telebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,3 +418,5 @@ def test_send_media_group(self):
medias = [types.InputMediaPhoto(img1, "View"), types.InputMediaPhoto(img2, "Dog")]
result = tb.send_media_group(CHAT_ID, medias)
assert len(result) == 2
assert result[0].media_group_id is not None
assert result[0].media_group_id == result[1].media_group_id

0 comments on commit afac177

Please sign in to comment.