Add missing guild features (#2036)
This commit is contained in:
@@ -14,92 +14,172 @@ namespace Discord
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
None = 0,
|
None = 0,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// The guild has access to animated banners.
|
||||||
|
/// </summary>
|
||||||
|
AnimatedBanner = 1 << 0,
|
||||||
|
/// <summary>
|
||||||
/// The guild has access to set an animated guild icon.
|
/// The guild has access to set an animated guild icon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
AnimatedIcon = 1 << 0,
|
AnimatedIcon = 1 << 1,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to set a guild banner image.
|
/// The guild has access to set a guild banner image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Banner = 1 << 1,
|
Banner = 1 << 2,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has access to channel banners.
|
||||||
|
/// </summary>
|
||||||
|
ChannelBanner = 1 << 3,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to use commerce features (i.e. create store channels).
|
/// The guild has access to use commerce features (i.e. create store channels).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Commerce = 1 << 2,
|
Commerce = 1 << 4,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates.
|
/// The guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Community = 1 << 3,
|
Community = 1 << 5,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild is able to be discovered in the directory.
|
/// The guild is able to be discovered in the directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Discoverable = 1 << 4,
|
Discoverable = 1 << 6,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has discoverable disabled.
|
||||||
|
/// </summary>
|
||||||
|
DiscoverableDisabled = 1 << 7,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has enabled discoverable before.
|
||||||
|
/// </summary>
|
||||||
|
EnabledDiscoverableBefore = 1 << 8,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild is able to be featured in the directory.
|
/// The guild is able to be featured in the directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Featureable = 1 << 5,
|
Featureable = 1 << 9,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has a force relay.
|
||||||
|
/// </summary>
|
||||||
|
ForceRelay = 1 << 10,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has a directory entry.
|
||||||
|
/// </summary>
|
||||||
|
HasDirectoryEntry = 1 << 11,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild is a hub.
|
||||||
|
/// </summary>
|
||||||
|
Hub = 1 << 12,
|
||||||
|
/// <summary>
|
||||||
|
/// You shouldn't be here...
|
||||||
|
/// </summary>
|
||||||
|
InternalEmployeeOnly = 1 << 13,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to set an invite splash background.
|
/// The guild has access to set an invite splash background.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
InviteSplash = 1 << 6,
|
InviteSplash = 1 << 14,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild is linked to a hub.
|
||||||
|
/// </summary>
|
||||||
|
LinkedToHub = 1 << 15,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has member profiles.
|
||||||
|
/// </summary>
|
||||||
|
MemberProfiles = 1 << 16,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has enabled <seealso href="https://discord.com/developers/docs/resources/guild#membership-screening-object">Membership Screening</seealso>.
|
/// The guild has enabled <seealso href="https://discord.com/developers/docs/resources/guild#membership-screening-object">Membership Screening</seealso>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MemberVerificationGateEnabled = 1 << 7,
|
MemberVerificationGateEnabled = 1 << 17,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has enabled monetization.
|
/// The guild has enabled monetization.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MonetizationEnabled = 1 << 8,
|
MonetizationEnabled = 1 << 18,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has more emojis.
|
||||||
|
/// </summary>
|
||||||
|
MoreEmoji = 1 << 19,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has increased custom sticker slots.
|
/// The guild has increased custom sticker slots.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MoreStickers = 1 << 9,
|
MoreStickers = 1 << 20,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to create news channels.
|
/// The guild has access to create news channels.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
News = 1 << 10,
|
News = 1 << 21,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has new thread permissions.
|
||||||
|
/// </summary>
|
||||||
|
NewThreadPermissions = 1 << 22,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild is partnered.
|
/// The guild is partnered.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Partnered = 1 << 11,
|
Partnered = 1 << 23,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has a premium tier three override; guilds made by Discord usually have this.
|
||||||
|
/// </summary>
|
||||||
|
PremiumTier3Override = 1 << 24,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild can be previewed before joining via Membership Screening or the directory.
|
/// The guild can be previewed before joining via Membership Screening or the directory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
PreviewEnabled = 1 << 12,
|
PreviewEnabled = 1 << 25,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to create private threads.
|
/// The guild has access to create private threads.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
PrivateThreads = 1 << 13,
|
PrivateThreads = 1 << 26,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has relay enabled.
|
||||||
|
/// </summary>
|
||||||
|
RelayEnabled = 1 << 27,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild is able to set role icons.
|
/// The guild is able to set role icons.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
RoleIcons = 1 << 14,
|
RoleIcons = 1 << 28,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has role subscriptions available for purchase.
|
||||||
|
/// </summary>
|
||||||
|
RoleSubscriptionsAvailableForPurchase = 1 << 29,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has role subscriptions enabled.
|
||||||
|
/// </summary>
|
||||||
|
RoleSubscriptionsEnabled = 1 << 30,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to the seven day archive time for threads.
|
/// The guild has access to the seven day archive time for threads.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
SevenDayThreadArchive = 1 << 15,
|
SevenDayThreadArchive = 1 << 31,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has text in voice enabled.
|
||||||
|
/// </summary>
|
||||||
|
TextInVoiceEnabled = 1 << 32,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has threads enabled.
|
||||||
|
/// </summary>
|
||||||
|
ThreadsEnabled = 1 << 33,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has testing threads enabled.
|
||||||
|
/// </summary>
|
||||||
|
ThreadsEnabledTesting = 1 << 34,
|
||||||
|
/// <summary>
|
||||||
|
/// The guild has the default thread auto archive.
|
||||||
|
/// </summary>
|
||||||
|
ThreadsDefaultAutoArchiveDuration = 1 << 35,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to the three day archive time for threads.
|
/// The guild has access to the three day archive time for threads.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ThreeDayThreadArchive = 1 << 16,
|
ThreeDayThreadArchive = 1 << 36,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has enabled ticketed events.
|
/// The guild has enabled ticketed events.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
TicketedEventsEnabled = 1 << 17,
|
TicketedEventsEnabled = 1 << 37,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to set a vanity URL.
|
/// The guild has access to set a vanity URL.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
VanityUrl = 1 << 18,
|
VanityUrl = 1 << 38,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild is verified.
|
/// The guild is verified.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Verified = 1 << 19,
|
Verified = 1 << 39,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has access to set 384kbps bitrate in voice (previously VIP voice servers).
|
/// The guild has access to set 384kbps bitrate in voice (previously VIP voice servers).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
VIPRegions = 1 << 20,
|
VIPRegions = 1 << 40,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The guild has enabled the welcome screen.
|
/// The guild has enabled the welcome screen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
WelcomeScreenEnabled = 1 << 21,
|
WelcomeScreenEnabled = 1 << 41,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,10 +15,78 @@ namespace Discord
|
|||||||
public GuildFeature Value { get; }
|
public GuildFeature Value { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a collection of experimental features for this guild.
|
/// Gets a collection of experimental features for this guild. Features that are not contained in <see cref="GuildFeature"/> are put in here.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IReadOnlyCollection<string> Experimental { get; }
|
public IReadOnlyCollection<string> Experimental { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether or not the guild has threads enabled.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasThreads
|
||||||
|
=> HasFeature(GuildFeature.ThreadsEnabled | GuildFeature.ThreadsEnabledTesting);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether or not the guild has text-in-voice enabled.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasTextInVoice
|
||||||
|
=> HasFeature(GuildFeature.TextInVoiceEnabled);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether or not the server is a internal staff server.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// You shouldn't touch anything here unless you know what you're doing :)
|
||||||
|
/// </remarks>
|
||||||
|
public bool IsStaffServer
|
||||||
|
=> HasFeature(GuildFeature.InternalEmployeeOnly);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether or not this server is a hub.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsHub
|
||||||
|
=> HasFeature(GuildFeature.Hub);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether or this server is linked to a hub server.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsLinkedToHub
|
||||||
|
=> HasFeature(GuildFeature.LinkedToHub);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether or not this server is partnered.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsPartnered
|
||||||
|
=> HasFeature(GuildFeature.Partnered);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether or not this server is verified.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsVerified
|
||||||
|
=> HasFeature(GuildFeature.Verified);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether or not this server has vanity urls enabled.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasVanityUrl
|
||||||
|
=> HasFeature(GuildFeature.VanityUrl);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether or not this server has role subscriptions enabled.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasRoleSubscriptions
|
||||||
|
=> HasFeature(GuildFeature.RoleSubscriptionsEnabled | GuildFeature.RoleSubscriptionsAvailableForPurchase);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether or not this server has role icons enabled.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasRoleIcons
|
||||||
|
=> HasFeature(GuildFeature.RoleIcons);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether or not this server has private threads enabled.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasPrivateThreads
|
||||||
|
=> HasFeature(GuildFeature.PrivateThreads);
|
||||||
|
|
||||||
internal GuildFeatures(GuildFeature value, string[] experimental)
|
internal GuildFeatures(GuildFeature value, string[] experimental)
|
||||||
{
|
{
|
||||||
@@ -26,8 +94,19 @@ namespace Discord
|
|||||||
Experimental = experimental.ToImmutableArray();
|
Experimental = experimental.ToImmutableArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns whether or not this guild has a feature.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="feature">The feature(s) to check for.</param>
|
||||||
|
/// <returns><see langword="true"/> if this guild has the provided feature(s), otherwise <see langword="false"/>.</returns>
|
||||||
public bool HasFeature(GuildFeature feature)
|
public bool HasFeature(GuildFeature feature)
|
||||||
=> Value.HasFlag(feature);
|
=> Value.HasFlag(feature);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns whether or not this guild has a feature.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="feature">The feature to check for.</param>
|
||||||
|
/// <returns><see langword="true"/> if this guild has the provided feature, otherwise <see langword="false"/>.</returns>
|
||||||
public bool HasFeature(string feature)
|
public bool HasFeature(string feature)
|
||||||
=> Experimental.Contains(feature);
|
=> Experimental.Contains(feature);
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,12 @@ namespace Discord.Rest
|
|||||||
IsBoostProgressBarEnabled = args.IsBoostProgressBarEnabled
|
IsBoostProgressBarEnabled = args.IsBoostProgressBarEnabled
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (apiArgs.Banner.IsSpecified)
|
||||||
|
guild.Features.EnsureFeature(GuildFeature.Banner);
|
||||||
|
|
||||||
|
if (apiArgs.Splash.IsSpecified)
|
||||||
|
guild.Features.EnsureFeature(GuildFeature.InviteSplash);
|
||||||
|
|
||||||
if (args.AfkChannel.IsSpecified)
|
if (args.AfkChannel.IsSpecified)
|
||||||
apiArgs.AfkChannelId = args.AfkChannel.Value.Id;
|
apiArgs.AfkChannelId = args.AfkChannel.Value.Id;
|
||||||
else if (args.AfkChannelId.IsSpecified)
|
else if (args.AfkChannelId.IsSpecified)
|
||||||
|
|||||||
Reference in New Issue
Block a user