Switch IDs to use int instead of str

This commit is contained in:
Rapptz
2016-10-10 20:09:06 -04:00
parent aa8a328f0a
commit 45c729b167
10 changed files with 114 additions and 109 deletions

View File

@ -54,17 +54,17 @@ class Emoji(Hashable):
Attributes
-----------
name : str
name: str
The name of the emoji.
id : str
id: int
The emoji's ID.
require_colons : bool
require_colons: bool
If colons are required to use this emoji in the client (:PJSalt: vs PJSalt).
managed : bool
managed: bool
If this emoji is managed by a Twitch integration.
server : :class:`Server`
server: :class:`Server`
The server the emoji belongs to.
roles : List[:class:`Role`]
roles: List[:class:`Role`]
A list of :class:`Role` that is allowed to use this emoji. If roles is empty,
the emoji is unrestricted.
"""
@ -76,10 +76,10 @@ class Emoji(Hashable):
self._from_data(data)
def _from_data(self, emoji):
self.require_colons = emoji.get('require_colons')
self.managed = emoji.get('managed')
self.id = emoji.get('id')
self.name = emoji.get('name')
self.require_colons = emoji['require_colons']
self.managed = emoji['managed']
self.id = int(emoji['id'])
self.name = emoji['name']
self.roles = emoji.get('roles', [])
if self.roles:
roles = set(self.roles)