Skip to main content

GuildExt

Trait GuildExt 

Source
pub trait GuildExt: Guild {
Show 17 methods // Provided methods fn members<'a, B: Backend>( &self, ctx: &'a Context<B>, ) -> MemberManager<'a, B> { ... } fn roles<'a, B: Backend>(&self, ctx: &'a Context<B>) -> RoleManager<'a, B> { ... } fn bans<'a, B: Backend>(&self, ctx: &'a Context<B>) -> BanManager<'a, B> { ... } fn channels<'a, B: Backend>( &self, ctx: &'a Context<B>, ) -> GuildChannelManager<'a, B> { ... } fn edit<B: Backend>( &self, ctx: &Context<B>, body: &ModifyGuild, reason: Option<&str>, ) -> impl Future<Output = Result<Arc<CachedGuild>, Error>> + Send { ... } fn leave<B: Backend>( &self, ctx: &Context<B>, ) -> impl Future<Output = Result<(), Error>> + Send { ... } fn emojis<'a, B: Backend>(&self, ctx: &'a Context<B>) -> EmojiManager<'a, B> { ... } fn stickers<'a, B: Backend>( &self, ctx: &'a Context<B>, ) -> StickerManager<'a, B> { ... } fn webhooks<B: Backend>( &self, ctx: &Context<B>, ) -> impl Future<Output = Result<Collection<WebhookId, Webhook>, Error>> + Send { ... } fn invites<B: Backend>( &self, ctx: &Context<B>, ) -> impl Future<Output = Result<Collection<String, InviteWithMetadata>, Error>> + Send { ... } fn scheduled_events<'a, B: Backend>( &self, ctx: &'a Context<B>, ) -> ScheduledEventManager<'a, B> { ... } fn stage_instances<'a, B: Backend>( &self, ctx: &'a Context<B>, ) -> StageInstanceManager<'a, B> { ... } fn soundboard_sounds<'a, B: Backend>( &self, ctx: &'a Context<B>, ) -> SoundboardSoundManager<'a, B> { ... } fn commands<'a, B: Backend>( &self, ctx: &'a Context<B>, ) -> GuildCommandManager<'a, B> { ... } fn auto_moderation_rules<'a, B: Backend>( &self, ctx: &'a Context<B>, ) -> AutoModerationRuleManager<'a, B> { ... } fn audit_log<B: Backend>( &self, ctx: &Context<B>, query: &GetGuildAuditLog, ) -> impl Future<Output = Result<AuditLog, Error>> + Send { ... } fn integrations<B: Backend>( &self, ctx: &Context<B>, ) -> impl Future<Output = Result<Collection<IntegrationId, Integration>, Error>> + Send { ... }
}
Expand description

Actions on a guild: Guild or CachedGuild.

This trait is sealed.

discord.js counterpart: the methods and managers of Guild.

§Examples

let owner = guild.members(&ctx).fetch(guild.owner_id).await?;
println!("{} owns {}", owner.user.username, guild.name);

Provided Methods§

Source

fn members<'a, B: Backend>(&self, ctx: &'a Context<B>) -> MemberManager<'a, B>

The manager of this guild’s members.

discord.js counterpart: Guild#members.

Source

fn roles<'a, B: Backend>(&self, ctx: &'a Context<B>) -> RoleManager<'a, B>

The manager of this guild’s roles.

discord.js counterpart: Guild#roles.

Source

fn bans<'a, B: Backend>(&self, ctx: &'a Context<B>) -> BanManager<'a, B>

The manager of this guild’s bans.

discord.js counterpart: Guild#bans.

Source

fn channels<'a, B: Backend>( &self, ctx: &'a Context<B>, ) -> GuildChannelManager<'a, B>

The manager of this guild’s channels as a whole: create, list, positions (D-234).

discord.js counterpart: Guild#channels.

Source

fn edit<B: Backend>( &self, ctx: &Context<B>, body: &ModifyGuild, reason: Option<&str>, ) -> impl Future<Output = Result<Arc<CachedGuild>, Error>> + Send

Edits this guild’s settings (GuildManager::edit).

discord.js counterpart: Guild#edit.

§Errors

Returns the REST error if the request failed.

Source

fn leave<B: Backend>( &self, ctx: &Context<B>, ) -> impl Future<Output = Result<(), Error>> + Send

Makes the bot leave this guild (GuildManager::leave).

discord.js counterpart: Guild#leave.

§Errors

Returns the REST error if the request failed (the owner cannot leave its guild).

Source

fn emojis<'a, B: Backend>(&self, ctx: &'a Context<B>) -> EmojiManager<'a, B>

The manager of this guild’s custom emojis.

discord.js counterpart: Guild#emojis.

Source

fn stickers<'a, B: Backend>(&self, ctx: &'a Context<B>) -> StickerManager<'a, B>

The manager of this guild’s stickers.

discord.js counterpart: Guild#stickers.

Source

fn webhooks<B: Backend>( &self, ctx: &Context<B>, ) -> impl Future<Output = Result<Collection<WebhookId, Webhook>, Error>> + Send

The webhooks of this guild (WebhookManager::list_guild).

discord.js counterpart: Guild#fetchWebhooks.

§Errors

Returns the REST error if the request failed.

Source

fn invites<B: Backend>( &self, ctx: &Context<B>, ) -> impl Future<Output = Result<Collection<String, InviteWithMetadata>, Error>> + Send

The invites to this guild (InviteManager::list_guild).

discord.js counterpart: GuildInviteManager#fetch().

§Errors

Returns the REST error if the request failed.

Source

fn scheduled_events<'a, B: Backend>( &self, ctx: &'a Context<B>, ) -> ScheduledEventManager<'a, B>

The manager of this guild’s scheduled events.

discord.js counterpart: Guild#scheduledEvents.

Source

fn stage_instances<'a, B: Backend>( &self, ctx: &'a Context<B>, ) -> StageInstanceManager<'a, B>

The manager of this guild’s live stages.

discord.js counterpart: Guild#stageInstances.

Source

fn soundboard_sounds<'a, B: Backend>( &self, ctx: &'a Context<B>, ) -> SoundboardSoundManager<'a, B>

The manager of this guild’s soundboard sounds.

discord.js counterpart: Guild#soundboardSounds.

Source

fn commands<'a, B: Backend>( &self, ctx: &'a Context<B>, ) -> GuildCommandManager<'a, B>

The manager of the bot’s application commands in this guild (D-244).

discord.js counterpart: Guild#commands.

§Panics

Panics before the first READY (D-247), like Context::commands.

Source

fn auto_moderation_rules<'a, B: Backend>( &self, ctx: &'a Context<B>, ) -> AutoModerationRuleManager<'a, B>

The manager of this guild’s auto moderation rules.

discord.js counterpart: Guild#autoModerationRules.

Source

fn audit_log<B: Backend>( &self, ctx: &Context<B>, query: &GetGuildAuditLog, ) -> impl Future<Output = Result<AuditLog, Error>> + Send

A page of this guild’s audit log (GuildManager::audit_log).

discord.js counterpart: Guild#fetchAuditLogs.

§Errors

Returns the REST error if the request failed.

Source

fn integrations<B: Backend>( &self, ctx: &Context<B>, ) -> impl Future<Output = Result<Collection<IntegrationId, Integration>, Error>> + Send

This guild’s integrations (GuildManager::integrations).

discord.js counterpart: Guild#fetchIntegrations.

§Errors

Returns the REST error if the request failed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl GuildExt for CachedGuild

Source§

impl GuildExt for Guild

Implementors§