Add base class. Make to_json available to all of the existing models.

This commit is contained in:
thecosmos
2019-05-22 23:52:17 +05:30
parent ca36e3ce03
commit d975547968
4 changed files with 24 additions and 13 deletions

View File

@@ -1,7 +1,9 @@
from .base import DiscordModelsBase
from .. import configs
class User(object):
class User(DiscordModelsBase):
"""Class representing Discord User.
Attributes
@@ -65,16 +67,6 @@ class User(object):
"""A boolean representing if avatar of user is animated. Meaning user has GIF avatar."""
return self.avatar_hash.startswith("a_")
def to_json(self):
"""A utility method which returns raw user object as it was returned from discord.
Returns
-------
dict
A dict of user's document.
"""
return self._payload
class Bot(User):
"""Class representing the client user itself.