twilight_http::request::scheduled_event

Struct CreateGuildScheduledEvent

source
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>

source

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.

source

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.

source

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.

Trait Implementations§

source§

impl<'a> AuditLogReason<'a> for CreateGuildScheduledEvent<'a>

source§

fn reason(self, reason: &'a str) -> Self

Attach an audit log reason to the request. Read more

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more