def test_equality(self):
        a = telegram.Sticker(self.sticker.file_id, self.sticker.width, self.sticker.height)
        b = telegram.Sticker(self.sticker.file_id, self.sticker.width, self.sticker.height)
        c = telegram.Sticker(self.sticker.file_id, 0, 0)
        d = telegram.Sticker("", self.sticker.width, self.sticker.height)
        e = telegram.PhotoSize(self.sticker.file_id, self.sticker.width, self.sticker.height)

        self.assertEqual(a, b)
        self.assertEqual(hash(a), hash(b))
        self.assertIsNot(a, b)

        self.assertEqual(a, c)
        self.assertEqual(hash(a), hash(c))

        self.assertNotEqual(a, d)
        self.assertNotEqual(hash(a), hash(d))

        self.assertNotEqual(a, e)
        self.assertNotEqual(hash(a), hash(e))
    def setUp(self):
        self.name = 'test_by_{0}'.format(self._bot.username)
        self.title = 'Test stickers'
        self.contains_masks = False
        self.stickers = [telegram.Sticker('file_id', 512, 512)]

        self.json_dict = {
            'name': self.name,
            'title': self.title,
            'contains_masks': self.contains_masks,
            'stickers': [x.to_dict() for x in self.stickers]
        }
def get_sticker(file_id):
    return telegram.Sticker(file_id=file_id, width='512', height='512')
Beispiel #4
0
def add_group(update, context):
    for member in update.message.new_chat_members:
        hello = telegram.Sticker('CAADAgADlwADkAABUCD95Ya3mn-HtgI', 512, 512, thumb=None)
        update.message.reply_sticker(hello)
Beispiel #5
0
SAMPLE_TEXT_MESSAGE = telegram.Message(message_id=1,
                                       from_user=SAMPLE_USER,
                                       date=SAMPLE_DATE,
                                       chat=SAMPLE_CHAT,
                                       text=SAMPLE_TEXT)

SAMPLE_TEXT_UPDATE = telegram.Update(update_id=1, message=SAMPLE_TEXT_MESSAGE)

# STICKER

SAMPLE_STICKER_PHOTOSIZE = telegram.PhotoSize(file_id='photosize_id',
                                              width=10,
                                              height=10,
                                              file_size=100)

SAMPLE_STICKER = telegram.Sticker(file_id='sticker_id',
                                  width=100,
                                  height=100,
                                  thumb=SAMPLE_STICKER_PHOTOSIZE,
                                  file_size=10000)

SAMPLE_STICKER_MESSAGE = telegram.Message(message_id=1,
                                          from_user=SAMPLE_USER,
                                          date=SAMPLE_DATE,
                                          chat=SAMPLE_CHAT,
                                          sticker=SAMPLE_STICKER)

SAMPLE_STICKER_UPDATE = telegram.Update(update_id=2,
                                        message=SAMPLE_STICKER_MESSAGE)