remove senpais code

This commit is contained in:
grey-cat-1908 2022-06-03 15:57:22 +03:00
parent 1857a2eefd
commit 2d179ff11a
3 changed files with 26 additions and 31 deletions

View file

@ -621,37 +621,6 @@ class Guild(APIModelBase):
"""
await self._client.rest.remove_guild_ban(self.id, user_id, reason=reason)
async def add_role(
self,
*,
user_id: Union[Snowflake, str, int],
role_id: Union[Snowflake, str, int],
reason: Optional[str] = None
):
#TODO: Add description
await self._http.put(
f"/guilds/{self.id}/members/{user_id}/roles/{role_id}",
headers = {
"X-Audit-Log-Reason": reason
})
async def delete_role(
self,
*,
user_id: Union[Snowflake, str, int],
role_id: Union[Snowflake, str, int],
reason: Optional[str] = None
):
#TODO: add description :D
await self._http.delete(
f"/guilds/{self.id}/members/{user_id}/roles/{role_id}",
headers = {
"X-Audit-Log-Reason": reason
})
@dataclass(repr=False)
class UnavailableGuild(APIModelBase):

View file

@ -86,3 +86,13 @@ class Role(APIModelBase):
return None
else:
return self._client.cache.get_guild(self.guild_id)
def icon_url(self, *, size: int = 1024, image_format: str = None):
# ToDo: Add Docstrings
"""Icon Url (from the Discord CDN server)"""
if self.icon is None:
return None
else:
return self._client.rest.cdn.role_icon_url(
self.id, self.icon, size=size, image_format=image_format
)

View file

@ -720,3 +720,19 @@ class CDNBuilder:
image_format if image_format is not None else self.dif,
size,
)
def role_icon_url(
self,
role_id: str,
_hash: str,
*,
size: int = 1024,
image_format: str = None,
):
return "{}/role-icons/{}/{}.{}?size={}".format(
self.BASE_URL,
role_id,
_hash,
image_format if image_format is not None else self.dif,
size,
)