X Tutup
Skip to content

Commit 1f9d316

Browse files
committed
Game: use explicit keyword args + added docmentation
1 parent 837e9d2 commit 1f9d316

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

telegram/game.py

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,40 @@
2424

2525

2626
class Game(TelegramObject):
27-
28-
def __init__(self, title, description, photo, **kwargs):
27+
"""This object represents a Telegram Game.
28+
29+
Attributes:
30+
title (str): Title of the game.
31+
description (str): Description of the game.
32+
photo (list[:class:`telegram.PhotoSize`]): List of photos that will be displayed in the
33+
game message in chats.
34+
35+
Keyword Args:
36+
text (Optional[str]): Brief description of the game or high scores included in the game
37+
message. Can be automatically edited to include current high scores for the game when
38+
the bot calls setGameScore, or manually edited using editMessageText.
39+
0-4096 characters.
40+
text_entities (Optional[list[:class:`telegram.MessageEntity`]]): Special entities that
41+
appear in text, such as usernames, URLs, bot commands, etc.
42+
animation (Optional[:class:`telegram.Animation`]): Animation that will be displayed in the
43+
game message in chats. Upload via BotFather.
44+
45+
"""
46+
47+
def __init__(self,
48+
title,
49+
description,
50+
photo,
51+
text=None,
52+
text_entities=None,
53+
animation=None,
54+
**kwargs):
2955
self.title = title
3056
self.description = description
3157
self.photo = photo
32-
self.text = kwargs.get('text')
33-
self.text_entities = kwargs.get('text_entities')
34-
self.animation = kwargs.get('animation')
58+
self.text = text
59+
self.text_entities = text_entities
60+
self.animation = animation
3561

3662
@staticmethod
3763
def de_json(data, bot):

0 commit comments

Comments
 (0)
X Tutup