owocado
4 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
7 additions and
5 deletions
-
discord/client.py
-
discord/http.py
-
discord/invite.py
|
|
@ -2546,7 +2546,7 @@ class Client: |
|
|
|
) |
|
|
|
return Invite.from_incomplete(state=self._connection, data=data) |
|
|
|
|
|
|
|
async def delete_invite(self, invite: Union[Invite, str], /) -> None: |
|
|
|
async def delete_invite(self, invite: Union[Invite, str], /) -> Invite: |
|
|
|
"""|coro| |
|
|
|
|
|
|
|
Revokes an :class:`.Invite`, URL, or ID to an invite. |
|
|
@ -2574,7 +2574,8 @@ class Client: |
|
|
|
""" |
|
|
|
|
|
|
|
resolved = utils.resolve_invite(invite) |
|
|
|
await self.http.delete_invite(resolved.code) |
|
|
|
data = await self.http.delete_invite(resolved.code) |
|
|
|
return Invite.from_incomplete(state=self._connection, data=data) |
|
|
|
|
|
|
|
# Miscellaneous stuff |
|
|
|
|
|
|
|
|
|
@ -1874,7 +1874,7 @@ class HTTPClient: |
|
|
|
def invites_from_channel(self, channel_id: Snowflake) -> Response[List[invite.Invite]]: |
|
|
|
return self.request(Route('GET', '/channels/{channel_id}/invites', channel_id=channel_id)) |
|
|
|
|
|
|
|
def delete_invite(self, invite_id: str, *, reason: Optional[str] = None) -> Response[None]: |
|
|
|
def delete_invite(self, invite_id: str, *, reason: Optional[str] = None) -> Response[invite.Invite]: |
|
|
|
return self.request(Route('DELETE', '/invites/{invite_id}', invite_id=invite_id), reason=reason) |
|
|
|
|
|
|
|
# Role management |
|
|
|
|
|
@ -546,7 +546,7 @@ class Invite(Hashable): |
|
|
|
|
|
|
|
return self |
|
|
|
|
|
|
|
async def delete(self, *, reason: Optional[str] = None) -> None: |
|
|
|
async def delete(self, *, reason: Optional[str] = None) -> Self: |
|
|
|
"""|coro| |
|
|
|
|
|
|
|
Revokes the instant invite. |
|
|
@ -568,4 +568,5 @@ class Invite(Hashable): |
|
|
|
Revoking the invite failed. |
|
|
|
""" |
|
|
|
|
|
|
|
await self._state.http.delete_invite(self.code, reason=reason) |
|
|
|
data = await self._state.http.delete_invite(self.code, reason=reason) |
|
|
|
return self.from_incomplete(state=self._state, data=data) |
|
|
|