Skip to content

Commit

Permalink
feat(model): add GuildFeature::InvitesDisabled (#1910)
Browse files Browse the repository at this point in the history
Discord has added a new guild feature, which when enabled pauses all
invites, preventing new users from joining.

Closes #1905.
  • Loading branch information
itohatweb committed Sep 16, 2022
1 parent 8a1af63 commit ec67a74
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions twilight-model/src/guild/feature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ pub enum GuildFeature {
Discoverable,
/// Is able to be featured in the directory.
Featurable,
/// Invites have been paused, this prevents new users from joining.
InvitesDisabled,
/// Has access to set an invite splash background.
InviteSplash,
/// Has enabled membership screening.
Expand Down Expand Up @@ -73,6 +75,7 @@ impl From<GuildFeature> for Cow<'static, str> {
GuildFeature::Community => "COMMUNITY".into(),
GuildFeature::Discoverable => "DISCOVERABLE".into(),
GuildFeature::Featurable => "FEATURABLE".into(),
GuildFeature::InvitesDisabled => "INVITES_DISABLED".into(),
GuildFeature::InviteSplash => "INVITE_SPLASH".into(),
GuildFeature::MemberVerificationGateEnabled => {
"MEMBER_VERIFICATION_GATE_ENABLED".into()
Expand Down Expand Up @@ -105,6 +108,7 @@ impl From<String> for GuildFeature {
"COMMUNITY" => Self::Community,
"DISCOVERABLE" => Self::Discoverable,
"FEATURABLE" => Self::Featurable,
"INVITES_DISABLED" => Self::InvitesDisabled,
"INVITE_SPLASH" => Self::InviteSplash,
"MEMBER_VERIFICATION_GATE_ENABLED" => Self::MemberVerificationGateEnabled,
"MONETIZATION_ENABLED" => Self::MonetizationEnabled,
Expand Down Expand Up @@ -145,6 +149,10 @@ mod tests {
serde_test::assert_tokens(&GuildFeature::Community, &[Token::Str("COMMUNITY")]);
serde_test::assert_tokens(&GuildFeature::Discoverable, &[Token::Str("DISCOVERABLE")]);
serde_test::assert_tokens(&GuildFeature::Featurable, &[Token::Str("FEATURABLE")]);
serde_test::assert_tokens(
&GuildFeature::InvitesDisabled,
&[Token::Str("INVITES_DISABLED")],
);
serde_test::assert_tokens(&GuildFeature::InviteSplash, &[Token::Str("INVITE_SPLASH")]);
serde_test::assert_tokens(
&GuildFeature::MemberVerificationGateEnabled,
Expand Down

0 comments on commit ec67a74

Please sign in to comment.