twilight_model/guild/onboarding/
mod.rsmod mode;
mod option;
mod prompt;
mod prompt_type;
use crate::id::{
marker::{ChannelMarker, GuildMarker},
Id,
};
use serde::{Deserialize, Serialize};
pub use self::{
mode::OnboardingMode,
option::{OnboardingPromptEmoji, OnboardingPromptOption},
prompt::OnboardingPrompt,
prompt_type::OnboardingPromptType,
};
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct Onboarding {
pub default_channel_ids: Vec<Id<ChannelMarker>>,
pub enabled: bool,
pub guild_id: Id<GuildMarker>,
pub mode: OnboardingMode,
pub prompts: Vec<OnboardingPrompt>,
}
#[cfg(test)]
mod tests {
use super::{Onboarding, OnboardingMode};
use crate::id::Id;
use serde_test::Token;
#[test]
fn onboarding() {
let onboarding = Onboarding {
default_channel_ids: Vec::new(),
enabled: true,
guild_id: Id::new(123_456_789),
mode: OnboardingMode::OnboardingDefault,
prompts: Vec::new(),
};
serde_test::assert_tokens(
&onboarding,
&[
Token::Struct {
name: "Onboarding",
len: 5,
},
Token::Str("default_channel_ids"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
Token::Str("enabled"),
Token::Bool(true),
Token::Str("guild_id"),
Token::NewtypeStruct { name: "Id" },
Token::Str("123456789"),
Token::Str("mode"),
Token::U8(0),
Token::Str("prompts"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
Token::StructEnd,
],
)
}
}