Skip to main content

CreateGuildScheduledEvent

Struct CreateGuildScheduledEvent 

Source
#[non_exhaustive]
pub struct CreateGuildScheduledEvent { pub channel_id: Option<ChannelId>, pub entity_metadata: Option<EntityMetadata>, pub name: CompactString, pub privacy_level: PrivacyLevel, pub scheduled_start_time: Timestamp, pub scheduled_end_time: Option<Timestamp>, pub description: Option<CompactString>, pub entity_type: EntityType, pub image: Option<ImageData>, pub recurrence_rule: Option<RecurrenceRuleData>, }
Expand description

The body of Create Guild Scheduled Event.

Build it with the constructor of the event’s place (D-125) — stage, voice or external — which sets the fields that place requires; the rest are optional. A guild can have at most 100 scheduled or active events.

discord.js counterpart: GuildScheduledEventCreateOptions.

§Examples

use djs_model::{rest::CreateGuildScheduledEvent, util::Timestamp};

let start = Timestamp::parse("2026-11-20T18:00:00Z")?;
let end = Timestamp::parse("2026-11-20T20:00:00Z")?;
let mut body = CreateGuildScheduledEvent::external("Rust meetup, Kraków", "Meetup", start, end);
body.description = Some("Talks and pizza".into());
let json = serde_json::to_string(&body)?;
assert!(json.starts_with(r#"{"entity_metadata":{"location":"Rust meetup, Kraków"},"name":"Meetup","privacy_level":2,"#));
assert!(json.ends_with(r#""description":"Talks and pizza","entity_type":3}"#));

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§channel_id: Option<ChannelId>

The stage or voice channel (not for external events).

§entity_metadata: Option<EntityMetadata>

The location of an external event.

§name: CompactString

The name (1-100 characters).

§privacy_level: PrivacyLevel

Who can see the event (only PrivacyLevel::GuildOnly exists).

§scheduled_start_time: Timestamp

When the event starts.

§scheduled_end_time: Option<Timestamp>

When the event ends (required for external events).

§description: Option<CompactString>

The description (1-1000 characters).

§entity_type: EntityType

Where the event takes place.

§image: Option<ImageData>

The cover image.

§recurrence_rule: Option<RecurrenceRuleData>

How the event repeats.

Implementations§

Source§

impl CreateGuildScheduledEvent

Source

pub fn stage( channel_id: ChannelId, name: impl Into<CompactString>, start: Timestamp, ) -> Self

An event in the stage channel channel_id.

discord.js counterpart: GuildScheduledEventCreateOptions with a stage channel.

Source

pub fn voice( channel_id: ChannelId, name: impl Into<CompactString>, start: Timestamp, ) -> Self

An event in the voice channel channel_id.

discord.js counterpart: GuildScheduledEventCreateOptions with a voice channel.

Source

pub fn external( location: impl Into<CompactString>, name: impl Into<CompactString>, start: Timestamp, end: Timestamp, ) -> Self

An event outside Discord’s voice channels, at location (1-100 characters), from start to end.

discord.js counterpart: GuildScheduledEventCreateOptions with entityMetadata.location.

Trait Implementations§

Source§

impl Clone for CreateGuildScheduledEvent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CreateGuildScheduledEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for CreateGuildScheduledEvent

Source§

impl PartialEq for CreateGuildScheduledEvent

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for CreateGuildScheduledEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CreateGuildScheduledEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.