pub struct GuildCommandManager<'a, B: Backend> { /* private fields */ }Expand description
The bot’s application commands in one guild, and the command permissions there.
Returned by Context::guild_commands.
Guild commands update at once (global ones may take a while), which makes them the usual choice while developing.
discord.js counterpart: GuildApplicationCommandManager (guild.commands).
Implementations§
Source§impl<'a, B: Backend> GuildCommandManager<'a, B>
impl<'a, B: Backend> GuildCommandManager<'a, B>
Sourcepub const fn guild_id(self) -> GuildId
pub const fn guild_id(self) -> GuildId
The guild these commands belong to.
discord.js counterpart: GuildApplicationCommandManager#guild.
Sourcepub fn fetch(
self,
command_id: CommandId,
) -> Fetch<ApplicationCommand, impl Future<Output = Result<ApplicationCommand, Error>> + Send + 'a>
pub fn fetch( self, command_id: CommandId, ) -> Fetch<ApplicationCommand, impl Future<Output = Result<ApplicationCommand, Error>> + Send + 'a>
A guild command (Get Guild Application Command).
discord.js counterpart: GuildApplicationCommandManager#fetch(id).
§Errors
Returns the REST error if the request failed.
Sourcepub async fn list(
self,
query: &GetApplicationCommands,
) -> Result<Collection<CommandId, ApplicationCommand>, Error>
pub async fn list( self, query: &GetApplicationCommands, ) -> Result<Collection<CommandId, ApplicationCommand>, Error>
Every command of the guild (Get Guild Application Commands).
discord.js counterpart: GuildApplicationCommandManager#fetch().
§Errors
Returns the REST error if the request failed.
Sourcepub async fn create(
self,
body: &CreateApplicationCommand,
) -> Result<ApplicationCommand, Error>
pub async fn create( self, body: &CreateApplicationCommand, ) -> Result<ApplicationCommand, Error>
Creates a guild command, or replaces the one with the same name and type (Create Guild Application Command).
discord.js counterpart: GuildApplicationCommandManager#create.
§Errors
Returns the REST error if the request failed.
Sourcepub async fn edit(
self,
command_id: CommandId,
body: &EditApplicationCommand,
) -> Result<ApplicationCommand, Error>
pub async fn edit( self, command_id: CommandId, body: &EditApplicationCommand, ) -> Result<ApplicationCommand, Error>
Edits a guild command (Edit Guild Application Command).
discord.js counterpart: GuildApplicationCommandManager#edit.
§Errors
Returns the REST error if the request failed.
Sourcepub async fn delete(self, command_id: CommandId) -> Result<(), Error>
pub async fn delete(self, command_id: CommandId) -> Result<(), Error>
Deletes a guild command (Delete Guild Application Command).
discord.js counterpart: GuildApplicationCommandManager#delete.
§Errors
Returns the REST error if the request failed.
Sourcepub async fn set(
self,
commands: &[CreateApplicationCommand],
) -> Result<Collection<CommandId, ApplicationCommand>, Error>
pub async fn set( self, commands: &[CreateApplicationCommand], ) -> Result<Collection<CommandId, ApplicationCommand>, Error>
Replaces every command of the guild with commands (Bulk Overwrite Guild
Application Commands).
discord.js counterpart: GuildApplicationCommandManager#set.
§Errors
Returns the REST error if the request failed.
Sourcepub async fn permissions(
self,
) -> Result<Collection<GenericId, GuildCommandPermissions>, Error>
pub async fn permissions( self, ) -> Result<Collection<GenericId, GuildCommandPermissions>, Error>
The command permissions set in the guild, by command (the application’s ID for the
permissions of every command) (Get Guild Application Command
Permissions). Editing them
needs a user’s OAuth2 token, so it is left to
Rest::edit_application_command_permissions.
discord.js counterpart: ApplicationCommandPermissionsManager#fetch({ guild }).
§Errors
Returns the REST error if the request failed.
Sourcepub async fn command_permissions(
self,
command_id: CommandId,
) -> Result<GuildCommandPermissions, Error>
pub async fn command_permissions( self, command_id: CommandId, ) -> Result<GuildCommandPermissions, Error>
The permissions of one command in the guild (Get Application Command Permissions), global or guild.
discord.js counterpart: ApplicationCommandPermissionsManager#fetch({ guild, command }).
§Errors
Returns the REST error if the request failed (404 when none are set).
Trait Implementations§
Source§impl<B: Backend> Clone for GuildCommandManager<'_, B>
impl<B: Backend> Clone for GuildCommandManager<'_, B>
impl<B: Backend> Copy for GuildCommandManager<'_, B>
Auto Trait Implementations§
impl<'a, B> !RefUnwindSafe for GuildCommandManager<'a, B>
impl<'a, B> !UnwindSafe for GuildCommandManager<'a, B>
impl<'a, B> Freeze for GuildCommandManager<'a, B>
impl<'a, B> Send for GuildCommandManager<'a, B>
impl<'a, B> Sync for GuildCommandManager<'a, B>
impl<'a, B> Unpin for GuildCommandManager<'a, B>
impl<'a, B> UnsafeUnpin for GuildCommandManager<'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