mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-22 15:17:00 +01:00
Remove duplicated/useless codes, added Filters.invoice test
This commit is contained in:
parent
f735a37828
commit
eaf765dcbc
3 changed files with 6 additions and 45 deletions
|
@ -293,13 +293,6 @@ class Filters(object):
|
|||
|
||||
game = _Game()
|
||||
|
||||
class _SuccessfulPayment(BaseFilter):
|
||||
|
||||
def filter(self, message):
|
||||
return bool(message.successful_payment)
|
||||
|
||||
successful_payment = _SuccessfulPayment()
|
||||
|
||||
class entity(BaseFilter):
|
||||
"""Filters messages to only allow those which have a :class:`telegram.MessageEntity`
|
||||
where their `type` matches `entity_type`.
|
||||
|
|
|
@ -106,44 +106,6 @@ class Message(TelegramObject):
|
|||
|
||||
left_chat_participant (:class:`telegram.User`): Use `left_chat_member`
|
||||
instead.
|
||||
|
||||
<<<<<<<<< Temporary merge branch 1
|
||||
=========
|
||||
Args:
|
||||
message_id (int):
|
||||
from_user (:class:`telegram.User`):
|
||||
date (:class:`datetime.datetime`):
|
||||
chat (:class:`telegram.Chat`):
|
||||
forward_from (Optional[:class:`telegram.User`]):
|
||||
forward_from_chat (Optional[:class:`telegram.Chat`]):
|
||||
forward_from_message_id (Optional[int]):
|
||||
forward_date (Optional[:class:`datetime.datetime`]):
|
||||
reply_to_message (Optional[:class:`telegram.Message`]):
|
||||
edit_date (Optional[:class:`datetime.datetime`]):
|
||||
text (Optional[str]):
|
||||
audio (Optional[:class:`telegram.Audio`]):
|
||||
document (Optional[:class:`telegram.Document`]):
|
||||
game (Optional[:class:`telegram.Game`]):
|
||||
photo (Optional[List[:class:`telegram.PhotoSize`]]):
|
||||
sticker (Optional[:class:`telegram.Sticker`]):
|
||||
video (Optional[:class:`telegram.Video`]):
|
||||
voice (Optional[:class:`telegram.Voice`]):
|
||||
video_note (Optional[:class:`telegram.VideoNote`]):
|
||||
caption (Optional[str]):
|
||||
contact (Optional[:class:`telegram.Contact`]):
|
||||
location (Optional[:class:`telegram.Location`]):
|
||||
new_chat_member (Optional[:class:`telegram.User`]):
|
||||
left_chat_member (Optional[:class:`telegram.User`]):
|
||||
new_chat_title (Optional[str]):
|
||||
new_chat_photo (Optional[List[:class:`telegram.PhotoSize`]):
|
||||
delete_chat_photo (Optional[bool]):
|
||||
group_chat_created (Optional[bool]):
|
||||
supergroup_chat_created (Optional[bool]):
|
||||
migrate_to_chat_id (Optional[int]):
|
||||
migrate_from_chat_id (Optional[int]):
|
||||
channel_chat_created (Optional[bool]):
|
||||
bot (Optional[Bot]): The Bot to use for instance methods
|
||||
>>>>>>>>> Temporary merge branch 2
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
|
|
|
@ -124,6 +124,12 @@ class FiltersTest(BaseTest, unittest.TestCase):
|
|||
self.message.successful_payment = None
|
||||
self.assertFalse(Filters.successful_payment(self.message))
|
||||
|
||||
def test_filters_invoice(self):
|
||||
self.message.invoice = 'test'
|
||||
self.assertTrue(Filters.invoice(self.message))
|
||||
self.message.invoice = None
|
||||
self.assertFalse(Filters.imvoice(self.message))
|
||||
|
||||
def test_filters_status_update(self):
|
||||
self.assertFalse(Filters.status_update(self.message))
|
||||
|
||||
|
|
Loading…
Reference in a new issue