File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -117,3 +117,19 @@ def __init__(self, **kwargs):
117117 self .owner = User (** self .owner ) if self ._json .get ("owner" ) else None
118118 self .team = Team (** self .team ) if self ._json .get ("team" ) else None
119119 self .flags = AppFlags (self .flags ) if self ._json .get ("flags" ) else None
120+
121+ @property
122+ def icon_url (self ) -> str :
123+ """
124+ Returns the URL of the application's icon
125+
126+ :return: URL of the application's icon.
127+ :rtype: str
128+ """
129+ url = "https://cdn.discordapp.com/"
130+ if self .icon :
131+ url += f"avatars/{ int (self .id )} /{ self .icon } "
132+ url += ".gif" if self .icon .startswith ("a_" ) else ".png"
133+ else :
134+ url += f"embed/avatars/{ int (self .discriminator ) % 5 } .png"
135+ return url
Original file line number Diff line number Diff line change @@ -44,3 +44,5 @@ class Application(DictSerializerMixin):
4444 type : Optional [Any ]
4545 hook : Optional [Any ]
4646 def __init__ (self , ** kwargs ): ...
47+ @property
48+ def icon_url (self ) -> str : ...
You can’t perform that action at this time.
0 commit comments