pub struct InviteManager<'a, B: Backend> { /* private fields */ }Expand description
Invites, by code (D-239). Returned by Context::invites.
The cache does not keep invites, so every method asks Discord and returns the
djs-model types. Lists are keyed by the invite code.
discord.js counterpart: GuildInviteManager (guild.invites) and Client#fetchInvite.
Implementations§
Source§impl<'a, B: Backend> InviteManager<'a, B>
impl<'a, B: Backend> InviteManager<'a, B>
Sourcepub fn fetch<'r>(
self,
code: &'r str,
query: &'r GetInvite,
) -> Fetch<Invite, impl Future<Output = Result<Invite, Error>> + Send + 'r>where
'a: 'r,
pub fn fetch<'r>(
self,
code: &'r str,
query: &'r GetInvite,
) -> Fetch<Invite, impl Future<Output = Result<Invite, Error>> + Send + 'r>where
'a: 'r,
An invite by its code, to any guild (Get Invite).
discord.js counterpart: Client#fetchInvite.
§Errors
Returns the REST error if the request failed (Discord answers 404 for an unknown or expired invite).
Sourcepub async fn delete(
self,
code: &str,
reason: Option<&str>,
) -> Result<Invite, Error>
pub async fn delete( self, code: &str, reason: Option<&str>, ) -> Result<Invite, Error>
Deletes an invite (Delete Invite), returning it.
discord.js counterpart: GuildInviteManager#delete / Invite#delete.
§Errors
Returns the REST error if the request failed (it needs MANAGE_CHANNELS on the
channel or MANAGE_GUILD).
Sourcepub async fn create(
self,
channel_id: ChannelId,
body: &CreateChannelInvite,
reason: Option<&str>,
) -> Result<InviteWithMetadata, Error>
pub async fn create( self, channel_id: ChannelId, body: &CreateChannelInvite, reason: Option<&str>, ) -> Result<InviteWithMetadata, Error>
Creates an invite to a channel (Create Channel Invite).
discord.js counterpart: GuildInviteManager#create / TextChannel#createInvite.
§Errors
Returns the REST error if the request failed (it needs CREATE_INSTANT_INVITE).
Sourcepub async fn list_channel(
self,
channel_id: ChannelId,
) -> Result<Collection<String, InviteWithMetadata>, Error>
pub async fn list_channel( self, channel_id: ChannelId, ) -> Result<Collection<String, InviteWithMetadata>, Error>
The invites to a channel (Get Channel Invites).
discord.js counterpart: TextChannel#fetchInvites.
§Errors
Returns the REST error if the request failed (it needs MANAGE_CHANNELS).
Sourcepub async fn list_guild(
self,
guild_id: GuildId,
) -> Result<Collection<String, InviteWithMetadata>, Error>
pub async fn list_guild( self, guild_id: GuildId, ) -> Result<Collection<String, InviteWithMetadata>, Error>
The invites to a guild (Get Guild Invites).
discord.js counterpart: GuildInviteManager#fetch().
§Errors
Returns the REST error if the request failed (it needs MANAGE_GUILD or
VIEW_AUDIT_LOG).
Trait Implementations§
Source§impl<B: Backend> Clone for InviteManager<'_, B>
impl<B: Backend> Clone for InviteManager<'_, B>
impl<B: Backend> Copy for InviteManager<'_, B>
Auto Trait Implementations§
impl<'a, B> !RefUnwindSafe for InviteManager<'a, B>
impl<'a, B> !UnwindSafe for InviteManager<'a, B>
impl<'a, B> Freeze for InviteManager<'a, B>
impl<'a, B> Send for InviteManager<'a, B>
impl<'a, B> Sync for InviteManager<'a, B>
impl<'a, B> Unpin for InviteManager<'a, B>
impl<'a, B> UnsafeUnpin for InviteManager<'a, B>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more