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::{guild::scheduled_event::PrivacyLevel, 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, PrivacyLevel::GuildOnly)
.stage_instance(
channel_id,
"Garfield Appreciation Hour",
&garfield_start_time,
)
.description("Discuss: How important is Garfield to You?")
.await?;
Create an external event:
use twilight_model::{guild::scheduled_event::PrivacyLevel, 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, PrivacyLevel::GuildOnly)
.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.",
)
.await?;
Implementations§
source§impl<'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,
) -> CreateGuildExternalScheduledEvent<'a>
pub fn external( self, name: &'a str, location: &'a str, scheduled_start_time: &'a Timestamp, scheduled_end_time: &'a Timestamp, ) -> CreateGuildExternalScheduledEvent<'a>
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,
) -> CreateGuildStageInstanceScheduledEvent<'a>
pub fn stage_instance( self, channel_id: Id<ChannelMarker>, name: &'a str, scheduled_start_time: &'a Timestamp, ) -> CreateGuildStageInstanceScheduledEvent<'a>
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,
) -> CreateGuildVoiceScheduledEvent<'a>
pub fn voice( self, channel_id: Id<ChannelMarker>, name: &'a str, scheduled_start_time: &'a Timestamp, ) -> CreateGuildVoiceScheduledEvent<'a>
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.