mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-21 22:56:38 +01:00
parent
f0dfdfb203
commit
62e76f1fba
4 changed files with 36 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -40,6 +40,7 @@ htmlcov/
|
||||||
.coverage
|
.coverage
|
||||||
.coverage.*
|
.coverage.*
|
||||||
.cache
|
.cache
|
||||||
|
.pytest_cache
|
||||||
nosetests.xml
|
nosetests.xml
|
||||||
coverage.xml
|
coverage.xml
|
||||||
*,cover
|
*,cover
|
||||||
|
|
|
@ -51,6 +51,7 @@ The following wonderful people contributed directly or indirectly to this projec
|
||||||
- `njittam <https://github.com/njittam>`_
|
- `njittam <https://github.com/njittam>`_
|
||||||
- `Noam Meltzer <https://github.com/tsnoam>`_
|
- `Noam Meltzer <https://github.com/tsnoam>`_
|
||||||
- `Oleg Shlyazhko <https://github.com/ollmer>`_
|
- `Oleg Shlyazhko <https://github.com/ollmer>`_
|
||||||
|
- `Oleg Sushchenko <https://github.com/feuillemorte>`_
|
||||||
- `overquota <https://github.com/overquota>`_
|
- `overquota <https://github.com/overquota>`_
|
||||||
- `Patrick Hofmann <https://github.com/PH89>`_
|
- `Patrick Hofmann <https://github.com/PH89>`_
|
||||||
- `Pieter Schutz <https://github.com/eldinnie>`_
|
- `Pieter Schutz <https://github.com/eldinnie>`_
|
||||||
|
|
|
@ -468,6 +468,26 @@ class Message(TelegramObject):
|
||||||
|
|
||||||
return self.bot.send_message(self.chat_id, *args, **kwargs)
|
return self.bot.send_message(self.chat_id, *args, **kwargs)
|
||||||
|
|
||||||
|
def reply_media_group(self, *args, **kwargs):
|
||||||
|
"""Shortcut for::
|
||||||
|
|
||||||
|
bot.reply_media_group(update.message.chat_id, *args, **kwargs)
|
||||||
|
|
||||||
|
Keyword Args:
|
||||||
|
quote (:obj:`bool`, optional): If set to ``True``, the media group is sent as an
|
||||||
|
actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``,
|
||||||
|
this parameter will be ignored. Default: ``True`` in group chats and ``False`` in
|
||||||
|
private chats.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
List[:class:`telegram.Message`]: An array of the sent Messages.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
:class:`telegram.TelegramError`
|
||||||
|
"""
|
||||||
|
self._quote(kwargs)
|
||||||
|
return self.bot.send_media_group(self.chat_id, *args, **kwargs)
|
||||||
|
|
||||||
def reply_photo(self, *args, **kwargs):
|
def reply_photo(self, *args, **kwargs):
|
||||||
"""Shortcut for::
|
"""Shortcut for::
|
||||||
|
|
||||||
|
|
|
@ -291,6 +291,20 @@ class TestMessage(object):
|
||||||
reply_to_message_id=message.message_id,
|
reply_to_message_id=message.message_id,
|
||||||
quote=True)
|
quote=True)
|
||||||
|
|
||||||
|
def test_reply_media_group(self, monkeypatch, message):
|
||||||
|
def test(*args, **kwargs):
|
||||||
|
id = args[1] == message.chat_id
|
||||||
|
media = kwargs['media'] == 'reply_media_group'
|
||||||
|
if kwargs.get('reply_to_message_id'):
|
||||||
|
reply = kwargs['reply_to_message_id'] == message.message_id
|
||||||
|
else:
|
||||||
|
reply = True
|
||||||
|
return id and media and reply
|
||||||
|
|
||||||
|
monkeypatch.setattr('telegram.Bot.send_media_group', test)
|
||||||
|
assert message.reply_media_group(media='reply_media_group')
|
||||||
|
assert message.reply_media_group(media='reply_media_group', quote=True)
|
||||||
|
|
||||||
def test_reply_photo(self, monkeypatch, message):
|
def test_reply_photo(self, monkeypatch, message):
|
||||||
def test(*args, **kwargs):
|
def test(*args, **kwargs):
|
||||||
id = args[1] == message.chat_id
|
id = args[1] == message.chat_id
|
||||||
|
|
Loading…
Reference in a new issue