Skip to main content

djs_model/
stage_instance.rs

1//! [Stage instances](https://docs.discord.com/developers/resources/stage-instance): live
2//! audio events in a stage channel.
3
4use compact_str::CompactString;
5use serde::{Deserialize, Serialize};
6
7use crate::{
8    id::{ChannelId, GuildId, ScheduledEventId, StageInstanceId},
9    macros::int_enum,
10};
11
12/// A [stage instance](https://docs.discord.com/developers/resources/stage-instance#stage-instance-object):
13/// a stage channel that is currently live.
14///
15/// discord.js counterpart: `StageInstance`.
16#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
17#[non_exhaustive]
18pub struct StageInstance {
19    /// The stage instance's ID.
20    pub id: StageInstanceId,
21    /// The guild of the stage channel.
22    pub guild_id: GuildId,
23    /// The stage channel.
24    pub channel_id: ChannelId,
25    /// The topic (1-120 characters).
26    pub topic: CompactString,
27    /// Who can see the stage instance.
28    pub privacy_level: PrivacyLevel,
29    /// Whether Stage Discovery is disabled. **Deprecated** by Discord.
30    #[serde(default)]
31    pub discoverable_disabled: bool,
32    /// The scheduled event this stage instance belongs to.
33    pub guild_scheduled_event_id: Option<ScheduledEventId>,
34}
35
36int_enum! {
37    /// [Who can see](https://docs.discord.com/developers/resources/stage-instance#stage-instance-object-privacy-level)
38    /// a stage instance.
39    ///
40    /// discord.js counterpart: `StageInstancePrivacyLevel`.
41    #[doc(alias = "StageInstancePrivacyLevel")]
42    pub enum PrivacyLevel: u8 {
43        /// Everyone. **Deprecated** by Discord.
44        Public = 1,
45        /// Only guild members.
46        GuildOnly = 2,
47    }
48}