diff --git a/README.md b/README.md
index f4bc5811e..9ace4f22e 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,9 @@
[](https://www.nuget.org/packages/Discord.Net)
[](https://www.myget.org/feed/Packages/discord-net)
[](https://dev.azure.com/discord-net/Discord.Net/_build/latest?definitionId=1&branchName=dev)
-[](https://discord.gg/jkrBmQR)
+[](https://discord.gg/jkrBmQR)
-An unofficial .NET API Wrapper for the Discord client (http://discordapp.com).
+An unofficial .NET API Wrapper for the Discord client (https://discord.com).
Check out the [documentation](https://discord.foxbot.me/) or join the [Discord API Chat](https://discord.gg/jkrBmQR).
diff --git a/docs/_overwrites/Common/EmbedObjectBuilder.Inclusion.md b/docs/_overwrites/Common/EmbedObjectBuilder.Inclusion.md
index eac0d9ca5..a9d3539ed 100644
--- a/docs/_overwrites/Common/EmbedObjectBuilder.Inclusion.md
+++ b/docs/_overwrites/Common/EmbedObjectBuilder.Inclusion.md
@@ -4,10 +4,10 @@ field, and 2 normal fields using an @Discord.EmbedBuilder:
```cs
var exampleAuthor = new EmbedAuthorBuilder()
.WithName("I am a bot")
- .WithIconUrl("https://discordapp.com/assets/e05ead6e6ebc08df9291738d0aa6986d.png");
+ .WithIconUrl("https://discord.com/assets/e05ead6e6ebc08df9291738d0aa6986d.png");
var exampleFooter = new EmbedFooterBuilder()
.WithText("I am a nice footer")
- .WithIconUrl("https://discordapp.com/assets/28174a34e77bb5e5310ced9f95cb480b.png");
+ .WithIconUrl("https://discord.com/assets/28174a34e77bb5e5310ced9f95cb480b.png");
var exampleField = new EmbedFieldBuilder()
.WithName("Title of Another Field")
.WithValue("I am an [example](https://example.com).")
@@ -22,4 +22,4 @@ var embed = new EmbedBuilder()
.WithAuthor(exampleAuthor)
.WithFooter(exampleFooter)
.Build();
-```
\ No newline at end of file
+```
diff --git a/docs/faq/basics/client-basics.md b/docs/faq/basics/client-basics.md
index 9377ac2e9..1176ee3fd 100644
--- a/docs/faq/basics/client-basics.md
+++ b/docs/faq/basics/client-basics.md
@@ -30,7 +30,7 @@ There are few possible reasons why this may occur.
[TokenType]: xref:Discord.TokenType
[827]: https://github.com/RogueException/Discord.Net/issues/827
[958]: https://github.com/RogueException/Discord.Net/issues/958
-[Discord API Terms of Service]: https://discordapp.com/developers/docs/legal
+[Discord API Terms of Service]: https://discord.com/developers/docs/legal
## How do I do X, Y, Z when my bot connects/logs on? Why do I get a `NullReferenceException` upon calling any client methods after connect?
diff --git a/docs/faq/misc/glossary.md b/docs/faq/misc/glossary.md
index 95bdbaa03..4b661f65c 100644
--- a/docs/faq/misc/glossary.md
+++ b/docs/faq/misc/glossary.md
@@ -19,7 +19,7 @@ channels, and are often referred to as "servers".
* A **Channel** ([IChannel]) represents a generic channel.
- Example: #dotnet_discord-net
- See [Channel Types](#channel-types)
-
+
[IGuild]: xref:Discord.IGuild
[IChannel]: xref:Discord.IChannel
@@ -79,4 +79,4 @@ activity for listening to a song on Spotify.
[RichGame]: xref:Discord.RichGame
[StreamingGame]: xref:Discord.StreamingGame
[SpotifyGame]: xref:Discord.SpotifyGame
-[Rich Presence Intro]: https://discordapp.com/developers/docs/rich-presence/best-practices
\ No newline at end of file
+[Rich Presence Intro]: https://discord.com/developers/docs/rich-presence/best-practices
diff --git a/docs/guides/getting_started/first-bot.md b/docs/guides/getting_started/first-bot.md
index bdae80c7f..150466be1 100644
--- a/docs/guides/getting_started/first-bot.md
+++ b/docs/guides/getting_started/first-bot.md
@@ -31,7 +31,7 @@ the Discord Applications Portal first.

-[Discord Applications Portal]: https://discordapp.com/developers/applications/
+[Discord Applications Portal]: https://discord.com/developers/applications/
## Adding your bot to a server
@@ -165,11 +165,11 @@ or any other blocking method, such as reading from the console.
> the source code for your bot.
>
> In the following example, we retrieve the token from a pre-defined
-> variable, which is **NOT** secure, especially if you plan on
+> variable, which is **NOT** secure, especially if you plan on
> distributing the application in any shape or form.
>
-> We recommend alternative storage such as
-> [Environment Variables], an external configuration file, or a
+> We recommend alternative storage such as
+> [Environment Variables], an external configuration file, or a
> secrets manager for safe-handling of secrets.
>
> [Environment Variables]: https://en.wikipedia.org/wiki/Environment_variable
@@ -221,4 +221,4 @@ should be to separate...
2. the modules (handle commands)
3. the services (persistent storage, pure functions, data manipulation)
-[CommandService]: xref:Discord.Commands.CommandService
\ No newline at end of file
+[CommandService]: xref:Discord.Commands.CommandService
diff --git a/docs/index.md b/docs/index.md
index 34350df70..1d0f5aaf7 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -11,12 +11,12 @@ title: Home
[](https://www.nuget.org/packages/Discord.Net)
[](https://www.myget.org/feed/Packages/discord-net)
[](https://dev.azure.com/discord-net/Discord.Net/_build/latest?definitionId=1&branchName=dev)
-[](https://discord.gg/jkrBmQR)
+[](https://discord.gg/jkrBmQR)
## What is Discord.Net?
Discord.Net is an asynchronous, multi-platform .NET Library used to
-interface with the [Discord API](https://discordapp.com/).
+interface with the [Discord API](https://discord.com/).
## Where to begin?
diff --git a/samples/04_webhook_client/Program.cs b/samples/04_webhook_client/Program.cs
index c2e5faa03..f3a50036c 100644
--- a/samples/04_webhook_client/Program.cs
+++ b/samples/04_webhook_client/Program.cs
@@ -14,10 +14,10 @@ namespace _04_webhook_client
public async Task MainAsync()
{
- // The webhook url follows the format https://discordapp.com/api/webhooks/{id}/{token}
+ // The webhook url follows the format https://discord.com/api/webhooks/{id}/{token}
// Because anyone with the webhook URL can use your webhook
- // you should NOT hard code the URL or ID + token into your application.
- using (var client = new DiscordWebhookClient("https://discordapp.com/api/webhooks/123/abc123"))
+ // you should NOT hard code the URL or ID + token into your application.
+ using (var client = new DiscordWebhookClient("https://discord.com/api/webhooks/123/abc123"))
{
var embed = new EmbedBuilder
{
@@ -26,7 +26,7 @@ namespace _04_webhook_client
};
// Webhooks are able to send multiple embeds per message
- // As such, your embeds must be passed as a collection.
+ // As such, your embeds must be passed as a collection.
await client.SendMessageAsync(text: "Send a message to this webhook!", embeds: new[] { embed.Build() });
}
}
diff --git a/src/Discord.Net.Core/Audio/IAudioClient.cs b/src/Discord.Net.Core/Audio/IAudioClient.cs
index 018c8bc05..2fc52a529 100644
--- a/src/Discord.Net.Core/Audio/IAudioClient.cs
+++ b/src/Discord.Net.Core/Audio/IAudioClient.cs
@@ -1,4 +1,5 @@
-using System;
+using System;
+using System.Collections.Generic;
using System.Threading.Tasks;
namespace Discord.Audio
@@ -20,6 +21,9 @@ namespace Discord.Audio
/// Gets the estimated round-trip latency, in milliseconds, to the voice UDP server.
int UdpLatency { get; }
+ /// Gets the current audio streams.
+ IReadOnlyDictionary GetStreams();
+
Task StopAsync();
Task SetSpeakingAsync(bool value);
diff --git a/src/Discord.Net.Core/CDN.cs b/src/Discord.Net.Core/CDN.cs
index 32ffbba90..e1e8e5e1a 100644
--- a/src/Discord.Net.Core/CDN.cs
+++ b/src/Discord.Net.Core/CDN.cs
@@ -7,6 +7,17 @@ namespace Discord
///
public static class CDN
{
+ ///
+ /// Returns a team icon URL.
+ ///
+ /// The team identifier.
+ /// The icon identifier.
+ ///
+ /// A URL pointing to the team's icon.
+ ///
+ public static string GetTeamIconUrl(ulong teamId, string iconId)
+ => iconId != null ? $"{DiscordConfig.CDNUrl}team-icons/{teamId}/{iconId}.jpg" : null;
+
///
/// Returns an application icon URL.
///
@@ -62,11 +73,21 @@ namespace Discord
/// The guild snowflake identifier.
/// The splash icon identifier.
///
- /// A URL pointing to the guild's icon.
+ /// A URL pointing to the guild's splash.
///
public static string GetGuildSplashUrl(ulong guildId, string splashId)
=> splashId != null ? $"{DiscordConfig.CDNUrl}splashes/{guildId}/{splashId}.jpg" : null;
///
+ /// Returns a guild discovery splash URL.
+ ///
+ /// The guild snowflake identifier.
+ /// The discovery splash icon identifier.
+ ///
+ /// A URL pointing to the guild's discovery splash.
+ ///
+ public static string GetGuildDiscoverySplashUrl(ulong guildId, string discoverySplashId)
+ => discoverySplashId != null ? $"{DiscordConfig.CDNUrl}discovery-splashes/{guildId}/{discoverySplashId}.jpg" : null;
+ ///
/// Returns a channel icon URL.
///
/// The channel snowflake identifier.
diff --git a/src/Discord.Net.Core/DiscordConfig.cs b/src/Discord.Net.Core/DiscordConfig.cs
index 51970a781..429ad7b0c 100644
--- a/src/Discord.Net.Core/DiscordConfig.cs
+++ b/src/Discord.Net.Core/DiscordConfig.cs
@@ -13,7 +13,7 @@ namespace Discord
///
/// An representing the API version that Discord.Net uses to communicate with Discord.
/// A list of available API version can be seen on the official
- /// Discord API documentation
+ /// Discord API documentation
/// .
///
public const int APIVersion = 6;
@@ -50,7 +50,7 @@ namespace Discord
///
/// The Discord API URL using .
///
- public static readonly string APIUrl = $"https://discordapp.com/api/v{APIVersion}/";
+ public static readonly string APIUrl = $"https://discord.com/api/v{APIVersion}/";
///
/// Returns the base Discord CDN URL.
///
diff --git a/src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs b/src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs
index 93ca2e59a..339d6fffd 100644
--- a/src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs
+++ b/src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs
@@ -28,7 +28,7 @@ namespace Discord
///
///
/// Setting this value to a category's snowflake identifier will change or set this channel's parent to the
- /// specified channel; setting this value to 0 will detach this channel from its parent if one
+ /// specified channel; setting this value to will detach this channel from its parent if one
/// is set.
///
public Optional CategoryId { get; set; }
diff --git a/src/Discord.Net.Core/Entities/Channels/INewsChannel.cs b/src/Discord.Net.Core/Entities/Channels/INewsChannel.cs
new file mode 100644
index 000000000..a1223b48b
--- /dev/null
+++ b/src/Discord.Net.Core/Entities/Channels/INewsChannel.cs
@@ -0,0 +1,9 @@
+namespace Discord
+{
+ ///
+ /// Represents a generic news channel in a guild that can send and receive messages.
+ ///
+ public interface INewsChannel : ITextChannel
+ {
+ }
+}
diff --git a/src/Discord.Net.Core/Entities/Guilds/GuildWidgetProperties.cs b/src/Discord.Net.Core/Entities/Guilds/GuildWidgetProperties.cs
new file mode 100644
index 000000000..842bb7f3e
--- /dev/null
+++ b/src/Discord.Net.Core/Entities/Guilds/GuildWidgetProperties.cs
@@ -0,0 +1,21 @@
+namespace Discord
+{
+ ///
+ /// Provides properties that are used to modify the widget of an with the specified changes.
+ ///
+ public class GuildWidgetProperties
+ {
+ ///
+ /// Sets whether the widget should be enabled.
+ ///
+ public Optional Enabled { get; set; }
+ ///
+ /// Sets the channel that the invite should place its users in, if not .
+ ///
+ public Optional Channel { get; set; }
+ ///
+ /// Sets the channel that the invite should place its users in, if not .
+ ///
+ public Optional ChannelId { get; set; }
+ }
+}
diff --git a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
index 81b5e8dd9..6283508e5 100644
--- a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
+++ b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
@@ -23,7 +23,7 @@ namespace Discord
/// automatically moved to the AFK voice channel.
///
///
- /// An representing the amount of time in seconds for a user to be marked as inactive
+ /// An representing the amount of time in seconds for a user to be marked as inactive
/// and moved into the AFK voice channel.
///
int AFKTimeout { get; }
@@ -31,10 +31,17 @@ namespace Discord
/// Gets a value that indicates whether this guild is embeddable (i.e. can use widget).
///
///
- /// true if this guild can be embedded via widgets; otherwise false.
+ /// if this guild has a widget enabled; otherwise .
///
bool IsEmbeddable { get; }
///
+ /// Gets a value that indicates whether this guild has the widget enabled.
+ ///
+ ///
+ /// if this guild has a widget enabled; otherwise .
+ ///
+ bool IsWidgetEnabled { get; }
+ ///
/// Gets the default message notifications for users who haven't explicitly set their notification settings.
///
DefaultMessageNotifications DefaultMessageNotifications { get; }
@@ -64,31 +71,45 @@ namespace Discord
/// Gets the ID of this guild's icon.
///
///
- /// An identifier for the splash image; null if none is set.
+ /// An identifier for the splash image; if none is set.
///
string IconId { get; }
///
/// Gets the URL of this guild's icon.
///
///
- /// A URL pointing to the guild's icon; null if none is set.
+ /// A URL pointing to the guild's icon; if none is set.
///
string IconUrl { get; }
///
/// Gets the ID of this guild's splash image.
///
///
- /// An identifier for the splash image; null if none is set.
+ /// An identifier for the splash image; if none is set.
///
string SplashId { get; }
///
/// Gets the URL of this guild's splash image.
///
///
- /// A URL pointing to the guild's splash image; null if none is set.
+ /// A URL pointing to the guild's splash image; if none is set.
///
string SplashUrl { get; }
///
+ /// Gets the ID of this guild's discovery splash image.
+ ///
+ ///
+ /// An identifier for the discovery splash image; if none is set.
+ ///
+ string DiscoverySplashId { get; }
+ ///
+ /// Gets the URL of this guild's discovery splash image.
+ ///
+ ///
+ /// A URL pointing to the guild's discovery splash image; if none is set.
+ ///
+ string DiscoverySplashUrl { get; }
+ ///
/// Determines if this guild is currently connected and ready to be used.
///
///
@@ -98,7 +119,7 @@ namespace Discord
/// This boolean is used to determine if the guild is currently connected to the WebSocket and is ready to be used/accessed.
///
///
- /// true if this guild is currently connected and ready to be used; otherwise false.
+ /// true if this guild is currently connected and ready to be used; otherwise .
///
bool Available { get; }
@@ -106,7 +127,7 @@ namespace Discord
/// Gets the ID of the AFK voice channel for this guild.
///
///
- /// A representing the snowflake identifier of the AFK voice channel; null if
+ /// A representing the snowflake identifier of the AFK voice channel; if
/// none is set.
///
ulong? AFKChannelId { get; }
@@ -121,7 +142,7 @@ namespace Discord
///
///
///
- /// A representing the snowflake identifier of the default text channel; 0 if
+ /// A representing the snowflake identifier of the default text channel; 0 if
/// none can be found.
///
ulong DefaultChannelId { get; }
@@ -129,30 +150,54 @@ namespace Discord
/// Gets the ID of the widget embed channel of this guild.
///
///
- /// A representing the snowflake identifier of the embedded channel found within the
- /// widget settings of this guild; null if none is set.
+ /// A representing the snowflake identifier of the embedded channel found within the
+ /// widget settings of this guild; if none is set.
///
ulong? EmbedChannelId { get; }
///
+ /// Gets the ID of the channel assigned to the widget of this guild.
+ ///
+ ///
+ /// A representing the snowflake identifier of the channel assigned to the widget found
+ /// within the widget settings of this guild; if none is set.
+ ///
+ ulong? WidgetChannelId { get; }
+ ///
/// Gets the ID of the channel where randomized welcome messages are sent.
///
///
- /// A representing the snowflake identifier of the system channel where randomized
- /// welcome messages are sent; null if none is set.
+ /// A representing the snowflake identifier of the system channel where randomized
+ /// welcome messages are sent; if none is set.
///
ulong? SystemChannelId { get; }
///
+ /// Gets the ID of the channel with the rules.
+ ///
+ ///
+ /// A representing the snowflake identifier of the channel that contains the rules;
+ /// if none is set.
+ ///
+ ulong? RulesChannelId { get; }
+ ///
+ /// Gets the ID of the channel where admins and moderators of Community guilds receive notices from Discord.
+ ///
+ ///
+ /// A representing the snowflake identifier of the channel where admins and moderators
+ /// of Community guilds receive notices from Discord; if none is set.
+ ///
+ ulong? PublicUpdatesChannelId { get; }
+ ///
/// Gets the ID of the user that owns this guild.
///
///
- /// A representing the snowflake identifier of the user that owns this guild.
+ /// A representing the snowflake identifier of the user that owns this guild.
///
ulong OwnerId { get; }
///
/// Gets the application ID of the guild creator if it is bot-created.
///
///
- /// A representing the snowflake identifier of the application ID that created this guild, or null if it was not bot-created.
+ /// A representing the snowflake identifier of the application ID that created this guild, or if it was not bot-created.
///
ulong? ApplicationId { get; }
///
@@ -208,21 +253,21 @@ namespace Discord
/// Gets the identifier for this guilds banner image.
///
///
- /// An identifier for the banner image; null if none is set.
+ /// An identifier for the banner image; if none is set.
///
string BannerId { get; }
///
/// Gets the URL of this guild's banner image.
///
///
- /// A URL pointing to the guild's banner image; null if none is set.
+ /// A URL pointing to the guild's banner image; if none is set.
///
string BannerUrl { get; }
///
/// Gets the code for this guild's vanity invite URL.
///
///
- /// A string containing the vanity invite code for this guild; null if none is set.
+ /// A string containing the vanity invite code for this guild; if none is set.
///
string VanityURLCode { get; }
///
@@ -236,7 +281,7 @@ namespace Discord
/// Gets the description for the guild.
///
///
- /// The description for the guild; null if none is set.
+ /// The description for the guild; if none is set.
///
string Description { get; }
///
@@ -246,9 +291,50 @@ namespace Discord
/// This is the number of users who have boosted this guild.
///
///
- /// The number of premium subscribers of this guild.
+ /// The number of premium subscribers of this guild; if not available.
///
int PremiumSubscriptionCount { get; }
+ ///
+ /// Gets the maximum number of presences for the guild.
+ ///
+ ///
+ /// The maximum number of presences for the guild.
+ ///
+ int? MaxPresences { get; }
+ ///
+ /// Gets the maximum number of members for the guild.
+ ///
+ ///
+ /// The maximum number of members for the guild.
+ ///
+ int? MaxMembers { get; }
+ ///
+ /// Gets the maximum amount of users in a video channel.
+ ///
+ ///
+ /// The maximum amount of users in a video channel.
+ ///
+ int? MaxVideoChannelUsers { get; }
+ ///
+ /// Gets the approximate number of members in this guild.
+ ///
+ ///
+ /// Only available when getting a guild via REST when `with_counts` is true.
+ ///
+ ///
+ /// The approximate number of members in this guild.
+ ///
+ int? ApproximateMemberCount { get; }
+ ///
+ /// Gets the approximate number of non-offline members in this guild.
+ ///
+ ///
+ /// Only available when getting a guild via REST when `with_counts` is true.
+ ///
+ ///
+ /// The approximate number of non-offline members in this guild.
+ ///
+ int? ApproximatePresenceCount { get; }
///
/// Gets the preferred locale of this guild in IETF BCP 47
@@ -285,8 +371,18 @@ namespace Discord
///
/// A task that represents the asynchronous modification operation.
///
+ [Obsolete("This endpoint is deprecated, use ModifyWidgetAsync instead.")]
Task ModifyEmbedAsync(Action func, RequestOptions options = null);
///
+ /// Modifies this guild's widget.
+ ///
+ /// The delegate containing the properties to modify the guild widget with.
+ /// The options to be used when sending the request.
+ ///
+ /// A task that represents the asynchronous modification operation.
+ ///
+ Task ModifyWidgetAsync(Action func, RequestOptions options = null);
+ ///
/// Bulk-modifies the order of channels in this guild.
///
/// The properties used to modify the channel positions with.
@@ -336,7 +432,7 @@ namespace Discord
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains a ban object, which
- /// contains the user information and the reason for the ban; null if the ban entry cannot be found.
+ /// contains the user information and the reason for the ban; if the ban entry cannot be found.
///
Task GetBanAsync(IUser user, RequestOptions options = null);
///
@@ -346,7 +442,7 @@ namespace Discord
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains a ban object, which
- /// contains the user information and the reason for the ban; null if the ban entry cannot be found.
+ /// contains the user information and the reason for the ban; if the ban entry cannot be found.
///
Task GetBanAsync(ulong userId, RequestOptions options = null);
///
@@ -410,7 +506,7 @@ namespace Discord
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the generic channel
- /// associated with the specified ; null if none is found.
+ /// associated with the specified ; if none is found.
///
Task GetChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
@@ -431,7 +527,7 @@ namespace Discord
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the text channel
- /// associated with the specified ; null if none is found.
+ /// associated with the specified ; if none is found.
///
Task GetTextChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
@@ -462,7 +558,7 @@ namespace Discord
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the voice channel associated
- /// with the specified ; null if none is found.
+ /// with the specified ; if none is found.
///
Task GetVoiceChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
@@ -472,7 +568,7 @@ namespace Discord
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the voice channel that the
- /// AFK users will be moved to after they have idled for too long; null if none is set.
+ /// AFK users will be moved to after they have idled for too long; if none is set.
///
Task GetAFKChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
@@ -482,7 +578,7 @@ namespace Discord
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the text channel where
- /// randomized welcome messages will be sent to; null if none is set.
+ /// randomized welcome messages will be sent to; if none is set.
///
Task GetSystemChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
@@ -492,7 +588,7 @@ namespace Discord
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the first viewable text
- /// channel in this guild; null if none is found.
+ /// channel in this guild; if none is found.
///
Task GetDefaultChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
@@ -502,9 +598,40 @@ namespace Discord
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the embed channel set
- /// within the server's widget settings; null if none is set.
+ /// within the server's widget settings; if none is set.
///
+ [Obsolete("This endpoint is deprecated, use GetWidgetChannelAsync instead.")]
Task GetEmbedChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
+ ///
+ /// Gets the widget channel (i.e. the channel set in the guild's widget settings) in this guild.
+ ///
+ /// The that determines whether the object should be fetched from cache.
+ /// The options to be used when sending the request.
+ ///
+ /// A task that represents the asynchronous get operation. The task result contains the widget channel set
+ /// within the server's widget settings; if none is set.
+ ///
+ Task GetWidgetChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
+ ///
+ /// Gets the text channel where Community guilds can display rules and/or guidelines.
+ ///
+ /// The that determines whether the object should be fetched from cache.
+ /// The options to be used when sending the request.
+ ///
+ /// A task that represents the asynchronous get operation. The task result contains the text channel
+ /// where Community guilds can display rules and/or guidelines; if none is set.
+ ///
+ Task GetRulesChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
+ ///
+ /// Gets the text channel channel where admins and moderators of Community guilds receive notices from Discord.
+ ///
+ /// The that determines whether the object should be fetched from cache.
+ /// The options to be used when sending the request.
+ ///
+ /// A task that represents the asynchronous get operation. The task result contains the text channel channel where
+ /// admins and moderators of Community guilds receive notices from Discord; if none is set.
+ ///
+ Task GetPublicUpdatesChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
/// Creates a new text channel in this guild.
@@ -573,7 +700,7 @@ namespace Discord
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the partial metadata of
- /// the vanity invite found within this guild; null if none is found.
+ /// the vanity invite found within this guild; if none is found.
///
Task GetVanityInviteAsync(RequestOptions options = null);
@@ -582,7 +709,7 @@ namespace Discord
///
/// The snowflake identifier for the role.
///
- /// A role that is associated with the specified ; null if none is found.
+ /// A role that is associated with the specified ; if none is found.
///
IRole GetRole(ulong id);
///
@@ -624,7 +751,7 @@ namespace Discord
/// The OAuth2 access token for the user, requested with the guilds.join scope.
/// The delegate containing the properties to be applied to the user upon being added to the guild.
/// The options to be used when sending the request.
- /// A guild user associated with the specified ; null if the user is already in the guild.
+ /// A guild user associated with the specified ; if the user is already in the guild.
Task AddGuildUserAsync(ulong userId, string accessToken, Action func = null, RequestOptions options = null);
///
/// Gets a collection of all users in this guild.
@@ -649,7 +776,7 @@ namespace Discord
///
/// This method retrieves a user found within this guild.
///
- /// This may return null in the WebSocket implementation due to incomplete user collection in
+ /// This may return in the WebSocket implementation due to incomplete user collection in
/// large guilds.
///
///
@@ -658,7 +785,7 @@ namespace Discord
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the guild user
- /// associated with the specified ; null if none is found.
+ /// associated with the specified ; if none is found.
///
Task GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
@@ -705,11 +832,12 @@ namespace Discord
/// The number of days required for the users to be kicked.
/// Whether this prune action is a simulation.
/// The options to be used when sending the request.
+ /// An array of role IDs to be included in the prune of users who do not have any additional roles.
///
/// A task that represents the asynchronous prune operation. The task result contains the number of users to
/// be or has been removed from this guild.
///
- Task PruneUsersAsync(int days = 30, bool simulate = false, RequestOptions options = null);
+ Task PruneUsersAsync(int days = 30, bool simulate = false, RequestOptions options = null, IEnumerable includeRoleIds = null);
///
/// Gets a collection of users in this guild that the name or nickname starts with the
/// provided at .
@@ -751,7 +879,7 @@ namespace Discord
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the webhook with the
- /// specified ; null if none is found.
+ /// specified ; if none is found.
///
Task GetWebhookAsync(ulong id, RequestOptions options = null);
///
@@ -771,7 +899,7 @@ namespace Discord
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the emote found with the
- /// specified ; null if none is found.
+ /// specified ; if none is found.
///
Task GetEmoteAsync(ulong id, RequestOptions options = null);
///
diff --git a/src/Discord.Net.Core/Entities/IApplication.cs b/src/Discord.Net.Core/Entities/IApplication.cs
index 78a87dc19..2174baff9 100644
--- a/src/Discord.Net.Core/Entities/IApplication.cs
+++ b/src/Discord.Net.Core/Entities/IApplication.cs
@@ -22,6 +22,18 @@ namespace Discord
/// Gets the icon URL of the application.
///
string IconUrl { get; }
+ ///
+ /// Gets if the bot is public.
+ ///
+ bool IsBotPublic { get; }
+ ///
+ /// Gets if the bot requires code grant.
+ ///
+ bool BotRequiresCodeGrant { get; }
+ ///
+ /// Gets the team associated with this application if there is one.
+ ///
+ ITeam Team { get; }
///
/// Gets the partial user object containing info on the owner of the application.
diff --git a/src/Discord.Net.Core/Entities/IUpdateable.cs b/src/Discord.Net.Core/Entities/IUpdateable.cs
index 3ae4613f5..d561e57a6 100644
--- a/src/Discord.Net.Core/Entities/IUpdateable.cs
+++ b/src/Discord.Net.Core/Entities/IUpdateable.cs
@@ -10,6 +10,7 @@ namespace Discord
///
/// Updates this object's properties with its current state.
///
+ /// The options to be used when sending the request.
Task UpdateAsync(RequestOptions options = null);
}
}
diff --git a/src/Discord.Net.Core/Entities/Invites/TargetUserType.cs b/src/Discord.Net.Core/Entities/Invites/TargetUserType.cs
new file mode 100644
index 000000000..74263b888
--- /dev/null
+++ b/src/Discord.Net.Core/Entities/Invites/TargetUserType.cs
@@ -0,0 +1,14 @@
+namespace Discord
+{
+ public enum TargetUserType
+ {
+ ///
+ /// The invite whose target user type is not defined.
+ ///
+ Undefined = 0,
+ ///
+ /// The invite is for a Go Live stream.
+ ///
+ Stream = 1
+ }
+}
diff --git a/src/Discord.Net.Core/Entities/Messages/IMessage.cs b/src/Discord.Net.Core/Entities/Messages/IMessage.cs
index 530c1cd82..b74e333c1 100644
--- a/src/Discord.Net.Core/Entities/Messages/IMessage.cs
+++ b/src/Discord.Net.Core/Entities/Messages/IMessage.cs
@@ -39,6 +39,13 @@ namespace Discord
///
bool IsSuppressed { get; }
///
+ /// Gets the value that indicates whether this message mentioned everyone.
+ ///
+ ///
+ /// true if this message mentioned everyone; otherwise false.
+ ///
+ bool MentionedEveryone { get; }
+ ///
/// Gets the content for this message.
///
///
diff --git a/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs b/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs
index 99885b070..ed675b5f3 100644
--- a/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs
+++ b/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs
@@ -17,7 +17,7 @@ namespace Discord
/// Gets a that grants all permissions for category channels.
public static readonly ChannelPermissions Category = new ChannelPermissions(0b01100_1111110_1111111110001_010001);
/// Gets a that grants all permissions for direct message channels.
- public static readonly ChannelPermissions DM = new ChannelPermissions(0b00000_1000110_1011100110000_000000);
+ public static readonly ChannelPermissions DM = new ChannelPermissions(0b00000_1000110_1011100110001_000000);
/// Gets a that grants all permissions for group channels.
public static readonly ChannelPermissions Group = new ChannelPermissions(0b00000_1000110_0001101100000_000000);
/// Gets a that grants all permissions for a given channel type.
diff --git a/src/Discord.Net.Core/Entities/Permissions/GuildPermission.cs b/src/Discord.Net.Core/Entities/Permissions/GuildPermission.cs
index 3c8a5e810..645b67489 100644
--- a/src/Discord.Net.Core/Entities/Permissions/GuildPermission.cs
+++ b/src/Discord.Net.Core/Entities/Permissions/GuildPermission.cs
@@ -51,6 +51,10 @@ namespace Discord
/// authentication when used on a guild that has server-wide 2FA enabled.
///
ManageGuild = 0x00_00_00_20,
+ ///
+ /// Allows for viewing of guild insights
+ ///
+ ViewGuildInsights = 0x00_08_00_00,
// Text
///
diff --git a/src/Discord.Net.Core/Entities/Permissions/GuildPermissions.cs b/src/Discord.Net.Core/Entities/Permissions/GuildPermissions.cs
index a5adad47c..ba6757fc6 100644
--- a/src/Discord.Net.Core/Entities/Permissions/GuildPermissions.cs
+++ b/src/Discord.Net.Core/Entities/Permissions/GuildPermissions.cs
@@ -12,7 +12,7 @@ namespace Discord
/// Gets a that grants all guild permissions for webhook users.
public static readonly GuildPermissions Webhook = new GuildPermissions(0b00000_0000000_0001101100000_000000);
/// Gets a that grants all guild permissions.
- public static readonly GuildPermissions All = new GuildPermissions(0b11111_1111110_1111111111111_111111);
+ public static readonly GuildPermissions All = new GuildPermissions(0b11111_1111111_1111111111111_111111);
/// Gets a packed value representing all the permissions in this .
public ulong RawValue { get; }
@@ -34,6 +34,8 @@ namespace Discord
public bool AddReactions => Permissions.GetValue(RawValue, GuildPermission.AddReactions);
/// If true, a user may view the audit log.
public bool ViewAuditLog => Permissions.GetValue(RawValue, GuildPermission.ViewAuditLog);
+ /// If true, a user may view the guild insights.
+ public bool ViewGuildInsights => Permissions.GetValue(RawValue, GuildPermission.ViewGuildInsights);
/// If True, a user may join channels.
[Obsolete("Use ViewChannel instead.")]
@@ -97,6 +99,7 @@ namespace Discord
bool? manageGuild = null,
bool? addReactions = null,
bool? viewAuditLog = null,
+ bool? viewGuildInsights = null,
bool? viewChannel = null,
bool? sendMessages = null,
bool? sendTTSMessages = null,
@@ -130,6 +133,7 @@ namespace Discord
Permissions.SetValue(ref value, manageGuild, GuildPermission.ManageGuild);
Permissions.SetValue(ref value, addReactions, GuildPermission.AddReactions);
Permissions.SetValue(ref value, viewAuditLog, GuildPermission.ViewAuditLog);
+ Permissions.SetValue(ref value, viewGuildInsights, GuildPermission.ViewGuildInsights);
Permissions.SetValue(ref value, viewChannel, GuildPermission.ViewChannel);
Permissions.SetValue(ref value, sendMessages, GuildPermission.SendMessages);
Permissions.SetValue(ref value, sendTTSMessages, GuildPermission.SendTTSMessages);
@@ -166,6 +170,7 @@ namespace Discord
bool manageGuild = false,
bool addReactions = false,
bool viewAuditLog = false,
+ bool viewGuildInsights = false,
bool viewChannel = false,
bool sendMessages = false,
bool sendTTSMessages = false,
@@ -198,6 +203,7 @@ namespace Discord
manageGuild: manageGuild,
addReactions: addReactions,
viewAuditLog: viewAuditLog,
+ viewGuildInsights: viewGuildInsights,
viewChannel: viewChannel,
sendMessages: sendMessages,
sendTTSMessages: sendTTSMessages,
@@ -231,6 +237,7 @@ namespace Discord
bool? manageGuild = null,
bool? addReactions = null,
bool? viewAuditLog = null,
+ bool? viewGuildInsights = null,
bool? viewChannel = null,
bool? sendMessages = null,
bool? sendTTSMessages = null,
@@ -254,7 +261,7 @@ namespace Discord
bool? manageWebhooks = null,
bool? manageEmojis = null)
=> new GuildPermissions(RawValue, createInstantInvite, kickMembers, banMembers, administrator, manageChannels, manageGuild, addReactions,
- viewAuditLog, viewChannel, sendMessages, sendTTSMessages, manageMessages, embedLinks, attachFiles,
+ viewAuditLog, viewGuildInsights, viewChannel, sendMessages, sendTTSMessages, manageMessages, embedLinks, attachFiles,
readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers, moveMembers,
useVoiceActivation, prioritySpeaker, stream, changeNickname, manageNicknames, manageRoles, manageWebhooks, manageEmojis);
diff --git a/src/Discord.Net.Core/Entities/Permissions/OverwritePermissions.cs b/src/Discord.Net.Core/Entities/Permissions/OverwritePermissions.cs
index 04bb2f668..7876d49ff 100644
--- a/src/Discord.Net.Core/Entities/Permissions/OverwritePermissions.cs
+++ b/src/Discord.Net.Core/Entities/Permissions/OverwritePermissions.cs
@@ -76,6 +76,10 @@ namespace Discord
public PermValue MoveMembers => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.MoveMembers);
/// If Allowed, a user may use voice-activity-detection rather than push-to-talk.
public PermValue UseVAD => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.UseVAD);
+ /// If Allowed, a user may use priority speaker in a voice channel.
+ public PermValue PrioritySpeaker => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.PrioritySpeaker);
+ /// If Allowed, a user may go live in a voice channel.
+ public PermValue Stream => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.Stream);
/// If Allowed, a user may adjust role permissions. This also implicitly grants all other permissions.
public PermValue ManageRoles => Permissions.GetValue(AllowValue, DenyValue, ChannelPermission.ManageRoles);
@@ -109,7 +113,9 @@ namespace Discord
PermValue? moveMembers = null,
PermValue? useVoiceActivation = null,
PermValue? manageRoles = null,
- PermValue? manageWebhooks = null)
+ PermValue? manageWebhooks = null,
+ PermValue? prioritySpeaker = null,
+ PermValue? stream = null)
{
Permissions.SetValue(ref allowValue, ref denyValue, createInstantInvite, ChannelPermission.CreateInstantInvite);
Permissions.SetValue(ref allowValue, ref denyValue, manageChannel, ChannelPermission.ManageChannels);
@@ -129,6 +135,8 @@ namespace Discord
Permissions.SetValue(ref allowValue, ref denyValue, deafenMembers, ChannelPermission.DeafenMembers);
Permissions.SetValue(ref allowValue, ref denyValue, moveMembers, ChannelPermission.MoveMembers);
Permissions.SetValue(ref allowValue, ref denyValue, useVoiceActivation, ChannelPermission.UseVAD);
+ Permissions.SetValue(ref allowValue, ref denyValue, prioritySpeaker, ChannelPermission.PrioritySpeaker);
+ Permissions.SetValue(ref allowValue, ref denyValue, stream, ChannelPermission.Stream);
Permissions.SetValue(ref allowValue, ref denyValue, manageRoles, ChannelPermission.ManageRoles);
Permissions.SetValue(ref allowValue, ref denyValue, manageWebhooks, ChannelPermission.ManageWebhooks);
@@ -159,10 +167,12 @@ namespace Discord
PermValue moveMembers = PermValue.Inherit,
PermValue useVoiceActivation = PermValue.Inherit,
PermValue manageRoles = PermValue.Inherit,
- PermValue manageWebhooks = PermValue.Inherit)
+ PermValue manageWebhooks = PermValue.Inherit,
+ PermValue prioritySpeaker = PermValue.Inherit,
+ PermValue stream = PermValue.Inherit)
: this(0, 0, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages,
embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers,
- moveMembers, useVoiceActivation, manageRoles, manageWebhooks) { }
+ moveMembers, useVoiceActivation, manageRoles, manageWebhooks, prioritySpeaker, stream) { }
///
/// Initializes a new from the current one, changing the provided
@@ -188,10 +198,12 @@ namespace Discord
PermValue? moveMembers = null,
PermValue? useVoiceActivation = null,
PermValue? manageRoles = null,
- PermValue? manageWebhooks = null)
+ PermValue? manageWebhooks = null,
+ PermValue? prioritySpeaker = null,
+ PermValue? stream = null)
=> new OverwritePermissions(AllowValue, DenyValue, createInstantInvite, manageChannel, addReactions, viewChannel, sendMessages, sendTTSMessages, manageMessages,
embedLinks, attachFiles, readMessageHistory, mentionEveryone, useExternalEmojis, connect, speak, muteMembers, deafenMembers,
- moveMembers, useVoiceActivation, manageRoles, manageWebhooks);
+ moveMembers, useVoiceActivation, manageRoles, manageWebhooks, prioritySpeaker, stream);
///
/// Creates a of all the values that are allowed.
diff --git a/src/Discord.Net.Core/Entities/Teams/ITeam.cs b/src/Discord.Net.Core/Entities/Teams/ITeam.cs
new file mode 100644
index 000000000..5ef3e4253
--- /dev/null
+++ b/src/Discord.Net.Core/Entities/Teams/ITeam.cs
@@ -0,0 +1,27 @@
+using System.Collections.Generic;
+
+namespace Discord
+{
+ ///
+ /// Represents a Discord Team.
+ ///
+ public interface ITeam
+ {
+ ///
+ /// Gets the team icon url.
+ ///
+ string IconUrl { get; }
+ ///
+ /// Gets the team unique identifier.
+ ///
+ ulong Id { get; }
+ ///
+ /// Gets the members of this team.
+ ///
+ IReadOnlyList TeamMembers { get; }
+ ///
+ /// Gets the user identifier that owns this team.
+ ///
+ ulong OwnerUserId { get; }
+ }
+}
diff --git a/src/Discord.Net.Core/Entities/Teams/ITeamMember.cs b/src/Discord.Net.Core/Entities/Teams/ITeamMember.cs
new file mode 100644
index 000000000..fe0e499e5
--- /dev/null
+++ b/src/Discord.Net.Core/Entities/Teams/ITeamMember.cs
@@ -0,0 +1,25 @@
+namespace Discord
+{
+ ///
+ /// Represents a Discord Team member.
+ ///
+ public interface ITeamMember
+ {
+ ///
+ /// Gets the membership state of this team member.
+ ///
+ MembershipState MembershipState { get; }
+ ///
+ /// Gets the permissions of this team member.
+ ///
+ string[] Permissions { get; }
+ ///
+ /// Gets the team unique identifier for this team member.
+ ///
+ ulong TeamId { get; }
+ ///
+ /// Gets the Discord user of this team member.
+ ///
+ IUser User { get; }
+ }
+}
diff --git a/src/Discord.Net.Core/Entities/Teams/MembershipState.cs b/src/Discord.Net.Core/Entities/Teams/MembershipState.cs
new file mode 100644
index 000000000..45b1693b0
--- /dev/null
+++ b/src/Discord.Net.Core/Entities/Teams/MembershipState.cs
@@ -0,0 +1,11 @@
+namespace Discord
+{
+ ///
+ /// Represents the membership state of a team member.
+ ///
+ public enum MembershipState
+ {
+ Invited,
+ Accepted,
+ }
+}
diff --git a/src/Discord.Net.Core/Extensions/MessageExtensions.cs b/src/Discord.Net.Core/Extensions/MessageExtensions.cs
index 64a1d89ab..e44e397fa 100644
--- a/src/Discord.Net.Core/Extensions/MessageExtensions.cs
+++ b/src/Discord.Net.Core/Extensions/MessageExtensions.cs
@@ -17,7 +17,7 @@ namespace Discord
public static string GetJumpUrl(this IMessage msg)
{
var channel = msg.Channel;
- return $"https://discordapp.com/channels/{(channel is IDMChannel ? "@me" : $"{(channel as ITextChannel).GuildId}")}/{channel.Id}/{msg.Id}";
+ return $"https://discord.com/channels/{(channel is IDMChannel ? "@me" : $"{(channel as ITextChannel).GuildId}")}/{channel.Id}/{msg.Id}";
}
///
diff --git a/src/Discord.Net.Core/Net/HttpException.cs b/src/Discord.Net.Core/Net/HttpException.cs
index d36bd66f9..ff9cf91f2 100644
--- a/src/Discord.Net.Core/Net/HttpException.cs
+++ b/src/Discord.Net.Core/Net/HttpException.cs
@@ -13,7 +13,7 @@ namespace Discord.Net
///
///
/// An
- /// HTTP status code
+ /// HTTP status code
/// from Discord.
///
public HttpStatusCode HttpCode { get; }
@@ -22,7 +22,7 @@ namespace Discord.Net
///
///
/// A
- /// JSON error code
+ /// JSON error code
/// from Discord, or null if none.
///
public int? DiscordCode { get; }
diff --git a/src/Discord.Net.Core/Net/WebSocketClosedException.cs b/src/Discord.Net.Core/Net/WebSocketClosedException.cs
index 6e2564f6e..c743cd696 100644
--- a/src/Discord.Net.Core/Net/WebSocketClosedException.cs
+++ b/src/Discord.Net.Core/Net/WebSocketClosedException.cs
@@ -11,7 +11,7 @@ namespace Discord.Net
///
///
/// A
- /// close code
+ /// close code
/// from Discord.
///
public int CloseCode { get; }
diff --git a/src/Discord.Net.Rest/API/Common/Application.cs b/src/Discord.Net.Rest/API/Common/Application.cs
index ca4c443f1..aba3e524b 100644
--- a/src/Discord.Net.Rest/API/Common/Application.cs
+++ b/src/Discord.Net.Rest/API/Common/Application.cs
@@ -1,4 +1,4 @@
-#pragma warning disable CS1591
+#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API
@@ -15,6 +15,12 @@ namespace Discord.API
public ulong Id { get; set; }
[JsonProperty("icon")]
public string Icon { get; set; }
+ [JsonProperty("bot_public")]
+ public bool IsBotPublic { get; set; }
+ [JsonProperty("bot_require_code_grant")]
+ public bool BotRequiresCodeGrant { get; set; }
+ [JsonProperty("team")]
+ public Team Team { get; set; }
[JsonProperty("flags"), Int53]
public Optional Flags { get; set; }
diff --git a/src/Discord.Net.Rest/API/Common/Guild.cs b/src/Discord.Net.Rest/API/Common/Guild.cs
index 56bd841ea..414929a7b 100644
--- a/src/Discord.Net.Rest/API/Common/Guild.cs
+++ b/src/Discord.Net.Rest/API/Common/Guild.cs
@@ -13,6 +13,8 @@ namespace Discord.API
public string Icon { get; set; }
[JsonProperty("splash")]
public string Splash { get; set; }
+ [JsonProperty("discovery_splash")]
+ public string DiscoverySplash { get; set; }
[JsonProperty("owner_id")]
public ulong OwnerId { get; set; }
[JsonProperty("region")]
@@ -22,9 +24,9 @@ namespace Discord.API
[JsonProperty("afk_timeout")]
public int AFKTimeout { get; set; }
[JsonProperty("embed_enabled")]
- public bool EmbedEnabled { get; set; }
+ public Optional EmbedEnabled { get; set; }
[JsonProperty("embed_channel_id")]
- public ulong? EmbedChannelId { get; set; }
+ public Optional EmbedChannelId { get; set; }
[JsonProperty("verification_level")]
public VerificationLevel VerificationLevel { get; set; }
[JsonProperty("default_message_notifications")]
@@ -43,6 +45,10 @@ namespace Discord.API
public MfaLevel MfaLevel { get; set; }
[JsonProperty("application_id")]
public ulong? ApplicationId { get; set; }
+ [JsonProperty("widget_enabled")]
+ public Optional WidgetEnabled { get; set; }
+ [JsonProperty("widget_channel_id")]
+ public Optional WidgetChannelId { get; set; }
[JsonProperty("system_channel_id")]
public ulong? SystemChannelId { get; set; }
[JsonProperty("premium_tier")]
@@ -56,9 +62,23 @@ namespace Discord.API
// this value is inverted, flags set will turn OFF features
[JsonProperty("system_channel_flags")]
public SystemChannelMessageDeny SystemChannelFlags { get; set; }
+ [JsonProperty("rules_channel_id")]
+ public ulong? RulesChannelId { get; set; }
+ [JsonProperty("max_presences")]
+ public Optional MaxPresences { get; set; }
+ [JsonProperty("max_members")]
+ public Optional MaxMembers { get; set; }
[JsonProperty("premium_subscription_count")]
- public int? PremiumSubscriptionCount { get; set; }
+ public Optional PremiumSubscriptionCount { get; set; }
[JsonProperty("preferred_locale")]
public string PreferredLocale { get; set; }
+ [JsonProperty("public_updates_channel_id")]
+ public ulong? PublicUpdatesChannelId { get; set; }
+ [JsonProperty("max_video_channel_users")]
+ public Optional MaxVideoChannelUsers { get; set; }
+ [JsonProperty("approximate_member_count")]
+ public Optional ApproximateMemberCount { get; set; }
+ [JsonProperty("approximate_presence_count")]
+ public Optional ApproximatePresenceCount { get; set; }
}
}
diff --git a/src/Discord.Net.Rest/API/Common/GuildEmbed.cs b/src/Discord.Net.Rest/API/Common/GuildEmbed.cs
index ff8b8e180..d81632181 100644
--- a/src/Discord.Net.Rest/API/Common/GuildEmbed.cs
+++ b/src/Discord.Net.Rest/API/Common/GuildEmbed.cs
@@ -1,4 +1,4 @@
-#pragma warning disable CS1591
+#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API
@@ -8,6 +8,6 @@ namespace Discord.API
[JsonProperty("enabled")]
public bool Enabled { get; set; }
[JsonProperty("channel_id")]
- public ulong ChannelId { get; set; }
+ public ulong? ChannelId { get; set; }
}
}
diff --git a/src/Discord.Net.Rest/API/Common/GuildWidget.cs b/src/Discord.Net.Rest/API/Common/GuildWidget.cs
new file mode 100644
index 000000000..c15ad8aac
--- /dev/null
+++ b/src/Discord.Net.Rest/API/Common/GuildWidget.cs
@@ -0,0 +1,13 @@
+#pragma warning disable CS1591
+using Newtonsoft.Json;
+
+namespace Discord.API
+{
+ internal class GuildWidget
+ {
+ [JsonProperty("enabled")]
+ public bool Enabled { get; set; }
+ [JsonProperty("channel_id")]
+ public ulong? ChannelId { get; set; }
+ }
+}
diff --git a/src/Discord.Net.Rest/API/Common/MembershipState.cs b/src/Discord.Net.Rest/API/Common/MembershipState.cs
new file mode 100644
index 000000000..67fcc8908
--- /dev/null
+++ b/src/Discord.Net.Rest/API/Common/MembershipState.cs
@@ -0,0 +1,9 @@
+namespace Discord.API
+{
+ internal enum MembershipState
+ {
+ None = 0,
+ Invited = 1,
+ Accepted = 2,
+ }
+}
diff --git a/src/Discord.Net.Rest/API/Common/Team.cs b/src/Discord.Net.Rest/API/Common/Team.cs
new file mode 100644
index 000000000..4910f43f7
--- /dev/null
+++ b/src/Discord.Net.Rest/API/Common/Team.cs
@@ -0,0 +1,17 @@
+#pragma warning disable CS1591
+using Newtonsoft.Json;
+
+namespace Discord.API
+{
+ internal class Team
+ {
+ [JsonProperty("icon")]
+ public Optional Icon { get; set; }
+ [JsonProperty("id")]
+ public ulong Id { get; set; }
+ [JsonProperty("members")]
+ public TeamMember[] TeamMembers { get; set; }
+ [JsonProperty("owner_user_id")]
+ public ulong OwnerUserId { get; set; }
+ }
+}
diff --git a/src/Discord.Net.Rest/API/Common/TeamMember.cs b/src/Discord.Net.Rest/API/Common/TeamMember.cs
new file mode 100644
index 000000000..788f73b61
--- /dev/null
+++ b/src/Discord.Net.Rest/API/Common/TeamMember.cs
@@ -0,0 +1,17 @@
+#pragma warning disable CS1591
+using Newtonsoft.Json;
+
+namespace Discord.API
+{
+ internal class TeamMember
+ {
+ [JsonProperty("membership_state")]
+ public MembershipState MembershipState { get; set; }
+ [JsonProperty("permissions")]
+ public string[] Permissions { get; set; }
+ [JsonProperty("team_id")]
+ public ulong TeamId { get; set; }
+ [JsonProperty("user")]
+ public User User { get; set; }
+ }
+}
diff --git a/src/Discord.Net.Rest/API/Rest/CreateWebhookMessageParams.cs b/src/Discord.Net.Rest/API/Rest/CreateWebhookMessageParams.cs
index 970a30201..0a4f80a3c 100644
--- a/src/Discord.Net.Rest/API/Rest/CreateWebhookMessageParams.cs
+++ b/src/Discord.Net.Rest/API/Rest/CreateWebhookMessageParams.cs
@@ -1,4 +1,4 @@
-#pragma warning disable CS1591
+#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API.Rest
@@ -19,6 +19,8 @@ namespace Discord.API.Rest
public Optional Username { get; set; }
[JsonProperty("avatar_url")]
public Optional AvatarUrl { get; set; }
+ [JsonProperty("allowed_mentions")]
+ public Optional AllowedMentions { get; set; }
public CreateWebhookMessageParams(string content)
{
diff --git a/src/Discord.Net.Rest/API/Rest/GuildPruneParams.cs b/src/Discord.Net.Rest/API/Rest/GuildPruneParams.cs
index 6a98d3758..e4c9192ad 100644
--- a/src/Discord.Net.Rest/API/Rest/GuildPruneParams.cs
+++ b/src/Discord.Net.Rest/API/Rest/GuildPruneParams.cs
@@ -9,9 +9,13 @@ namespace Discord.API.Rest
[JsonProperty("days")]
public int Days { get; }
- public GuildPruneParams(int days)
+ [JsonProperty("include_roles")]
+ public ulong[] IncludeRoleIds { get; }
+
+ public GuildPruneParams(int days, ulong[] includeRoleIds)
{
Days = days;
+ IncludeRoleIds = includeRoleIds;
}
}
}
diff --git a/src/Discord.Net.Rest/API/Rest/ModifyGuildWidgetParams.cs b/src/Discord.Net.Rest/API/Rest/ModifyGuildWidgetParams.cs
new file mode 100644
index 000000000..506f1dfbb
--- /dev/null
+++ b/src/Discord.Net.Rest/API/Rest/ModifyGuildWidgetParams.cs
@@ -0,0 +1,14 @@
+#pragma warning disable CS1591
+using Newtonsoft.Json;
+
+namespace Discord.API.Rest
+{
+ [JsonObject(MemberSerialization = MemberSerialization.OptIn)]
+ internal class ModifyGuildWidgetParams
+ {
+ [JsonProperty("enabled")]
+ public Optional Enabled { get; set; }
+ [JsonProperty("channel")]
+ public Optional ChannelId { get; set; }
+ }
+}
diff --git a/src/Discord.Net.Rest/API/Rest/UploadWebhookFileParams.cs b/src/Discord.Net.Rest/API/Rest/UploadWebhookFileParams.cs
index 26153c21b..8da7681ae 100644
--- a/src/Discord.Net.Rest/API/Rest/UploadWebhookFileParams.cs
+++ b/src/Discord.Net.Rest/API/Rest/UploadWebhookFileParams.cs
@@ -21,6 +21,7 @@ namespace Discord.API.Rest
public Optional Username { get; set; }
public Optional AvatarUrl { get; set; }
public Optional
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
- public class RestNewsChannel : RestTextChannel
+ public class RestNewsChannel : RestTextChannel, INewsChannel
{
internal RestNewsChannel(BaseDiscordClient discord, IGuild guild, ulong id)
:base(discord, guild, id)
diff --git a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
index ccc02466e..04ec27930 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
@@ -5,6 +5,7 @@ using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
using EmbedModel = Discord.API.GuildEmbed;
+using WidgetModel = Discord.API.GuildWidget;
using Model = Discord.API.Guild;
using RoleModel = Discord.API.Role;
using ImageModel = Discord.API.Image;
@@ -99,6 +100,27 @@ namespace Discord.Rest
return await client.ApiClient.ModifyGuildEmbedAsync(guild.Id, apiArgs, options).ConfigureAwait(false);
}
+ /// is null.
+ public static async Task ModifyWidgetAsync(IGuild guild, BaseDiscordClient client,
+ Action func, RequestOptions options)
+ {
+ if (func == null)
+ throw new ArgumentNullException(nameof(func));
+
+ var args = new GuildWidgetProperties();
+ func(args);
+ var apiArgs = new API.Rest.ModifyGuildWidgetParams
+ {
+ Enabled = args.Enabled
+ };
+
+ if (args.Channel.IsSpecified)
+ apiArgs.ChannelId = args.Channel.Value?.Id;
+ else if (args.ChannelId.IsSpecified)
+ apiArgs.ChannelId = args.ChannelId.Value;
+
+ return await client.ApiClient.ModifyGuildWidgetAsync(guild.Id, apiArgs, options).ConfigureAwait(false);
+ }
public static async Task ReorderChannelsAsync(IGuild guild, BaseDiscordClient client,
IEnumerable args, RequestOptions options)
{
@@ -132,7 +154,7 @@ namespace Discord.Rest
public static async Task GetBanAsync(IGuild guild, BaseDiscordClient client, ulong userId, RequestOptions options)
{
var model = await client.ApiClient.GetGuildBanAsync(guild.Id, userId, options).ConfigureAwait(false);
- return RestBan.Create(client, model);
+ return model == null ? null : RestBan.Create(client, model);
}
public static async Task AddBanAsync(IGuild guild, BaseDiscordClient client,
@@ -404,9 +426,9 @@ namespace Discord.Rest
);
}
public static async Task PruneUsersAsync(IGuild guild, BaseDiscordClient client,
- int days, bool simulate, RequestOptions options)
+ int days, bool simulate, RequestOptions options, IEnumerable includeRoleIds)
{
- var args = new GuildPruneParams(days);
+ var args = new GuildPruneParams(days, includeRoleIds?.ToArray());
GetGuildPruneCountResponse model;
if (simulate)
model = await client.ApiClient.GetGuildPruneCountAsync(guild.Id, args, options).ConfigureAwait(false);
@@ -479,7 +501,7 @@ namespace Discord.Rest
var emote = await client.ApiClient.GetGuildEmoteAsync(guild.Id, id, options).ConfigureAwait(false);
return emote.ToEntity();
}
- public static async Task CreateEmoteAsync(IGuild guild, BaseDiscordClient client, string name, Image image, Optional> roles,
+ public static async Task CreateEmoteAsync(IGuild guild, BaseDiscordClient client, string name, Image image, Optional> roles,
RequestOptions options)
{
var apiargs = new CreateGuildEmoteParams
@@ -494,7 +516,7 @@ namespace Discord.Rest
return emote.ToEntity();
}
/// is null.
- public static async Task ModifyEmoteAsync(IGuild guild, BaseDiscordClient client, ulong id, Action func,
+ public static async Task ModifyEmoteAsync(IGuild guild, BaseDiscordClient client, ulong id, Action func,
RequestOptions options)
{
if (func == null) throw new ArgumentNullException(paramName: nameof(func));
@@ -512,7 +534,7 @@ namespace Discord.Rest
var emote = await client.ApiClient.ModifyGuildEmoteAsync(guild.Id, id, apiargs, options).ConfigureAwait(false);
return emote.ToEntity();
}
- public static Task DeleteEmoteAsync(IGuild guild, BaseDiscordClient client, ulong id, RequestOptions options)
+ public static Task DeleteEmoteAsync(IGuild guild, BaseDiscordClient client, ulong id, RequestOptions options)
=> client.ApiClient.DeleteGuildEmoteAsync(guild.Id, id, options);
}
}
diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
index f0b5be0f7..c1dd39afe 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
@@ -7,6 +7,7 @@ using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using EmbedModel = Discord.API.GuildEmbed;
+using WidgetModel = Discord.API.GuildWidget;
using Model = Discord.API.Guild;
namespace Discord.Rest
@@ -28,6 +29,8 @@ namespace Discord.Rest
///
public bool IsEmbeddable { get; private set; }
///
+ public bool IsWidgetEnabled { get; private set; }
+ ///
public VerificationLevel VerificationLevel { get; private set; }
///
public MfaLevel MfaLevel { get; private set; }
@@ -41,8 +44,14 @@ namespace Discord.Rest
///
public ulong? EmbedChannelId { get; private set; }
///
+ public ulong? WidgetChannelId { get; private set; }
+ ///
public ulong? SystemChannelId { get; private set; }
///
+ public ulong? RulesChannelId { get; private set; }
+ ///
+ public ulong? PublicUpdatesChannelId { get; private set; }
+ ///
public ulong OwnerId { get; private set; }
///
public string VoiceRegionId { get; private set; }
@@ -50,6 +59,8 @@ namespace Discord.Rest
public string IconId { get; private set; }
///
public string SplashId { get; private set; }
+ ///
+ public string DiscoverySplashId { get; private set; }
internal bool Available { get; private set; }
///
public ulong? ApplicationId { get; private set; }
@@ -67,6 +78,16 @@ namespace Discord.Rest
public int PremiumSubscriptionCount { get; private set; }
///
public string PreferredLocale { get; private set; }
+ ///
+ public int? MaxPresences { get; private set; }
+ ///
+ public int? MaxMembers { get; private set; }
+ ///
+ public int? MaxVideoChannelUsers { get; private set; }
+ ///
+ public int? ApproximateMemberCount { get; private set; }
+ ///
+ public int? ApproximatePresenceCount { get; private set; }
///
public CultureInfo PreferredCulture { get; private set; }
@@ -81,6 +102,8 @@ namespace Discord.Rest
///
public string SplashUrl => CDN.GetGuildSplashUrl(Id, SplashId);
///
+ public string DiscoverySplashUrl => CDN.GetGuildDiscoverySplashUrl(Id, DiscoverySplashId);
+ ///
public string BannerUrl => CDN.GetGuildBannerUrl(Id, BannerId);
///
@@ -110,15 +133,24 @@ namespace Discord.Rest
internal void Update(Model model)
{
AFKChannelId = model.AFKChannelId;
- EmbedChannelId = model.EmbedChannelId;
+ if (model.EmbedChannelId.IsSpecified)
+ EmbedChannelId = model.EmbedChannelId.Value;
+ if (model.WidgetChannelId.IsSpecified)
+ WidgetChannelId = model.WidgetChannelId.Value;
SystemChannelId = model.SystemChannelId;
+ RulesChannelId = model.RulesChannelId;
+ PublicUpdatesChannelId = model.PublicUpdatesChannelId;
AFKTimeout = model.AFKTimeout;
- IsEmbeddable = model.EmbedEnabled;
+ if (model.EmbedEnabled.IsSpecified)
+ IsEmbeddable = model.EmbedEnabled.Value;
+ if (model.WidgetEnabled.IsSpecified)
+ IsWidgetEnabled = model.WidgetEnabled.Value;
IconId = model.Icon;
Name = model.Name;
OwnerId = model.OwnerId;
VoiceRegionId = model.Region;
SplashId = model.Splash;
+ DiscoverySplashId = model.DiscoverySplash;
VerificationLevel = model.VerificationLevel;
MfaLevel = model.MfaLevel;
DefaultMessageNotifications = model.DefaultMessageNotifications;
@@ -129,9 +161,20 @@ namespace Discord.Rest
BannerId = model.Banner;
SystemChannelFlags = model.SystemChannelFlags;
Description = model.Description;
- PremiumSubscriptionCount = model.PremiumSubscriptionCount.GetValueOrDefault();
+ if (model.PremiumSubscriptionCount.IsSpecified)
+ PremiumSubscriptionCount = model.PremiumSubscriptionCount.Value;
+ if (model.MaxPresences.IsSpecified)
+ MaxPresences = model.MaxPresences.Value ?? 25000;
+ if (model.MaxMembers.IsSpecified)
+ MaxMembers = model.MaxMembers.Value;
+ if (model.MaxVideoChannelUsers.IsSpecified)
+ MaxVideoChannelUsers = model.MaxVideoChannelUsers.Value;
PreferredLocale = model.PreferredLocale;
PreferredCulture = new CultureInfo(PreferredLocale);
+ if (model.ApproximateMemberCount.IsSpecified)
+ ApproximateMemberCount = model.ApproximateMemberCount.Value;
+ if (model.ApproximatePresenceCount.IsSpecified)
+ ApproximatePresenceCount = model.ApproximatePresenceCount.Value;
if (model.Emojis != null)
{
@@ -163,17 +206,36 @@ namespace Discord.Rest
EmbedChannelId = model.ChannelId;
IsEmbeddable = model.Enabled;
}
+ internal void Update(WidgetModel model)
+ {
+ WidgetChannelId = model.ChannelId;
+ IsWidgetEnabled = model.Enabled;
+ }
//General
///
public async Task UpdateAsync(RequestOptions options = null)
- => Update(await Discord.ApiClient.GetGuildAsync(Id, options).ConfigureAwait(false));
+ => Update(await Discord.ApiClient.GetGuildAsync(Id, false, options).ConfigureAwait(false));
+ ///
+ /// Updates this object's properties with its current state.
+ ///
+ ///
+ /// If true, and
+ /// will be updated as well.
+ ///
+ /// The options to be used when sending the request.
+ ///
+ /// If is true, and
+ /// will be updated as well.
+ ///
+ public async Task UpdateAsync(bool withCounts, RequestOptions options = null)
+ => Update(await Discord.ApiClient.GetGuildAsync(Id, withCounts, options).ConfigureAwait(false));
///
public Task DeleteAsync(RequestOptions options = null)
=> GuildHelper.DeleteAsync(this, Discord, options);
///
- /// is null.
+ /// is .
public async Task ModifyAsync(Action func, RequestOptions options = null)
{
var model = await GuildHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false);
@@ -181,7 +243,8 @@ namespace Discord.Rest
}
///
- /// is null.
+ /// is .
+ [Obsolete("This endpoint is deprecated, use ModifyWidgetAsync instead.")]
public async Task ModifyEmbedAsync(Action func, RequestOptions options = null)
{
var model = await GuildHelper.ModifyEmbedAsync(this, Discord, func, options).ConfigureAwait(false);
@@ -189,7 +252,15 @@ namespace Discord.Rest
}
///
- /// is null.
+ /// is .
+ public async Task ModifyWidgetAsync(Action func, RequestOptions options = null)
+ {
+ var model = await GuildHelper.ModifyWidgetAsync(this, Discord, func, options).ConfigureAwait(false);
+ Update(model);
+ }
+
+ ///
+ /// is .
public async Task ReorderChannelsAsync(IEnumerable args, RequestOptions options = null)
{
var arr = args.ToArray();
@@ -205,7 +276,7 @@ namespace Discord.Rest
role?.Update(model);
}
}
-
+
///
public Task LeaveAsync(RequestOptions options = null)
=> GuildHelper.LeaveAsync(this, Discord, options);
@@ -230,7 +301,7 @@ namespace Discord.Rest
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains a ban object, which
- /// contains the user information and the reason for the ban; null if the ban entry cannot be found.
+ /// contains the user information and the reason for the ban; if the ban entry cannot be found.
///
public Task GetBanAsync(IUser user, RequestOptions options = null)
=> GuildHelper.GetBanAsync(this, Discord, user.Id, options);
@@ -241,7 +312,7 @@ namespace Discord.Rest
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains a ban object, which
- /// contains the user information and the reason for the ban; null if the ban entry cannot be found.
+ /// contains the user information and the reason for the ban; if the ban entry cannot be found.
///
public Task GetBanAsync(ulong userId, RequestOptions options = null)
=> GuildHelper.GetBanAsync(this, Discord, userId, options);
@@ -279,7 +350,7 @@ namespace Discord.Rest
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the generic channel
- /// associated with the specified ; null if none is found.
+ /// associated with the specified ; if none is found.
///
public Task GetChannelAsync(ulong id, RequestOptions options = null)
=> GuildHelper.GetChannelAsync(this, Discord, id, options);
@@ -291,7 +362,7 @@ namespace Discord.Rest
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the text channel
- /// associated with the specified ; null if none is found.
+ /// associated with the specified ; if none is found.
///
public async Task GetTextChannelAsync(ulong id, RequestOptions options = null)
{
@@ -320,7 +391,7 @@ namespace Discord.Rest
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the voice channel associated
- /// with the specified ; null if none is found.
+ /// with the specified ; if none is found.
///
public async Task GetVoiceChannelAsync(ulong id, RequestOptions options = null)
{
@@ -362,7 +433,7 @@ namespace Discord.Rest
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the voice channel that the
- /// AFK users will be moved to after they have idled for too long; null if none is set.
+ /// AFK users will be moved to after they have idled for too long; if none is set.
///
public async Task GetAFKChannelAsync(RequestOptions options = null)
{
@@ -381,7 +452,7 @@ namespace Discord.Rest
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the first viewable text
- /// channel in this guild; null if none is found.
+ /// channel in this guild; if none is found.
///
public async Task GetDefaultChannelAsync(RequestOptions options = null)
{
@@ -399,8 +470,9 @@ namespace Discord.Rest
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the embed channel set
- /// within the server's widget settings; null if none is set.
+ /// within the server's widget settings; if none is set.
///
+ [Obsolete("This endpoint is deprecated, use GetWidgetChannelAsync instead.")]
public async Task GetEmbedChannelAsync(RequestOptions options = null)
{
var embedId = EmbedChannelId;
@@ -410,12 +482,28 @@ namespace Discord.Rest
}
///
- /// Gets the first viewable text channel in this guild.
+ /// Gets the widget channel (i.e. the channel set in the guild's widget settings) in this guild.
///
/// The options to be used when sending the request.
///
- /// A task that represents the asynchronous get operation. The task result contains the first viewable text
- /// channel in this guild; null if none is found.
+ /// A task that represents the asynchronous get operation. The task result contains the widget channel set
+ /// within the server's widget settings; if none is set.
+ ///
+ public async Task GetWidgetChannelAsync(RequestOptions options = null)
+ {
+ var widgetChannelId = WidgetChannelId;
+ if (widgetChannelId.HasValue)
+ return await GuildHelper.GetChannelAsync(this, Discord, widgetChannelId.Value, options).ConfigureAwait(false);
+ return null;
+ }
+
+ ///
+ /// Gets the text channel where guild notices such as welcome messages and boost events are posted.
+ ///
+ /// The options to be used when sending the request.
+ ///
+ /// A task that represents the asynchronous get operation. The task result contains the text channel
+ /// where guild notices such as welcome messages and boost events are poste; if none is found.
///
public async Task GetSystemChannelAsync(RequestOptions options = null)
{
@@ -427,6 +515,45 @@ namespace Discord.Rest
}
return null;
}
+
+ ///
+ /// Gets the text channel where Community guilds can display rules and/or guidelines.
+ ///
+ /// The options to be used when sending the request.
+ ///
+ /// A task that represents the asynchronous get operation. The task result contains the text channel
+ /// where Community guilds can display rules and/or guidelines; if none is set.
+ ///
+ public async Task GetRulesChannelAsync(RequestOptions options = null)
+ {
+ var rulesChannelId = RulesChannelId;
+ if (rulesChannelId.HasValue)
+ {
+ var channel = await GuildHelper.GetChannelAsync(this, Discord, rulesChannelId.Value, options).ConfigureAwait(false);
+ return channel as RestTextChannel;
+ }
+ return null;
+ }
+
+ ///
+ /// Gets the text channel channel where admins and moderators of Community guilds receive notices from Discord.
+ ///
+ /// The options to be used when sending the request.
+ ///
+ /// A task that represents the asynchronous get operation. The task result contains the text channel channel where
+ /// admins and moderators of Community guilds receive notices from Discord; if none is set.
+ ///
+ public async Task GetPublicUpdatesChannelAsync(RequestOptions options = null)
+ {
+ var publicUpdatesChannelId = PublicUpdatesChannelId;
+ if (publicUpdatesChannelId.HasValue)
+ {
+ var channel = await GuildHelper.GetChannelAsync(this, Discord, publicUpdatesChannelId.Value, options).ConfigureAwait(false);
+ return channel as RestTextChannel;
+ }
+ return null;
+ }
+
///
/// Creates a new text channel in this guild.
///
@@ -458,7 +585,7 @@ namespace Discord.Rest
/// The name of the new channel.
/// The delegate containing the properties to be applied to the channel upon its creation.
/// The options to be used when sending the request.
- /// is null.
+ /// is .
///
/// The created voice channel.
///
@@ -470,7 +597,7 @@ namespace Discord.Rest
/// The name of the new channel.
/// The delegate containing the properties to be applied to the channel upon its creation.
/// The options to be used when sending the request.
- /// is null.
+ /// is .
///
/// The created category channel.
///
@@ -521,7 +648,7 @@ namespace Discord.Rest
///
/// The snowflake identifier for the role.
///
- /// A role that is associated with the specified ; null if none is found.
+ /// A role that is associated with the specified ; if none is found.
///
public RestRole GetRole(ulong id)
{
@@ -585,7 +712,7 @@ namespace Discord.Rest
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the guild user
- /// associated with the specified ; null if none is found.
+ /// associated with the specified ; if none is found.
///
public Task GetUserAsync(ulong id, RequestOptions options = null)
=> GuildHelper.GetUserAsync(this, Discord, id, options);
@@ -631,8 +758,8 @@ namespace Discord.Rest
/// A task that represents the asynchronous prune operation. The task result contains the number of users to
/// be or has been removed from this guild.
///
- public Task PruneUsersAsync(int days = 30, bool simulate = false, RequestOptions options = null)
- => GuildHelper.PruneUsersAsync(this, Discord, days, simulate, options);
+ public Task PruneUsersAsync(int days = 30, bool simulate = false, RequestOptions options = null, IEnumerable includeRoleIds = null)
+ => GuildHelper.PruneUsersAsync(this, Discord, days, simulate, options, includeRoleIds);
///
/// Gets a collection of users in this guild that the name or nickname starts with the
@@ -675,7 +802,7 @@ namespace Discord.Rest
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the webhook with the
- /// specified ; null if none is found.
+ /// specified ; if none is found.
///
public Task GetWebhookAsync(ulong id, RequestOptions options = null)
=> GuildHelper.GetWebhookAsync(this, Discord, id, options);
@@ -708,7 +835,7 @@ namespace Discord.Rest
public Task CreateEmoteAsync(string name, Image image, Optional> roles = default(Optional>), RequestOptions options = null)
=> GuildHelper.CreateEmoteAsync(this, Discord, name, image, roles, options);
///
- /// is null.
+ /// is .
public Task ModifyEmoteAsync(GuildEmote emote, Action func, RequestOptions options = null)
=> GuildHelper.ModifyEmoteAsync(this, Discord, emote.Id, func, options);
///
@@ -808,6 +935,7 @@ namespace Discord.Rest
return null;
}
///
+ [Obsolete("This endpoint is deprecated, use GetWidgetChannelAsync instead.")]
async Task IGuild.GetEmbedChannelAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -816,6 +944,14 @@ namespace Discord.Rest
return null;
}
///
+ async Task IGuild.GetWidgetChannelAsync(CacheMode mode, RequestOptions options)
+ {
+ if (mode == CacheMode.AllowDownload)
+ return await GetWidgetChannelAsync(options).ConfigureAwait(false);
+ else
+ return null;
+ }
+ ///
async Task IGuild.GetSystemChannelAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -824,6 +960,22 @@ namespace Discord.Rest
return null;
}
///
+ async Task IGuild.GetRulesChannelAsync(CacheMode mode, RequestOptions options)
+ {
+ if (mode == CacheMode.AllowDownload)
+ return await GetRulesChannelAsync(options).ConfigureAwait(false);
+ else
+ return null;
+ }
+ ///
+ async Task IGuild.GetPublicUpdatesChannelAsync(CacheMode mode, RequestOptions options)
+ {
+ if (mode == CacheMode.AllowDownload)
+ return await GetPublicUpdatesChannelAsync(options).ConfigureAwait(false);
+ else
+ return null;
+ }
+ ///
async Task IGuild.CreateTextChannelAsync(string name, Action func, RequestOptions options)
=> await CreateTextChannelAsync(name, func, options).ConfigureAwait(false);
///
diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuildWidget.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuildWidget.cs
new file mode 100644
index 000000000..065739c57
--- /dev/null
+++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuildWidget.cs
@@ -0,0 +1,25 @@
+using System.Diagnostics;
+using Model = Discord.API.GuildWidget;
+
+namespace Discord.Rest
+{
+ [DebuggerDisplay(@"{DebuggerDisplay,nq}")]
+ public struct RestGuildWidget
+ {
+ public bool IsEnabled { get; private set; }
+ public ulong? ChannelId { get; private set; }
+
+ internal RestGuildWidget(bool isEnabled, ulong? channelId)
+ {
+ ChannelId = channelId;
+ IsEnabled = isEnabled;
+ }
+ internal static RestGuildWidget Create(Model model)
+ {
+ return new RestGuildWidget(model.Enabled, model.ChannelId);
+ }
+
+ public override string ToString() => ChannelId?.ToString() ?? "Unknown";
+ private string DebuggerDisplay => $"{ChannelId} ({(IsEnabled ? "Enabled" : "Disabled")})";
+ }
+}
diff --git a/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs b/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
index d6a718b3a..619ddc876 100644
--- a/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
@@ -65,12 +65,12 @@ namespace Discord.Rest
public static async Task AddReactionAsync(IMessage msg, IEmote emote, BaseDiscordClient client, RequestOptions options)
{
- await client.ApiClient.AddReactionAsync(msg.Channel.Id, msg.Id, emote is Emote e ? $"{e.Name}:{e.Id}" : emote.Name, options).ConfigureAwait(false);
+ await client.ApiClient.AddReactionAsync(msg.Channel.Id, msg.Id, emote is Emote e ? $"{e.Name}:{e.Id}" : UrlEncode(emote.Name), options).ConfigureAwait(false);
}
public static async Task RemoveReactionAsync(IMessage msg, ulong userId, IEmote emote, BaseDiscordClient client, RequestOptions options)
{
- await client.ApiClient.RemoveReactionAsync(msg.Channel.Id, msg.Id, userId, emote is Emote e ? $"{e.Name}:{e.Id}" : emote.Name, options).ConfigureAwait(false);
+ await client.ApiClient.RemoveReactionAsync(msg.Channel.Id, msg.Id, userId, emote is Emote e ? $"{e.Name}:{e.Id}" : UrlEncode(emote.Name), options).ConfigureAwait(false);
}
public static async Task RemoveAllReactionsAsync(IMessage msg, BaseDiscordClient client, RequestOptions options)
@@ -80,14 +80,14 @@ namespace Discord.Rest
public static async Task RemoveAllReactionsForEmoteAsync(IMessage msg, IEmote emote, BaseDiscordClient client, RequestOptions options)
{
- await client.ApiClient.RemoveAllReactionsForEmoteAsync(msg.Channel.Id, msg.Id, emote is Emote e ? $"{e.Name}:{e.Id}" : emote.Name, options).ConfigureAwait(false);
+ await client.ApiClient.RemoveAllReactionsForEmoteAsync(msg.Channel.Id, msg.Id, emote is Emote e ? $"{e.Name}:{e.Id}" : UrlEncode(emote.Name), options).ConfigureAwait(false);
}
public static IAsyncEnumerable> GetReactionUsersAsync(IMessage msg, IEmote emote,
int? limit, BaseDiscordClient client, RequestOptions options)
{
Preconditions.NotNull(emote, nameof(emote));
- var emoji = (emote is Emote e ? $"{e.Name}:{e.Id}" : emote.Name);
+ var emoji = (emote is Emote e ? $"{e.Name}:{e.Id}" : UrlEncode(emote.Name));
return new PagedAsyncEnumerable(
DiscordConfig.MaxUserReactionsPerBatch,
@@ -114,7 +114,15 @@ namespace Discord.Rest
},
count: limit
);
+ }
+ private static string UrlEncode(string text)
+ {
+#if NET461
+ return System.Net.WebUtility.UrlEncode(text);
+#else
+ return System.Web.HttpUtility.UrlEncode(text);
+#endif
}
public static async Task PinAsync(IMessage msg, BaseDiscordClient client,
diff --git a/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs b/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs
index 809a55e9c..2456e65e7 100644
--- a/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs
+++ b/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs
@@ -37,6 +37,9 @@ namespace Discord.Rest
public virtual bool IsSuppressed => false;
///
public virtual DateTimeOffset? EditedTimestamp => null;
+ ///
+ public virtual bool MentionedEveryone => false;
+
///
/// Gets a collection of the 's on the message.
///
diff --git a/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs b/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs
index ad2a65615..79df4308d 100644
--- a/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs
+++ b/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs
@@ -18,6 +18,8 @@ namespace Discord.Rest
private ImmutableArray _attachments = ImmutableArray.Create();
private ImmutableArray
///
/// A that the AFK users will be moved to after they have idled for too
- /// long; null if none is set.
+ /// long; if none is set.
///
public SocketVoiceChannel AFKChannel
{
@@ -166,8 +181,9 @@ namespace Discord.WebSocket
/// Gets the embed channel (i.e. the channel set in the guild's widget settings) in this guild.
///
///
- /// A channel set within the server's widget settings; null if none is set.
+ /// A channel set within the server's widget settings; if none is set.
///
+ [Obsolete("This property is deprecated, use WidgetChannel instead.")]
public SocketGuildChannel EmbedChannel
{
get
@@ -177,10 +193,24 @@ namespace Discord.WebSocket
}
}
///
+ /// Gets the widget channel (i.e. the channel set in the guild's widget settings) in this guild.
+ ///
+ ///
+ /// A channel set within the server's widget settings; if none is set.
+ ///
+ public SocketGuildChannel WidgetChannel
+ {
+ get
+ {
+ var id = WidgetChannelId;
+ return id.HasValue ? GetChannel(id.Value) : null;
+ }
+ }
+ ///
/// Gets the system channel where randomized welcome messages are sent in this guild.
///
///
- /// A text channel where randomized welcome messages will be sent to; null if none is set.
+ /// A text channel where randomized welcome messages will be sent to; if none is set.
///
public SocketTextChannel SystemChannel
{
@@ -191,6 +221,36 @@ namespace Discord.WebSocket
}
}
///
+ /// Gets the channel with the guild rules.
+ ///
+ ///
+ /// A text channel with the guild rules; if none is set.
+ ///
+ public SocketTextChannel RulesChannel
+ {
+ get
+ {
+ var id = RulesChannelId;
+ return id.HasValue ? GetTextChannel(id.Value) : null;
+ }
+ }
+ ///
+ /// Gets the channel where admins and moderators of Community guilds receive
+ /// notices from Discord.
+ ///
+ ///
+ /// A text channel where admins and moderators of Community guilds receive
+ /// notices from Discord; if none is set.
+ ///
+ public SocketTextChannel PublicUpdatesChannel
+ {
+ get
+ {
+ var id = PublicUpdatesChannelId;
+ return id.HasValue ? GetTextChannel(id.Value) : null;
+ }
+ }
+ ///
/// Gets a collection of all text channels in this guild.
///
///
@@ -360,15 +420,24 @@ namespace Discord.WebSocket
internal void Update(ClientState state, Model model)
{
AFKChannelId = model.AFKChannelId;
- EmbedChannelId = model.EmbedChannelId;
+ if (model.EmbedChannelId.IsSpecified)
+ EmbedChannelId = model.EmbedChannelId.Value;
+ if (model.WidgetChannelId.IsSpecified)
+ WidgetChannelId = model.WidgetChannelId.Value;
SystemChannelId = model.SystemChannelId;
+ RulesChannelId = model.RulesChannelId;
+ PublicUpdatesChannelId = model.PublicUpdatesChannelId;
AFKTimeout = model.AFKTimeout;
- IsEmbeddable = model.EmbedEnabled;
+ if (model.EmbedEnabled.IsSpecified)
+ IsEmbeddable = model.EmbedEnabled.Value;
+ if (model.WidgetEnabled.IsSpecified)
+ IsWidgetEnabled = model.WidgetEnabled.Value;
IconId = model.Icon;
Name = model.Name;
OwnerId = model.OwnerId;
VoiceRegionId = model.Region;
SplashId = model.Splash;
+ DiscoverySplashId = model.DiscoverySplash;
VerificationLevel = model.VerificationLevel;
MfaLevel = model.MfaLevel;
DefaultMessageNotifications = model.DefaultMessageNotifications;
@@ -379,9 +448,16 @@ namespace Discord.WebSocket
BannerId = model.Banner;
SystemChannelFlags = model.SystemChannelFlags;
Description = model.Description;
- PremiumSubscriptionCount = model.PremiumSubscriptionCount.GetValueOrDefault();
+ if (model.PremiumSubscriptionCount.IsSpecified)
+ PremiumSubscriptionCount = model.PremiumSubscriptionCount.Value;
+ if (model.MaxPresences.IsSpecified)
+ MaxPresences = model.MaxPresences.Value ?? 25000;
+ if (model.MaxMembers.IsSpecified)
+ MaxMembers = model.MaxMembers.Value;
+ if (model.MaxVideoChannelUsers.IsSpecified)
+ MaxVideoChannelUsers = model.MaxVideoChannelUsers.Value;
PreferredLocale = model.PreferredLocale;
- PreferredCulture = new CultureInfo(PreferredLocale);
+ PreferredCulture = PreferredLocale == null ? null : new CultureInfo(PreferredLocale);
if (model.Emojis != null)
{
@@ -447,15 +523,20 @@ namespace Discord.WebSocket
=> GuildHelper.DeleteAsync(this, Discord, options);
///
- /// is null.
+ /// is .
public Task ModifyAsync(Action func, RequestOptions options = null)
=> GuildHelper.ModifyAsync(this, Discord, func, options);
///
- /// is null.
+ /// is .
+ [Obsolete("This endpoint is deprecated, use ModifyWidgetAsync instead.")]
public Task ModifyEmbedAsync(Action func, RequestOptions options = null)
=> GuildHelper.ModifyEmbedAsync(this, Discord, func, options);
///
+ /// is .
+ public Task ModifyWidgetAsync(Action func, RequestOptions options = null)
+ => GuildHelper.ModifyWidgetAsync(this, Discord, func, options);
+ ///
public Task ReorderChannelsAsync(IEnumerable args, RequestOptions options = null)
=> GuildHelper.ReorderChannelsAsync(this, Discord, args, options);
///
@@ -485,7 +566,7 @@ namespace Discord.WebSocket
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains a ban object, which
- /// contains the user information and the reason for the ban; null if the ban entry cannot be found.
+ /// contains the user information and the reason for the ban; if the ban entry cannot be found.
///
public Task GetBanAsync(IUser user, RequestOptions options = null)
=> GuildHelper.GetBanAsync(this, Discord, user.Id, options);
@@ -496,7 +577,7 @@ namespace Discord.WebSocket
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains a ban object, which
- /// contains the user information and the reason for the ban; null if the ban entry cannot be found.
+ /// contains the user information and the reason for the ban; if the ban entry cannot be found.
///
public Task GetBanAsync(ulong userId, RequestOptions options = null)
=> GuildHelper.GetBanAsync(this, Discord, userId, options);
@@ -521,7 +602,7 @@ namespace Discord.WebSocket
///
/// The snowflake identifier for the channel.
///
- /// A generic channel associated with the specified ; null if none is found.
+ /// A generic channel associated with the specified ; if none is found.
///
public SocketGuildChannel GetChannel(ulong id)
{
@@ -535,7 +616,7 @@ namespace Discord.WebSocket
///
/// The snowflake identifier for the text channel.
///
- /// A text channel associated with the specified ; null if none is found.
+ /// A text channel associated with the specified ; if none is found.
///
public SocketTextChannel GetTextChannel(ulong id)
=> GetChannel(id) as SocketTextChannel;
@@ -544,7 +625,7 @@ namespace Discord.WebSocket
///
/// The snowflake identifier for the voice channel.
///
- /// A voice channel associated with the specified ; null if none is found.
+ /// A voice channel associated with the specified ; if none is found.
///
public SocketVoiceChannel GetVoiceChannel(ulong id)
=> GetChannel(id) as SocketVoiceChannel;
@@ -553,7 +634,7 @@ namespace Discord.WebSocket
///
/// The snowflake identifier for the category channel.
///
- /// A category channel associated with the specified ; null if none is found.
+ /// A category channel associated with the specified ; if none is found.
///
public SocketCategoryChannel GetCategoryChannel(ulong id)
=> GetChannel(id) as SocketCategoryChannel;
@@ -589,7 +670,7 @@ namespace Discord.WebSocket
/// The new name for the voice channel.
/// The delegate containing the properties to be applied to the channel upon its creation.
/// The options to be used when sending the request.
- /// is null.
+ /// is .
///
/// A task that represents the asynchronous creation operation. The task result contains the newly created
/// voice channel.
@@ -602,7 +683,7 @@ namespace Discord.WebSocket
/// The new name for the category.
/// The delegate containing the properties to be applied to the channel upon its creation.
/// The options to be used when sending the request.
- /// is null.
+ /// is .
///
/// A task that represents the asynchronous creation operation. The task result contains the newly created
/// category channel.
@@ -666,7 +747,7 @@ namespace Discord.WebSocket
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the partial metadata of
- /// the vanity invite found within this guild; null if none is found.
+ /// the vanity invite found within this guild; if none is found.
///
public Task GetVanityInviteAsync(RequestOptions options = null)
=> GuildHelper.GetVanityInviteAsync(this, Discord, options);
@@ -677,7 +758,7 @@ namespace Discord.WebSocket
///
/// The snowflake identifier for the role.
///
- /// A role that is associated with the specified ; null if none is found.
+ /// A role that is associated with the specified ; if none is found.
///
public SocketRole GetRole(ulong id)
{
@@ -699,7 +780,7 @@ namespace Discord.WebSocket
/// Whether the role is separated from others on the sidebar.
/// Whether the role can be mentioned.
/// The options to be used when sending the request.
- /// is null.
+ /// is .
///
/// A task that represents the asynchronous creation operation. The task result contains the newly created
/// role.
@@ -731,13 +812,13 @@ namespace Discord.WebSocket
///
/// This method retrieves a user found within this guild.
///
- /// This may return null in the WebSocket implementation due to incomplete user collection in
+ /// This may return in the WebSocket implementation due to incomplete user collection in
/// large guilds.
///
///
/// The snowflake identifier of the user.
///
- /// A guild user associated with the specified ; null if none is found.
+ /// A guild user associated with the specified ; if none is found.
///
public SocketGuildUser GetUser(ulong id)
{
@@ -746,8 +827,8 @@ namespace Discord.WebSocket
return null;
}
///
- public Task PruneUsersAsync(int days = 30, bool simulate = false, RequestOptions options = null)
- => GuildHelper.PruneUsersAsync(this, Discord, days, simulate, options);
+ public Task PruneUsersAsync(int days = 30, bool simulate = false, RequestOptions options = null, IEnumerable includeRoleIds = null)
+ => GuildHelper.PruneUsersAsync(this, Discord, days, simulate, options, includeRoleIds);
internal SocketGuildUser AddOrUpdateUser(UserModel model)
{
@@ -891,7 +972,7 @@ namespace Discord.WebSocket
/// The options to be used when sending the request.
///
/// A task that represents the asynchronous get operation. The task result contains the webhook with the
- /// specified ; null if none is found.
+ /// specified ; if none is found.
///
public Task GetWebhookAsync(ulong id, RequestOptions options = null)
=> GuildHelper.GetWebhookAsync(this, Discord, id, options);
@@ -914,7 +995,7 @@ namespace Discord.WebSocket
public Task CreateEmoteAsync(string name, Image image, Optional> roles = default(Optional>), RequestOptions options = null)
=> GuildHelper.CreateEmoteAsync(this, Discord, name, image, roles, options);
///
- /// is null.
+ /// is .
public Task ModifyEmoteAsync(GuildEmote emote, Action func, RequestOptions options = null)
=> GuildHelper.ModifyEmoteAsync(this, Discord, emote.Id, func, options);
///
@@ -1133,11 +1214,21 @@ namespace Discord.WebSocket
///
ulong? IGuild.EmbedChannelId => EmbedChannelId;
///
+ ulong? IGuild.WidgetChannelId => WidgetChannelId;
+ ///
ulong? IGuild.SystemChannelId => SystemChannelId;
///
+ ulong? IGuild.RulesChannelId => RulesChannelId;
+ ///
+ ulong? IGuild.PublicUpdatesChannelId => PublicUpdatesChannelId;
+ ///
IRole IGuild.EveryoneRole => EveryoneRole;
///
IReadOnlyCollection IGuild.Roles => Roles;
+ ///
+ int? IGuild.ApproximateMemberCount => null;
+ ///
+ int? IGuild.ApproximatePresenceCount => null;
///
async Task> IGuild.GetBansAsync(RequestOptions options)
@@ -1177,12 +1268,22 @@ namespace Discord.WebSocket
Task IGuild.GetDefaultChannelAsync(CacheMode mode, RequestOptions options)
=> Task.FromResult(DefaultChannel);
///
+ [Obsolete("This method is deprecated, use GetWidgetChannelAsync instead.")]
Task IGuild.GetEmbedChannelAsync(CacheMode mode, RequestOptions options)
=> Task.FromResult(EmbedChannel);
///
+ Task IGuild.GetWidgetChannelAsync(CacheMode mode, RequestOptions options)
+ => Task.FromResult(WidgetChannel);
+ ///
Task IGuild.GetSystemChannelAsync(CacheMode mode, RequestOptions options)
=> Task.FromResult(SystemChannel);
///
+ Task IGuild.GetRulesChannelAsync(CacheMode mode, RequestOptions options)
+ => Task.FromResult(RulesChannel);
+ ///
+ Task IGuild.GetPublicUpdatesChannelAsync(CacheMode mode, RequestOptions options)
+ => Task.FromResult(PublicUpdatesChannel);
+ ///
async Task IGuild.CreateTextChannelAsync(string name, Action func, RequestOptions options)
=> await CreateTextChannelAsync(name, func, options).ConfigureAwait(false);
///
diff --git a/src/Discord.Net.WebSocket/Entities/Invites/SocketInvite.cs b/src/Discord.Net.WebSocket/Entities/Invites/SocketInvite.cs
new file mode 100644
index 000000000..902f13935
--- /dev/null
+++ b/src/Discord.Net.WebSocket/Entities/Invites/SocketInvite.cs
@@ -0,0 +1,143 @@
+using Discord.Rest;
+using System;
+using System.Diagnostics;
+using System.Threading.Tasks;
+using Model = Discord.API.Gateway.InviteCreateEvent;
+
+namespace Discord.WebSocket
+{
+ [DebuggerDisplay(@"{DebuggerDisplay,nq}")]
+ public class SocketInvite : SocketEntity, IInviteMetadata
+ {
+ private long _createdAtTicks;
+
+ ///
+ public ulong ChannelId { get; private set; }
+ ///
+ /// Gets the channel where this invite was created.
+ ///
+ public SocketGuildChannel Channel { get; private set; }
+ ///
+ public ulong? GuildId { get; private set; }
+ ///
+ /// Gets the guild where this invite was created.
+ ///
+ public SocketGuild Guild { get; private set; }
+ ///
+ ChannelType IInvite.ChannelType
+ {
+ get
+ {
+ switch (Channel)
+ {
+ case IVoiceChannel voiceChannel: return ChannelType.Voice;
+ case ICategoryChannel categoryChannel: return ChannelType.Category;
+ case IDMChannel dmChannel: return ChannelType.DM;
+ case IGroupChannel groupChannel: return ChannelType.Group;
+ case INewsChannel newsChannel: return ChannelType.News;
+ case ITextChannel textChannel: return ChannelType.Text;
+ default: throw new InvalidOperationException("Invalid channel type.");
+ }
+ }
+ }
+ ///
+ string IInvite.ChannelName => Channel.Name;
+ ///
+ string IInvite.GuildName => Guild.Name;
+ ///
+ int? IInvite.PresenceCount => throw new NotImplementedException();
+ ///
+ int? IInvite.MemberCount => throw new NotImplementedException();
+ ///
+ bool IInviteMetadata.IsRevoked => throw new NotImplementedException();
+ ///
+ public bool IsTemporary { get; private set; }
+ ///
+ int? IInviteMetadata.MaxAge { get => MaxAge; }
+ ///
+ int? IInviteMetadata.MaxUses { get => MaxUses; }
+ ///
+ int? IInviteMetadata.Uses { get => Uses; }
+ ///
+ /// Gets the time (in seconds) until the invite expires.
+ ///
+ public int MaxAge { get; private set; }
+ ///
+ /// Gets the max number of uses this invite may have.
+ ///
+ public int MaxUses { get; private set; }
+ ///
+ /// Gets the number of times this invite has been used.
+ ///
+ public int Uses { get; private set; }
+ ///
+ /// Gets the user that created this invite if available.
+ ///
+ public SocketGuildUser Inviter { get; private set; }
+ ///
+ DateTimeOffset? IInviteMetadata.CreatedAt => DateTimeUtils.FromTicks(_createdAtTicks);
+ ///
+ /// Gets when this invite was created.
+ ///
+ public DateTimeOffset CreatedAt => DateTimeUtils.FromTicks(_createdAtTicks);
+ ///
+ /// Gets the user targeted by this invite if available.
+ ///
+ public SocketUser TargetUser { get; private set; }
+ ///
+ /// Gets the type of the user targeted by this invite.
+ ///
+ public TargetUserType TargetUserType { get; private set; }
+
+ ///
+ public string Code => Id;
+ ///
+ public string Url => $"{DiscordConfig.InviteUrl}{Code}";
+
+ internal SocketInvite(DiscordSocketClient discord, SocketGuild guild, SocketGuildChannel channel, SocketGuildUser inviter, SocketUser target, string id)
+ : base(discord, id)
+ {
+ Guild = guild;
+ Channel = channel;
+ Inviter = inviter;
+ TargetUser = target;
+ }
+ internal static SocketInvite Create(DiscordSocketClient discord, SocketGuild guild, SocketGuildChannel channel, SocketGuildUser inviter, SocketUser target, Model model)
+ {
+ var entity = new SocketInvite(discord, guild, channel, inviter, target, model.Code);
+ entity.Update(model);
+ return entity;
+ }
+ internal void Update(Model model)
+ {
+ ChannelId = model.ChannelId;
+ GuildId = model.GuildId.IsSpecified ? model.GuildId.Value : Guild.Id;
+ IsTemporary = model.Temporary;
+ MaxAge = model.MaxAge;
+ MaxUses = model.MaxUses;
+ Uses = model.Uses;
+ _createdAtTicks = model.CreatedAt.UtcTicks;
+ TargetUserType = model.TargetUserType.IsSpecified ? model.TargetUserType.Value : TargetUserType.Undefined;
+ }
+
+ ///
+ public Task DeleteAsync(RequestOptions options = null)
+ => InviteHelper.DeleteAsync(this, Discord, options);
+
+ ///
+ /// Gets the URL of the invite.
+ ///
+ ///
+ /// A string that resolves to the Url of the invite.
+ ///
+ public override string ToString() => Url;
+ private string DebuggerDisplay => $"{Url} ({Guild?.Name} / {Channel.Name})";
+
+ ///
+ IGuild IInvite.Guild => Guild;
+ ///
+ IChannel IInvite.Channel => Channel;
+ ///
+ IUser IInviteMetadata.Inviter => Inviter;
+ }
+}
diff --git a/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs b/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs
index f392614ad..614bd044b 100644
--- a/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs
+++ b/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs
@@ -46,6 +46,8 @@ namespace Discord.WebSocket
public virtual bool IsSuppressed => false;
///
public virtual DateTimeOffset? EditedTimestamp => null;
+ ///
+ public virtual bool MentionedEveryone => false;
///
public MessageActivity Activity { get; private set; }
diff --git a/src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs b/src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs
index e1f0f74dc..da7f8f16b 100644
--- a/src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs
+++ b/src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs
@@ -20,7 +20,9 @@ namespace Discord.WebSocket
private ImmutableArray _attachments = ImmutableArray.Create();
private ImmutableArray _embeds = ImmutableArray.Create();
private ImmutableArray _tags = ImmutableArray.Create();
-
+ private ImmutableArray _roleMentions = ImmutableArray.Create();
+ private ImmutableArray _userMentions = ImmutableArray.Create();
+
///
public override bool IsTTS => _isTTS;
///
@@ -30,6 +32,8 @@ namespace Discord.WebSocket
///
public override DateTimeOffset? EditedTimestamp => DateTimeUtils.FromTicks(_editedTimestampTicks);
///
+ public override bool MentionedEveryone => _isMentioningEveryone;
+ ///
public override IReadOnlyCollection Attachments => _attachments;
///
public override IReadOnlyCollection Embeds => _embeds;
@@ -38,9 +42,9 @@ namespace Discord.WebSocket
///
public override IReadOnlyCollection MentionedChannels => MessageHelper.FilterTagsByValue(TagType.ChannelMention, _tags);
///
- public override IReadOnlyCollection MentionedRoles => MessageHelper.FilterTagsByValue(TagType.RoleMention, _tags);
+ public override IReadOnlyCollection MentionedRoles => _roleMentions;
///
- public override IReadOnlyCollection MentionedUsers => MessageHelper.FilterTagsByValue(TagType.UserMention, _tags);
+ public override IReadOnlyCollection MentionedUsers => _userMentions;
internal SocketUserMessage(DiscordSocketClient discord, ulong id, ISocketMessageChannel channel, SocketUser author, MessageSource source)
: base(discord, id, channel, author, source)
@@ -57,6 +61,8 @@ namespace Discord.WebSocket
{
base.Update(state, model);
+ SocketGuild guild = (Channel as SocketGuildChannel)?.Guild;
+
if (model.IsTextToSpeech.IsSpecified)
_isTTS = model.IsTextToSpeech.Value;
if (model.Pinned.IsSpecified)
@@ -69,6 +75,8 @@ namespace Discord.WebSocket
{
_isSuppressed = model.Flags.Value.HasFlag(API.MessageFlags.Suppressed);
}
+ if (model.RoleMentions.IsSpecified)
+ _roleMentions = model.RoleMentions.Value.Select(x => guild.GetRole(x)).ToImmutableArray();
if (model.Attachments.IsSpecified)
{
@@ -98,28 +106,29 @@ namespace Discord.WebSocket
_embeds = ImmutableArray.Create();
}
- IReadOnlyCollection mentions = ImmutableArray.Create(); //Is passed to ParseTags to get real mention collection
if (model.UserMentions.IsSpecified)
{
var value = model.UserMentions.Value;
if (value.Length > 0)
{
- var newMentions = ImmutableArray.CreateBuilder(value.Length);
+ var newMentions = ImmutableArray.CreateBuilder(value.Length);
for (int i = 0; i < value.Length; i++)
{
var val = value[i];
- if (val.Object != null)
+ var guildUser = guild.GetUser(val.Id);
+ if (guildUser != null)
+ newMentions.Add(guildUser);
+ else if (val.Object != null)
newMentions.Add(SocketUnknownUser.Create(Discord, state, val.Object));
}
- mentions = newMentions.ToImmutable();
+ _userMentions = newMentions.ToImmutable();
}
}
if (model.Content.IsSpecified)
{
var text = model.Content.Value;
- var guild = (Channel as SocketGuildChannel)?.Guild;
- _tags = MessageHelper.ParseTags(text, Channel, guild, mentions);
+ _tags = MessageHelper.ParseTags(text, Channel, guild, _userMentions);
model.Content = text;
}
}
@@ -149,10 +158,10 @@ namespace Discord.WebSocket
=> MentionUtils.Resolve(this, 0, userHandling, channelHandling, roleHandling, everyoneHandling, emojiHandling);
///
- /// This operation may only be called on a channel.
+ /// This operation may only be called on a channel.
public async Task CrosspostAsync(RequestOptions options = null)
{
- if (!(Channel is SocketNewsChannel))
+ if (!(Channel is INewsChannel))
{
throw new InvalidOperationException("Publishing (crossposting) is only valid in news channels.");
}
diff --git a/src/Discord.Net.Webhook/DiscordWebhookClient.cs b/src/Discord.Net.Webhook/DiscordWebhookClient.cs
index e1e8b71b0..c39d377c7 100644
--- a/src/Discord.Net.Webhook/DiscordWebhookClient.cs
+++ b/src/Discord.Net.Webhook/DiscordWebhookClient.cs
@@ -33,7 +33,7 @@ namespace Discord.Webhook
: this(webhookUrl, new DiscordRestConfig()) { }
// regex pattern to match webhook urls
- private static Regex WebhookUrlRegex = new Regex(@"^.*(discord|discordapp)\.com\/api\/webhooks\/([\d]+)\/([a-z0-9_-]+)$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+ private static Regex WebhookUrlRegex = new Regex(@"^.*(discord|discordapp)\.com\/api\/webhooks\/([\d]+)\/([a-z0-9_-]+)$", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
/// Creates a new Webhook Discord client.
public DiscordWebhookClient(ulong webhookId, string webhookToken, DiscordRestConfig config)
@@ -74,12 +74,12 @@ namespace Discord.Webhook
_restLogger = LogManager.CreateLogger("Rest");
- ApiClient.RequestQueue.RateLimitTriggered += async (id, info) =>
+ ApiClient.RequestQueue.RateLimitTriggered += async (id, info, endpoint) =>
{
if (info == null)
- await _restLogger.VerboseAsync($"Preemptive Rate limit triggered: {id?.ToString() ?? "null"}").ConfigureAwait(false);
+ await _restLogger.VerboseAsync($"Preemptive Rate limit triggered: {endpoint} {(id.IsHashBucket ? $"(Bucket: {id.BucketHash})" : "")}").ConfigureAwait(false);
else
- await _restLogger.WarningAsync($"Rate limit triggered: {id?.ToString() ?? "null"}").ConfigureAwait(false);
+ await _restLogger.WarningAsync($"Rate limit triggered: {endpoint} {(id.IsHashBucket ? $"(Bucket: {id.BucketHash})" : "")}").ConfigureAwait(false);
};
ApiClient.SentRequest += async (method, endpoint, millis) => await _restLogger.VerboseAsync($"{method} {endpoint}: {millis} ms").ConfigureAwait(false);
}
@@ -88,19 +88,21 @@ namespace Discord.Webhook
/// Sends a message to the channel for this webhook.
/// Returns the ID of the created message.
public Task SendMessageAsync(string text = null, bool isTTS = false, IEnumerable embeds = null,
- string username = null, string avatarUrl = null, RequestOptions options = null)
- => WebhookClientHelper.SendMessageAsync(this, text, isTTS, embeds, username, avatarUrl, options);
+ string username = null, string avatarUrl = null, RequestOptions options = null, AllowedMentions allowedMentions = null)
+ => WebhookClientHelper.SendMessageAsync(this, text, isTTS, embeds, username, avatarUrl, allowedMentions, options);
/// Sends a message to the channel for this webhook with an attachment.
/// Returns the ID of the created message.
public Task SendFileAsync(string filePath, string text, bool isTTS = false,
- IEnumerable embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null, bool isSpoiler = false)
- => WebhookClientHelper.SendFileAsync(this, filePath, text, isTTS, embeds, username, avatarUrl, options, isSpoiler);
+ IEnumerable embeds = null, string username = null, string avatarUrl = null,
+ RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null)
+ => WebhookClientHelper.SendFileAsync(this, filePath, text, isTTS, embeds, username, avatarUrl, allowedMentions, options, isSpoiler);
/// Sends a message to the channel for this webhook with an attachment.
/// Returns the ID of the created message.
public Task SendFileAsync(Stream stream, string filename, string text, bool isTTS = false,
- IEnumerable embeds = null, string username = null, string avatarUrl = null, RequestOptions options = null, bool isSpoiler = false)
- => WebhookClientHelper.SendFileAsync(this, stream, filename, text, isTTS, embeds, username, avatarUrl, options, isSpoiler);
+ IEnumerable embeds = null, string username = null, string avatarUrl = null,
+ RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null)
+ => WebhookClientHelper.SendFileAsync(this, stream, filename, text, isTTS, embeds, username, avatarUrl, allowedMentions, options, isSpoiler);
/// Modifies the properties of this webhook.
public Task ModifyWebhookAsync(Action func, RequestOptions options = null)
diff --git a/src/Discord.Net.Webhook/WebhookClientHelper.cs b/src/Discord.Net.Webhook/WebhookClientHelper.cs
index 311d58bda..4bc2eaca9 100644
--- a/src/Discord.Net.Webhook/WebhookClientHelper.cs
+++ b/src/Discord.Net.Webhook/WebhookClientHelper.cs
@@ -21,7 +21,7 @@ namespace Discord.Webhook
return RestInternalWebhook.Create(client, model);
}
public static async Task SendMessageAsync(DiscordWebhookClient client,
- string text, bool isTTS, IEnumerable embeds, string username, string avatarUrl, RequestOptions options)
+ string text, bool isTTS, IEnumerable embeds, string username, string avatarUrl, AllowedMentions allowedMentions, RequestOptions options)
{
var args = new CreateWebhookMessageParams(text) { IsTTS = isTTS };
if (embeds != null)
@@ -30,19 +30,21 @@ namespace Discord.Webhook
args.Username = username;
if (avatarUrl != null)
args.AvatarUrl = avatarUrl;
+ if (allowedMentions != null)
+ args.AllowedMentions = allowedMentions.ToModel();
var model = await client.ApiClient.CreateWebhookMessageAsync(client.Webhook.Id, args, options: options).ConfigureAwait(false);
return model.Id;
}
public static async Task SendFileAsync(DiscordWebhookClient client, string filePath, string text, bool isTTS,
- IEnumerable embeds, string username, string avatarUrl, RequestOptions options, bool isSpoiler)
+ IEnumerable embeds, string username, string avatarUrl, AllowedMentions allowedMentions, RequestOptions options, bool isSpoiler)
{
string filename = Path.GetFileName(filePath);
using (var file = File.OpenRead(filePath))
- return await SendFileAsync(client, file, filename, text, isTTS, embeds, username, avatarUrl, options, isSpoiler).ConfigureAwait(false);
+ return await SendFileAsync(client, file, filename, text, isTTS, embeds, username, avatarUrl, allowedMentions, options, isSpoiler).ConfigureAwait(false);
}
public static async Task SendFileAsync(DiscordWebhookClient client, Stream stream, string filename, string text, bool isTTS,
- IEnumerable embeds, string username, string avatarUrl, RequestOptions options, bool isSpoiler)
+ IEnumerable embeds, string username, string avatarUrl, AllowedMentions allowedMentions, RequestOptions options, bool isSpoiler)
{
var args = new UploadWebhookFileParams(stream) { Filename = filename, Content = text, IsTTS = isTTS, IsSpoiler = isSpoiler };
if (username != null)
@@ -51,6 +53,8 @@ namespace Discord.Webhook
args.AvatarUrl = avatarUrl;
if (embeds != null)
args.Embeds = embeds.Select(x => x.ToModel()).ToArray();
+ if(allowedMentions != null)
+ args.AllowedMentions = allowedMentions.ToModel();
var msg = await client.ApiClient.UploadWebhookFileAsync(client.Webhook.Id, args, options).ConfigureAwait(false);
return msg.Id;
}
diff --git a/test/Discord.Net.Tests.Unit/GuildPermissionsTests.cs b/test/Discord.Net.Tests.Unit/GuildPermissionsTests.cs
index f0611fa24..cd29b2606 100644
--- a/test/Discord.Net.Tests.Unit/GuildPermissionsTests.cs
+++ b/test/Discord.Net.Tests.Unit/GuildPermissionsTests.cs
@@ -69,6 +69,7 @@ namespace Discord
AssertFlag(() => new GuildPermissions(manageGuild: true), GuildPermission.ManageGuild);
AssertFlag(() => new GuildPermissions(addReactions: true), GuildPermission.AddReactions);
AssertFlag(() => new GuildPermissions(viewAuditLog: true), GuildPermission.ViewAuditLog);
+ AssertFlag(() => new GuildPermissions(viewGuildInsights: true), GuildPermission.ViewGuildInsights);
AssertFlag(() => new GuildPermissions(viewChannel: true), GuildPermission.ViewChannel);
AssertFlag(() => new GuildPermissions(sendMessages: true), GuildPermission.SendMessages);
AssertFlag(() => new GuildPermissions(sendTTSMessages: true), GuildPermission.SendTTSMessages);
@@ -141,6 +142,7 @@ namespace Discord
AssertUtil(GuildPermission.ManageGuild, x => x.ManageGuild, (p, enable) => p.Modify(manageGuild: enable));
AssertUtil(GuildPermission.AddReactions, x => x.AddReactions, (p, enable) => p.Modify(addReactions: enable));
AssertUtil(GuildPermission.ViewAuditLog, x => x.ViewAuditLog, (p, enable) => p.Modify(viewAuditLog: enable));
+ AssertUtil(GuildPermission.ViewGuildInsights, x => x.ViewGuildInsights, (p, enable) => p.Modify(viewGuildInsights: enable));
AssertUtil(GuildPermission.ViewChannel, x => x.ViewChannel, (p, enable) => p.Modify(viewChannel: enable));
AssertUtil(GuildPermission.SendMessages, x => x.SendMessages, (p, enable) => p.Modify(sendMessages: enable));
AssertUtil(GuildPermission.SendTTSMessages, x => x.SendTTSMessages, (p, enable) => p.Modify(sendTTSMessages: enable));
diff --git a/test/Discord.Net.Tests.Unit/TokenUtilsTests.cs b/test/Discord.Net.Tests.Unit/TokenUtilsTests.cs
index bbfbfe754..e9526b761 100644
--- a/test/Discord.Net.Tests.Unit/TokenUtilsTests.cs
+++ b/test/Discord.Net.Tests.Unit/TokenUtilsTests.cs
@@ -83,7 +83,7 @@ namespace Discord
public void BotTokenDoesNotThrowExceptions(string token)
{
// This example token is pulled from the Discord Docs
- // https://discordapp.com/developers/docs/reference#authentication-example-bot-token-authorization-header
+ // https://discord.com/developers/docs/reference#authentication-example-bot-token-authorization-header
// should not throw any exception
TokenUtils.ValidateToken(TokenType.Bot, token);
}
diff --git a/test/Discord.Net.Tests/Tests.DiscordWebhookClient.cs b/test/Discord.Net.Tests/Tests.DiscordWebhookClient.cs
index 039525afc..52c39005b 100644
--- a/test/Discord.Net.Tests/Tests.DiscordWebhookClient.cs
+++ b/test/Discord.Net.Tests/Tests.DiscordWebhookClient.cs
@@ -12,18 +12,18 @@ namespace Discord
public class DiscordWebhookClientTests
{
[Theory]
- [InlineData("https://discordapp.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK",
+ [InlineData("https://discord.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK",
123412347732897802, "_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK")]
// ptb, canary, etc will have slightly different urls
- [InlineData("https://ptb.discordapp.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK",
+ [InlineData("https://ptb.discord.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK",
123412347732897802, "_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK")]
- [InlineData("https://canary.discordapp.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK",
+ [InlineData("https://canary.discord.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK",
123412347732897802, "_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK")]
// don't care about https
- [InlineData("http://canary.discordapp.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK",
+ [InlineData("http://canary.discord.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK",
123412347732897802, "_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK")]
// this is the minimum that the regex cares about
- [InlineData("discordapp.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK",
+ [InlineData("discord.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK",
123412347732897802, "_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK")]
public void TestWebhook_Valid(string webhookurl, ulong expectedId, string expectedToken)
{
@@ -48,7 +48,7 @@ namespace Discord
[Theory]
[InlineData("123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK")]
// trailing slash
- [InlineData("https://discordapp.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK/")]
+ [InlineData("https://discord.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK/")]
public void TestWebhook_Invalid(string webhookurl)
{
Assert.Throws(() =>