mirror of
https://github.com/yawaflua/Flask-Discord.git
synced 2025-12-10 12:29:30 +02:00
Documentation
This commit is contained in:
@@ -2,10 +2,26 @@ from .. import configs
|
||||
|
||||
|
||||
class Guild(object):
|
||||
"""Class representing discord Guild the user is part of.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
id : int
|
||||
Discord ID of the guild.
|
||||
name : str
|
||||
Name of the guild.
|
||||
icon_hash : str
|
||||
Hash of guild's icon.
|
||||
is_owner : bool
|
||||
Boolean determining if current user is owner of the guild or not.
|
||||
permissions_value : int
|
||||
An integer representing permissions of current user in the guild.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, payload):
|
||||
self._payload = payload
|
||||
self.id = self._payload["id"]
|
||||
self.id = int(self._payload["id"])
|
||||
self.name = self._payload["name"]
|
||||
self.icon_hash = self._payload.get("icon")
|
||||
self.is_owner = self._payload.get("owner")
|
||||
@@ -16,4 +32,5 @@ class Guild(object):
|
||||
|
||||
@property
|
||||
def icon_url(self):
|
||||
"""A property returning direct URL to the guild's icon."""
|
||||
return configs.GUILD_ICON_BASE_URL.format(guild_id=self.id, icon_hash=self.icon_hash)
|
||||
|
||||
Reference in New Issue
Block a user