pub struct CreateGuildScheduledEvent<'a> { /* private fields */ }
Expand description
Create a scheduled event in a guild.
Once a guild is selected, you must choose one of three event types to create. The request builders will ensure you provide the correct data to Discord. See [Discord Docs/Create Guild Schedule Event].
The name must be between 1 and 100 characters in length. For external events, the location must be between 1 and 100 characters in length.
Examples
Create an event in a stage instance:
use twilight_model::{id::Id, util::Timestamp};
let guild_id = Id::new(1);
let channel_id = Id::new(2);
let garfield_start_time = Timestamp::parse("2022-01-01T14:00:00+00:00")?;
client
.create_guild_scheduled_event(guild_id)
.stage_instance(
channel_id,
"Garfield Appreciation Hour",
&garfield_start_time,
)?
.description("Discuss: How important is Garfield to You?")?
.exec()
.await?;
Create an external event:
use twilight_model::{id::Id, util::Timestamp};
let guild_id = Id::new(1);
let garfield_con_start_time = Timestamp::parse("2022-01-04T08:00:00+00:00")?;
let garfield_con_end_time = Timestamp::parse("2022-01-06T17:00:00+00:00")?;
client
.create_guild_scheduled_event(guild_id)
.external(
"Garfield Con 2022",
"Baltimore Convention Center",
&garfield_con_start_time,
&garfield_con_end_time,
)?
.description(
"In a spiritual successor to BronyCon, Garfield fans from \
around the globe celebrate all things related to the loveable cat.",
)?
.exec()
.await?;
Implementations
sourceimpl<'a> CreateGuildScheduledEvent<'a>
impl<'a> CreateGuildScheduledEvent<'a>
sourcepub fn external(
self,
name: &'a str,
location: &'a str,
scheduled_start_time: &'a Timestamp,
scheduled_end_time: &'a Timestamp
) -> Result<CreateGuildExternalScheduledEvent<'a>, ValidationError>
pub fn external(
self,
name: &'a str,
location: &'a str,
scheduled_start_time: &'a Timestamp,
scheduled_end_time: &'a Timestamp
) -> Result<CreateGuildExternalScheduledEvent<'a>, ValidationError>
Create an external scheduled event in a guild.
The name must be between 1 and 100 characters in length.
Errors
Returns an error of type ScheduledEventName
if the name is invalid.
sourcepub fn stage_instance(
self,
channel_id: Id<ChannelMarker>,
name: &'a str,
scheduled_start_time: &'a Timestamp
) -> Result<CreateGuildStageInstanceScheduledEvent<'a>, ValidationError>
pub fn stage_instance(
self,
channel_id: Id<ChannelMarker>,
name: &'a str,
scheduled_start_time: &'a Timestamp
) -> Result<CreateGuildStageInstanceScheduledEvent<'a>, ValidationError>
Create a stage instance scheduled event in a guild.
The name must be between 1 and 100 characters in length.
Errors
Returns an error of type ScheduledEventName
if the name is invalid.
sourcepub fn voice(
self,
channel_id: Id<ChannelMarker>,
name: &'a str,
scheduled_start_time: &'a Timestamp
) -> Result<CreateGuildVoiceScheduledEvent<'a>, ValidationError>
pub fn voice(
self,
channel_id: Id<ChannelMarker>,
name: &'a str,
scheduled_start_time: &'a Timestamp
) -> Result<CreateGuildVoiceScheduledEvent<'a>, ValidationError>
Create a voice channel scheduled event in a guild.
The name must be between 1 and 100 characters in length.
Errors
Returns an error of type ScheduledEventName
if the name is invalid.
Trait Implementations
sourceimpl<'a> AuditLogReason<'a> for CreateGuildScheduledEvent<'a>
impl<'a> AuditLogReason<'a> for CreateGuildScheduledEvent<'a>
sourceimpl TryIntoRequest for CreateGuildScheduledEvent<'_>
impl TryIntoRequest for CreateGuildScheduledEvent<'_>
Auto Trait Implementations
impl<'a> !RefUnwindSafe for CreateGuildScheduledEvent<'a>
impl<'a> Send for CreateGuildScheduledEvent<'a>
impl<'a> Sync for CreateGuildScheduledEvent<'a>
impl<'a> Unpin for CreateGuildScheduledEvent<'a>
impl<'a> !UnwindSafe for CreateGuildScheduledEvent<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more