diff options
| author | Rapptz <[email protected]> | 2016-05-06 16:38:22 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-05-06 16:38:22 -0400 |
| commit | 3feba5d1bb06b22482e94132bd1f979fbeaf61b5 (patch) | |
| tree | 2843a4f32d4f95b76d10ccf14a3bbeb080df9d18 /discord/game.py | |
| parent | Add a TimeoutError if VoiceClient.connect fails. (diff) | |
| download | discord.py-3feba5d1bb06b22482e94132bd1f979fbeaf61b5.tar.xz discord.py-3feba5d1bb06b22482e94132bd1f979fbeaf61b5.zip | |
Add Game.type and Game.url attributes to change streaming status.
Diffstat (limited to 'discord/game.py')
| -rw-r--r-- | discord/game.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/discord/game.py b/discord/game.py index 0408d19b..49e5a4fb 100644 --- a/discord/game.py +++ b/discord/game.py @@ -45,16 +45,31 @@ class Game: ----------- name : str The game's name. + url : str + The game's URL. Usually used for twitch streaming. + type : int + The type of game being played. 1 indicates "Streaming". """ - __slots__ = ['name'] + __slots__ = ['name', 'type', 'url'] def __init__(self, **kwargs): self.name = kwargs.get('name') + self.url = kwargs.get('url') + self.type = kwargs.get('type') def __str__(self): return self.name + def _iterator(self): + for attr in self.__slots__: + value = getattr(self, attr, None) + if value is not None: + yield (attr, value) + + def __iter__(self): + return self._iterator() + def __eq__(self, other): return isinstance(other, Game) and other.name == self.name |