Skip to content

Commit b51ffbb

Browse files
clsungokue
authored andcommitted
Implement stickerResourceType property (#229)
* Implement stickerResourceType property implment #228 * add sticker_resource_type to README * remove unnessarary assertion
1 parent 361f7d4 commit b51ffbb

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,7 @@ Message
10611061
- id
10621062
- package\_id
10631063
- sticker\_id
1064+
- sticker\_resource\_type
10641065
- FileMessage
10651066
- type
10661067
- id

linebot/models/messages.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,19 +176,22 @@ class StickerMessage(Message):
176176
For a list of basic LINE stickers and sticker IDs, see sticker list.
177177
"""
178178

179-
def __init__(self, id=None, package_id=None, sticker_id=None, **kwargs):
179+
def __init__(self, id=None, package_id=None, sticker_id=None,
180+
sticker_resource_type=None, **kwargs):
180181
"""__init__ method.
181182
182183
:param str id: Message ID
183184
:param str package_id: Package ID
184185
:param str sticker_id: Sticker ID
186+
:param str sticker_resource_type: Sticker resource type
185187
:param kwargs:
186188
"""
187189
super(StickerMessage, self).__init__(id=id, **kwargs)
188190

189191
self.type = 'sticker'
190192
self.package_id = package_id
191193
self.sticker_id = sticker_id
194+
self.sticker_resource_type = sticker_resource_type
192195

193196

194197
class FileMessage(Message):

tests/test_webhook.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def test_parse(self):
156156
self.assertEqual(events[5].message.type, 'sticker')
157157
self.assertEqual(events[5].message.package_id, '1')
158158
self.assertEqual(events[5].message.sticker_id, '1')
159+
self.assertEqual(events[5].message.sticker_resource_type, 'STATIC')
159160

160161
# FollowEvent, SourceUser
161162
self.assertIsInstance(events[6], FollowEvent)

tests/text/webhook.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@
9999
"id": "325708",
100100
"type": "sticker",
101101
"packageId": "1",
102-
"stickerId": "1"
102+
"stickerId": "1",
103+
"stickerResourceType": "STATIC"
103104
}
104105
},
105106
{

0 commit comments

Comments
 (0)