pub struct CreateSoundboard<'a> { /* private fields */ }Expand description
A builder to create a soundboard sound.
Implementations§
Source§impl<'a> CreateSoundboard<'a>
impl<'a> CreateSoundboard<'a>
Sourcepub fn new(name: impl Into<String>, sound: &CreateAttachment) -> Self
pub fn new(name: impl Into<String>, sound: &CreateAttachment) -> Self
Creates a new builder with the given data.
Sourcepub fn name(self, name: impl Into<String>) -> Self
pub fn name(self, name: impl Into<String>) -> Self
Set the name of the soundboard sound, replacing the current value as set in Self::new.
Note: Must be between 2 and 32 characters long.
Sourcepub fn sound(self, sound: &CreateAttachment) -> Self
pub fn sound(self, sound: &CreateAttachment) -> Self
Set the sound file. Replaces the current value as set in Self::new.
Note: Must be audio that is encoded in MP3 or OGG, max 512 KB, max duration 5.2 seconds.
Sourcepub fn volume(self, volume: f64) -> Self
pub fn volume(self, volume: f64) -> Self
Set the volume of the soundboard sound.
Note: Must be between 0 to 1.
Sourcepub fn emoji_name(self, name: String) -> Self
pub fn emoji_name(self, name: String) -> Self
Set the Unicode character of the custom emoji.
Sourcepub fn audit_log_reason(self, reason: &'a str) -> Self
pub fn audit_log_reason(self, reason: &'a str) -> Self
Sets the request’s audit log reason.
Trait Implementations§
Source§impl Builder for CreateSoundboard<'_>
impl Builder for CreateSoundboard<'_>
Source§fn execute<'life0, 'async_trait>(
self,
cache_http: impl 'async_trait + CacheHttp,
ctx: Self::Context<'life0>,
) -> Pin<Box<dyn Future<Output = Result<Self::Built>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
self,
cache_http: impl 'async_trait + CacheHttp,
ctx: Self::Context<'life0>,
) -> Pin<Box<dyn Future<Output = Result<Self::Built>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Creates a new soundboard in the guild with the data set.
Note: Requires the Create Guild Expressions permission.
§Errors
If the cache is enabled, returns a ModelError::InvalidPermissions if the current user
lacks permission. Otherwise returns Error::Http, as well as if invalid data is given.
Source§type Context<'ctx> = GuildId
type Context<'ctx> = GuildId
type Built = Soundboard
Source§impl<'a> Clone for CreateSoundboard<'a>
impl<'a> Clone for CreateSoundboard<'a>
Source§fn clone(&self) -> CreateSoundboard<'a>
fn clone(&self) -> CreateSoundboard<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more