Add game data class, replace game_id.

This commit is contained in:
Khazhismel
2015-12-23 17:38:59 -05:00
parent ec23434162
commit 0aa46e6def
6 changed files with 90 additions and 21 deletions

View File

@@ -27,6 +27,7 @@ DEALINGS IN THE SOFTWARE.
from . import utils
from .role import Role
from .member import Member
from .game import Game
from .channel import Channel
from .enums import ServerRegion, Status
from .mixins import Hashable
@@ -143,7 +144,8 @@ class Server(Hashable):
member.status = Status(member.status)
except:
pass
member.game_id = presence['game_id']
game = presence.get('game')
member.game = game and Game(**game)
if 'channels' in guild:
channels = guild['channels']
@@ -171,4 +173,3 @@ class Server(Hashable):
if self.icon is None:
return ''
return 'https://cdn.discordapp.com/icons/{0.id}/{0.icon}.jpg'.format(self)