diff --git a/DisCatSharp/Entities/Guild/DiscordGuild.Features.cs b/DisCatSharp/Entities/Guild/DiscordGuild.Features.cs
index 8ff8bf81b..2e0abc308 100644
--- a/DisCatSharp/Entities/Guild/DiscordGuild.Features.cs
+++ b/DisCatSharp/Entities/Guild/DiscordGuild.Features.cs
@@ -1,358 +1,528 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2022 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DisCatSharp.Enums;
namespace DisCatSharp.Entities;
///
/// Represents the guild features.
///
public class GuildFeatures
{
///
/// List of all guild features.
///
public List Features { get; }
///
/// Checks the guild features and constructs a new object.
///
/// Guild to check
public GuildFeatures(DiscordGuild guild)
{
this.Features = new List();
if (guild.RawFeatures.Contains("ANIMATED_ICON")) this.Features.Add(GuildFeaturesEnum.CanSetAnimatedIcon);
if (guild.RawFeatures.Contains("ANIMATED_BANNER")) this.Features.Add(GuildFeaturesEnum.CanSetAnimatedBanner);
if (guild.RawFeatures.Contains("BANNER")) this.Features.Add(GuildFeaturesEnum.CanSetBanner);
if (guild.RawFeatures.Contains("CHANNEL_BANNER")) this.Features.Add(GuildFeaturesEnum.CanSetChannelBanner);
if (guild.RawFeatures.Contains("COMMUNITY")) this.Features.Add(GuildFeaturesEnum.HasCommunityEnabled);
if (!guild.RawFeatures.Contains("DISCOVERABLE_DISABLED") && guild.RawFeatures.Contains("DISCOVERABLE")) this.Features.Add(GuildFeaturesEnum.IsDiscoverable);
if (guild.RawFeatures.Contains("FEATUREABLE")) this.Features.Add(GuildFeaturesEnum.IsFeatureable);
if (guild.RawFeatures.Contains("INVITE_SPLASH")) this.Features.Add(GuildFeaturesEnum.CanSetInviteSplash);
if (guild.RawFeatures.Contains("MEMBER_VERIFICATION_GATE_ENABLED")) this.Features.Add(GuildFeaturesEnum.HasMembershipScreeningEnabled);
if (guild.RawFeatures.Contains("NEWS")) this.Features.Add(GuildFeaturesEnum.CanCreateNewsChannels);
if (guild.RawFeatures.Contains("PARTNERED")) this.Features.Add(GuildFeaturesEnum.IsPartnered);
if (guild.RawFeatures.Contains("MORE_EMOJI")) this.Features.Add(GuildFeaturesEnum.CanUploadMoreEmojis);
if (guild.RawFeatures.Contains("PREVIEW_ENABLED")) this.Features.Add(GuildFeaturesEnum.HasPreviewEnabled);
if (guild.RawFeatures.Contains("VANITY_URL")) this.Features.Add(GuildFeaturesEnum.CanSetVanityUrl);
if (guild.RawFeatures.Contains("VERIFIED")) this.Features.Add(GuildFeaturesEnum.IsVerified);
if (guild.RawFeatures.Contains("VIP_REGIONS")) this.Features.Add(GuildFeaturesEnum.CanAccessVipRegions);
if (guild.RawFeatures.Contains("WELCOME_SCREEN_ENABLED")) this.Features.Add(GuildFeaturesEnum.HasWelcomeScreenEnabled);
if (guild.RawFeatures.Contains("TICKETED_EVENTS_ENABLED")) this.Features.Add(GuildFeaturesEnum.HasTicketedEventsEnabled);
if (guild.RawFeatures.Contains("MONETIZATION_ENABLED")) this.Features.Add(GuildFeaturesEnum.HasMonetizationEnabled);
if (guild.RawFeatures.Contains("MORE_STICKERS")) this.Features.Add(GuildFeaturesEnum.CanUploadMoreStickers);
if (guild.RawFeatures.Contains("PRIVATE_THREADS")) this.Features.Add(GuildFeaturesEnum.CanCreatePrivateThreads);
if (guild.RawFeatures.Contains("HUB")) this.Features.Add(GuildFeaturesEnum.IsHub);
if (guild.RawFeatures.Contains("THREADS_ENABLED_TESTING")) this.Features.Add(GuildFeaturesEnum.HasThreadTestingEnabled);
if (guild.RawFeatures.Contains("THREADS_ENABLED")) this.Features.Add(GuildFeaturesEnum.HasThreadsEnabled);
if (guild.RawFeatures.Contains("ROLE_ICONS")) this.Features.Add(GuildFeaturesEnum.CanSetRoleIcons);
if (guild.RawFeatures.Contains("NEW_THREAD_PERMISSIONS")) this.Features.Add(GuildFeaturesEnum.HasNewThreadPermissions);
if (guild.RawFeatures.Contains("ROLE_SUBSCRIPTIONS_ENABLED")) this.Features.Add(GuildFeaturesEnum.HasRoleSubscriptionsEnabled);
if (guild.RawFeatures.Contains("PREMIUM_TIER_3_OVERRIDE")) this.Features.Add(GuildFeaturesEnum.PremiumTierThreeOverride);
if (guild.RawFeatures.Contains("THREAD_DEFAULT_AUTO_ARCHIVE_DURATION")) this.Features.Add(GuildFeaturesEnum.CanSetThreadDefaultAutoArchiveDuration);
if (guild.RawFeatures.Contains("TEXT_IN_VOICE_ENABLED")) this.Features.Add(GuildFeaturesEnum.TextInVoiceEnabled);
if (guild.RawFeatures.Contains("HAS_DIRECTORY_ENTRY")) this.Features.Add(GuildFeaturesEnum.HasDirectoryEntry);
if (guild.RawFeatures.Contains("LINKED_TO_HUB")) this.Features.Add(GuildFeaturesEnum.IsLinkedToHub);
if (guild.RawFeatures.Contains("MEMBER_PROFILES")) this.Features.Add(GuildFeaturesEnum.HasMemberProfiles);
if (guild.RawFeatures.Contains("INTERNAL_EMPLOYEE_ONLY")) this.Features.Add(GuildFeaturesEnum.IsStaffOnly);
if (guild.RawFeatures.Contains("ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE")) this.Features.Add(GuildFeaturesEnum.RoleSubscriptionsIsAvailableForPurchase);
if (guild.RawFeatures.Contains("AUTO_MODERATION")) this.Features.Add(GuildFeaturesEnum.CanSetupAutoModeration);
if (guild.RawFeatures.Contains("GUILD_HOME_TEST")) this.Features.Add(GuildFeaturesEnum.GuildHomeTest);
if (guild.RawFeatures.Contains("INVITES_DISABLED")) this.Features.Add(GuildFeaturesEnum.InvitesDisabled);
}
///
/// Checks whether the guild has a feature enabled.
///
/// The feature you'd like to check for.
/// Whether the guild has the requested feature.
public bool HasFeature(GuildFeaturesEnum flag)
=> this.Features.Contains(flag);
public string ToString(string separator, bool humanReadable)
{
if (!humanReadable) return string.Join(separator, this.Features);
else
{
var humanReadableFeatures = this.Features.Select(x => AddSpacesToWord(x.ToString()));
return string.Join(separator, humanReadableFeatures);
}
}
///
/// Converts a string of characters (here: enum) into a string of characters separated by spaces after a capital letter.
///
/// String of text to convert
/// String separated by a space after every capital letter.
private static string AddSpacesToWord(string text)
{
if (string.IsNullOrWhiteSpace(text))
return "";
var newText = new StringBuilder(text.Length * 2);
newText.Append(text[0]);
for (int i = 1; i < text.Length; i++)
{
if (char.IsUpper(text[i]) && text[i - 1] != ' ')
newText.Append(' ');
newText.Append(text[i]);
}
return newText.ToString();
}
}
///
/// Represents the guild features.
///
public enum GuildFeaturesEnum
{
///
/// Guild has access to set an animated guild icon.
///
CanSetAnimatedIcon,
///
/// Guild has access to set a guild banner image.
///
CanSetBanner,
///
/// Guild has access to use commerce features (i.e. create store channels)
///
[Obsolete("Store applications are EOL.")]
CanCreateStoreChannels,
///
/// Guild can enable Welcome Screen, Membership Screening, Stage Channels, News Channels and receives community updates.
/// Furthermore the guild can apply as a partner and for the discovery (if the prerequisites are given).
/// and is usable.
///
HasCommunityEnabled,
///
/// Guild is able to be discovered in the discovery.
///
IsDiscoverable,
///
/// Guild is able to be featured in the discovery.
///
IsFeatureable,
///
/// Guild has access to set an invite splash background.
///
CanSetInviteSplash,
///
/// Guild has enabled Membership Screening.
///
HasMembershipScreeningEnabled,
///
/// Guild has access to create news channels.
/// is usable.
///
CanCreateNewsChannels,
///
/// Guild is partnered.
///
IsPartnered,
///
/// Guild has increased custom emoji slots.
///
CanUploadMoreEmojis,
///
/// Guild can be previewed before joining via Membership Screening or the discovery.
///
HasPreviewEnabled,
///
/// Guild has access to set a vanity URL.
///
CanSetVanityUrl,
///
/// Guild is verified.
///
IsVerified,
///
/// Guild has access to set 384kbps bitrate in voice (previously VIP voice servers).
///
CanAccessVipRegions,
///
/// Guild has enabled the welcome screen.
///
HasWelcomeScreenEnabled,
///
/// Guild has enabled ticketed events.
///
HasTicketedEventsEnabled,
///
/// Guild has enabled monetization.
///
HasMonetizationEnabled,
///
/// Guild has increased custom sticker slots.
///
CanUploadMoreStickers,
///
/// Guild has access to the three day archive time for threads.
/// Needs Premium Tier 1 ().
///
[Obsolete("Auto archive duration isn't locked to boosts anymore.")]
CanSetThreadArchiveDurationThreeDays,
///
/// Guild has access to the seven day archive time for threads.
/// Needs Premium Tier 2 ().
///
[Obsolete("Auto archive duration isn't locked to boosts anymore.")]
CanSetThreadArchiveDurationSevenDays,
///
/// Guild has access to create private threads.
/// Needs Premium Tier 2 ().
///
CanCreatePrivateThreads,
///
/// Guild is a hub.
/// is usable.
///
IsHub,
///
/// Guild is in a hub.
/// https://github.com/discord/discord-api-docs/pull/3757/commits/4932d92c9d0c783861bc715bf7ebbabb15114e34
///
HasDirectoryEntry,
///
/// Guild is linked to a hub.
///
IsLinkedToHub,
///
/// Guild has full access to threads.
/// Old Feature.
///
HasThreadTestingEnabled,
///
/// Guild has access to threads.
///
HasThreadsEnabled,
///
/// Guild can set role icons.
///
CanSetRoleIcons,
///
/// Guild has the new thread permissions.
/// Old Feature.
///
HasNewThreadPermissions,
///
/// Guild can set thread default auto archive duration.
/// Old Feature.
///
CanSetThreadDefaultAutoArchiveDuration,
///
/// Guild has enabled role subscriptions.
///
HasRoleSubscriptionsEnabled,
///
/// Guild role subscriptions as purchaseable.
///
RoleSubscriptionsIsAvailableForPurchase,
///
/// Guild has premium tier 3 override.
///
PremiumTierThreeOverride,
///
/// Guild has access to text in voice.
/// Restricted to .
///
TextInVoiceEnabled,
///
/// Guild can set an animated banner.
/// Needs Premium Tier 3 ().
///
CanSetAnimatedBanner,
///
/// Guild can set an animated banner.
/// Needs Premium Tier 3 ().
///
[Obsolete("Feature was removed")]
CanSetChannelBanner,
///
/// Allows members to customize their avatar, banner and bio for that server.
///
HasMemberProfiles,
///
/// Guild is restricted to users with the badge.
///
IsStaffOnly,
///
/// Guild can use and setup the experimental auto moderation feature.
///
CanSetupAutoModeration,
///
/// Guild has access to home.
///
GuildHomeTest,
///
/// Guild has disabled invites.
///
InvitesDisabled,
+
+ ///
+ ///
+ ///
+ ActivitiesAlpha,
+
+ ///
+ ///
+ ///
+ ActivitiesEmployee,
+
+ ///
+ ///
+ ///
+ ActivitiesInternalDev,
+
+ ///
+ ///
+ ///
+ AutomodTriggerKeywordFilter,
+
+ ///
+ ///
+ ///
+ AutomodTriggerMlSpamFilter,
+
+ ///
+ ///
+ ///
+ AutomodTriggerSpamLinkFilterGuild,
+
+ ///
+ ///
+ ///
+ AutomodDefaultList,
+
+ ///
+ ///
+ ///
+ Bfg,
+
+ ///
+ ///
+ ///
+ BoostingTiersExperimentMediumGuild,
+
+ ///
+ ///
+ ///
+ BoostingTiersExperimentSmallGuild,
+
+ ///
+ /// Guild has early access features for bot and library developers.
+ ///
+ BotDeveloperEarlyAccess,
+
+ ///
+ ///
+ ///
+ CreatorMonetizable,
+
+ ///
+ ///
+ ///
+ CreatorMonetizableDisabled,
+
+ ///
+ ///
+ ///
+ CreatorMonetizableProvisional,
+
+ ///
+ ///
+ ///
+ CreatorMonetizableWhiteGlove,
+
+ ///
+ ///
+ ///
+ CreatorMonetizationApplicationAllowlist,
+
+ ///
+ /// Guild is set as a support server for an app in App Directory.
+ ///
+ DeveloperSupportServer,
+
+ ///
+ /// Guild was previously in the 2021-11_activities_baseline_engagement_bundle experiment.
+ ///
+ ExposedToActivitiesWtpExperiment,
+
+ ///
+ /// Guild was previously in the 2021-11_guild_communication_disabled_guilds experiment.
+ ///
+ GuildCommunicationDisabledGuilds,
+
+ ///
+ ///
+ ///
+ DisableGuildCommunication,
+
+ ///
+ /// Guild has access to the Home feature, enables Treatment 2 of the 2022-01_home_tab_guild experiment.
+ ///
+ GuildHomeOverride,
+
+ ///
+ /// Guild was previously in the 2022-03_guild_automod_default_list experiment.
+ ///
+ GuildAutomodDefaultList,
+
+ ///
+ /// Guild was previously in the 2021-06_guild_role_subscriptions experiment.
+ ///
+ GuildMemberVerificationExperiment,
+
+ ///
+ /// Guilds was previously in the 2022-05_mobile_web_role_subscription_purchase_page experiment.
+ ///
+ GuildRoleSubscriptionPurchaseFeedbackLoop,
+
+ ///
+ /// Guilds previously in the 2022-01_guild_role_subscription_trials experiment.
+ ///
+ GuildRoleSubscriptionTrials,
+
+ ///
+ /// Guild previously had access to voice channel activities and can bypass the boost level requirement.
+ ///
+ HadEarlyActivitiesAccess,
+
+ ///
+ /// Allows the guild to have 1,000+ active threads.
+ ///
+ IncreasedThreadLimit,
+
+ ///
+ /// Guild was previously in the 2022-05_mobile_web_role_subscription_purchase_page experiment.
+ ///
+ MobileWebRoleSubscriptionPurchasePage,
+
+ ///
+ /// Shards connections to the guild to different nodes that relay information between each other.
+ ///
+ RelayEnabled,
+
+ ///
+ ///
+ ///
+ RestrictSpamRiskGuilds,
+
+ ///
+ /// Allows guild's members to purchase role subscriptions.
+ ///
+ RoleSubscriptionsAvailableForPurchase,
+
+ ///
+ /// Used by bot developers to test their bots with threads in guilds with 5 or less members and a bot.
+ ///
+ ThreadsEnabledTesting,
+
+ ///
+ /// Guild was previously in the 2022-06_voice_channel_effects experiment.
+ ///
+ VoiceChannelEffects,
+
+ ///
+ /// Guild was previously in the 2021-12_soundboardl experiment.
+ ///
+ Soundboard,
}