pub struct SoundboardSoundManager<'a, B: Backend> { /* private fields */ }Expand description
The soundboard sounds of one guild. Returned by Context::soundboard_sounds; Discord’s
default sounds are listed by Context::default_soundboard_sounds (D-243).
discord.js counterpart: GuildSoundboardSoundManager (guild.soundboardSounds).
Implementations§
Source§impl<'a, B: Backend> SoundboardSoundManager<'a, B>
impl<'a, B: Backend> SoundboardSoundManager<'a, B>
Sourcepub const fn guild_id(self) -> GuildId
pub const fn guild_id(self) -> GuildId
The guild these sounds belong to.
discord.js counterpart: GuildSoundboardSoundManager#guild.
Sourcepub fn cache(
self,
) -> Option<GuildView<'a, SoundboardSoundId, SoundboardSound, B>>
pub fn cache( self, ) -> Option<GuildView<'a, SoundboardSoundId, SoundboardSound, B>>
The cached sounds of the guild, if the client has a cache.
discord.js counterpart: GuildSoundboardSoundManager#cache.
Sourcepub fn fetch(
self,
sound_id: SoundboardSoundId,
) -> Fetch<Arc<SoundboardSound>, impl Future<Output = Result<Arc<SoundboardSound>, Error>> + Send + 'a>
pub fn fetch( self, sound_id: SoundboardSoundId, ) -> Fetch<Arc<SoundboardSound>, impl Future<Output = Result<Arc<SoundboardSound>, Error>> + Send + 'a>
A sound: the cached one, or Get Guild Soundboard Sound, whose result is cached.
discord.js counterpart: GuildSoundboardSoundManager#fetch(id).
§Errors
Returns the REST error if Discord was asked and the request failed.
Sourcepub async fn list(
self,
) -> Result<Collection<SoundboardSoundId, Arc<SoundboardSound>>, Error>
pub async fn list( self, ) -> Result<Collection<SoundboardSoundId, Arc<SoundboardSound>>, Error>
Every soundboard sound of the guild (List Guild Soundboard Sounds); the sounds are cached.
discord.js counterpart: GuildSoundboardSoundManager#fetch().
§Errors
Returns the REST error if the request failed.
Sourcepub async fn create(
self,
body: &CreateGuildSoundboardSound,
reason: Option<&str>,
) -> Result<Arc<SoundboardSound>, Error>
pub async fn create( self, body: &CreateGuildSoundboardSound, reason: Option<&str>, ) -> Result<Arc<SoundboardSound>, Error>
Uploads a sound (Create Guild Soundboard Sound); it is cached.
discord.js counterpart: GuildSoundboardSoundManager#create.
§Errors
Returns the REST error if the request failed (it needs CREATE_EXPRESSIONS; the
sound must be an MP3 or OGG of at most 512 KiB and 5.2 seconds).
Sourcepub async fn edit(
self,
sound_id: SoundboardSoundId,
body: &ModifyGuildSoundboardSound,
reason: Option<&str>,
) -> Result<Arc<SoundboardSound>, Error>
pub async fn edit( self, sound_id: SoundboardSoundId, body: &ModifyGuildSoundboardSound, reason: Option<&str>, ) -> Result<Arc<SoundboardSound>, Error>
Changes a sound’s name, volume or emoji (Modify Guild Soundboard Sound); the result is cached.
discord.js counterpart: GuildSoundboardSoundManager#edit / SoundboardSound#edit.
§Errors
Returns the REST error if the request failed.
Sourcepub async fn delete(
self,
sound_id: SoundboardSoundId,
reason: Option<&str>,
) -> Result<(), Error>
pub async fn delete( self, sound_id: SoundboardSoundId, reason: Option<&str>, ) -> Result<(), Error>
Deletes a sound (Delete Guild Soundboard
Sound). The
cache is updated by the GUILD_SOUNDBOARD_SOUND_DELETE event that follows (D-236).
discord.js counterpart: GuildSoundboardSoundManager#delete / SoundboardSound#delete.
§Errors
Returns the REST error if the request failed.
Trait Implementations§
Source§impl<B: Backend> Clone for SoundboardSoundManager<'_, B>
impl<B: Backend> Clone for SoundboardSoundManager<'_, B>
impl<B: Backend> Copy for SoundboardSoundManager<'_, B>
Auto Trait Implementations§
impl<'a, B> !RefUnwindSafe for SoundboardSoundManager<'a, B>
impl<'a, B> !UnwindSafe for SoundboardSoundManager<'a, B>
impl<'a, B> Freeze for SoundboardSoundManager<'a, B>
impl<'a, B> Send for SoundboardSoundManager<'a, B>
impl<'a, B> Sync for SoundboardSoundManager<'a, B>
impl<'a, B> Unpin for SoundboardSoundManager<'a, B>
impl<'a, B> UnsafeUnpin for SoundboardSoundManager<'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