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/azure-pipelines.yml b/azure-pipelines.yml
index 5a1d48082..2fe5abfe8 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -14,25 +14,20 @@ trigger:
jobs:
- job: Linux
pool:
- vmImage: 'ubuntu-16.04'
+ vmImage: 'ubuntu-latest'
steps:
- - task: UseDotNet@2
- displayName: 'Use .NET Core sdk'
- inputs:
- packageType: 'sdk'
- version: '3.x'
- template: azure/build.yml
- job: Windows_build
pool:
- vmImage: 'windows-2019'
+ vmImage: 'windows-latest'
condition: ne(variables['Build.SourceBranch'], 'refs/heads/dev')
steps:
- template: azure/build.yml
- job: Windows_deploy
pool:
- vmImage: 'windows-2019'
+ vmImage: 'windows-latest'
condition: |
and (
succeeded(),
diff --git a/azure/build.yml b/azure/build.yml
index 3399d7e3d..63ba93964 100644
--- a/azure/build.yml
+++ b/azure/build.yml
@@ -1,5 +1,10 @@
steps:
-- script: dotnet restore --no-cache Discord.Net.sln
+- task: DotNetCoreCLI@2
+ inputs:
+ command: 'restore'
+ projects: 'Discord.Net.sln'
+ feedsToUse: 'select'
+ verbosityRestore: 'Minimal'
displayName: Restore packages
- script: dotnet build "Discord.Net.sln" --no-restore -v minimal -c $(buildConfiguration) /p:BuildNumber=$(buildNumber) /p:IsTagBuild=$(buildTag)
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/01_basic_ping_bot/01_basic_ping_bot.csproj b/samples/01_basic_ping_bot/01_basic_ping_bot.csproj
index d80185d19..0694671ef 100644
--- a/samples/01_basic_ping_bot/01_basic_ping_bot.csproj
+++ b/samples/01_basic_ping_bot/01_basic_ping_bot.csproj
@@ -3,7 +3,7 @@
Exe
false
- netcoreapp3.0
+ netcoreapp3.1
diff --git a/samples/02_commands_framework/02_commands_framework.csproj b/samples/02_commands_framework/02_commands_framework.csproj
index a011ebaef..b9478494b 100644
--- a/samples/02_commands_framework/02_commands_framework.csproj
+++ b/samples/02_commands_framework/02_commands_framework.csproj
@@ -3,7 +3,7 @@
Exe
false
- netcoreapp3.0
+ netcoreapp3.1
diff --git a/samples/03_sharded_client/03_sharded_client.csproj b/samples/03_sharded_client/03_sharded_client.csproj
index 0b3e728b9..7a4473bd0 100644
--- a/samples/03_sharded_client/03_sharded_client.csproj
+++ b/samples/03_sharded_client/03_sharded_client.csproj
@@ -3,7 +3,7 @@
Exe
false
- netcoreapp3.0
+ netcoreapp3.1
_03_sharded_client
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.Commands/Builders/ModuleClassBuilder.cs b/src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs
index aec8dcbe3..28037b0fa 100644
--- a/src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs
+++ b/src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs
@@ -135,7 +135,8 @@ namespace Discord.Commands
if (builder.Name == null)
builder.Name = typeInfo.Name;
- var validCommands = typeInfo.DeclaredMethods.Where(IsValidCommandDefinition);
+ // Get all methods (including from inherited members), that are valid commands
+ var validCommands = typeInfo.GetMethods().Where(IsValidCommandDefinition);
foreach (var method in validCommands)
{
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 9552b0a60..339d6fffd 100644
--- a/src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs
+++ b/src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs
@@ -1,3 +1,5 @@
+using System.Collections.Generic;
+
namespace Discord
{
///
@@ -26,9 +28,13 @@ 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; }
+ ///
+ /// Gets or sets the permission overwrites for this channel.
+ ///
+ public Optional> PermissionOverwrites { get; set; }
}
}
diff --git a/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs b/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs
index f5b986295..030a278bc 100644
--- a/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs
+++ b/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs
@@ -59,11 +59,15 @@ namespace Discord
/// The to be sent.
/// The options to be used when sending the request.
/// Whether the message attachment should be hidden as a spoiler.
+ ///
+ /// Specifies if notifications are sent for mentioned users and roles in the message .
+ /// If null, all mentioned roles and users will be notified.
+ ///
///
/// A task that represents an asynchronous send operation for delivering the message. The task result
/// contains the sent message.
///
- Task SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false);
+ Task SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null);
///
/// Sends a file to this message channel with an optional caption.
///
@@ -88,11 +92,15 @@ namespace Discord
/// The to be sent.
/// The options to be used when sending the request.
/// Whether the message attachment should be hidden as a spoiler.
+ ///
+ /// Specifies if notifications are sent for mentioned users and roles in the message .
+ /// If null, all mentioned roles and users will be notified.
+ ///
///
/// A task that represents an asynchronous send operation for delivering the message. The task result
/// contains the sent message.
///
- Task SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false);
+ Task SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null);
///
/// Gets a message from this message channel.
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/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/Users/IGuildUser.cs b/src/Discord.Net.Core/Entities/Users/IGuildUser.cs
index 60fa06cbd..92b146e05 100644
--- a/src/Discord.Net.Core/Entities/Users/IGuildUser.cs
+++ b/src/Discord.Net.Core/Entities/Users/IGuildUser.cs
@@ -73,7 +73,7 @@ namespace Discord
///
///
/// The following example checks if the current user has the ability to send a message with attachment in
- /// this channel; if so, uploads a file via .
+ /// this channel; if so, uploads a file via .
///
/// if (currentUser?.GetPermissions(targetChannel)?.AttachFiles)
/// await targetChannel.SendFileAsync("fortnite.png");
diff --git a/src/Discord.Net.Core/Entities/Users/IPresence.cs b/src/Discord.Net.Core/Entities/Users/IPresence.cs
index 620eb907c..a17ac0df2 100644
--- a/src/Discord.Net.Core/Entities/Users/IPresence.cs
+++ b/src/Discord.Net.Core/Entities/Users/IPresence.cs
@@ -19,5 +19,9 @@ namespace Discord
/// Gets the set of clients where this user is currently active.
///
IImmutableSet ActiveClients { get; }
+ ///
+ /// Gets the list of activities that this user currently has available.
+ ///
+ IImmutableList Activities { get; }
}
}
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/GatewayIntents.cs b/src/Discord.Net.Core/GatewayIntents.cs
new file mode 100644
index 000000000..f3dc5ceb9
--- /dev/null
+++ b/src/Discord.Net.Core/GatewayIntents.cs
@@ -0,0 +1,43 @@
+using System;
+
+namespace Discord
+{
+ [Flags]
+ public enum GatewayIntents
+ {
+ /// This intent includes no events
+ None = 0,
+ /// This intent includes GUILD_CREATE, GUILD_UPDATE, GUILD_DELETE, GUILD_ROLE_CREATE, GUILD_ROLE_UPDATE, GUILD_ROLE_DELETE, CHANNEL_CREATE, CHANNEL_UPDATE, CHANNEL_DELETE, CHANNEL_PINS_UPDATE
+ Guilds = 1 << 0,
+ /// This intent includes GUILD_MEMBER_ADD, GUILD_MEMBER_UPDATE, GUILD_MEMBER_REMOVE
+ /// This is a privileged intent and must be enabled in the Developer Portal.
+ GuildMembers = 1 << 1,
+ /// This intent includes GUILD_BAN_ADD, GUILD_BAN_REMOVE
+ GuildBans = 1 << 2,
+ /// This intent includes GUILD_EMOJIS_UPDATE
+ GuildEmojis = 1 << 3,
+ /// This intent includes GUILD_INTEGRATIONS_UPDATE
+ GuildIntegrations = 1 << 4,
+ /// This intent includes WEBHOOKS_UPDATE
+ GuildWebhooks = 1 << 5,
+ /// This intent includes INVITE_CREATE, INVITE_DELETE
+ GuildInvites = 1 << 6,
+ /// This intent includes VOICE_STATE_UPDATE
+ GuildVoiceStates = 1 << 7,
+ /// This intent includes PRESENCE_UPDATE
+ /// This is a privileged intent and must be enabled in the Developer Portal.
+ GuildPresences = 1 << 8,
+ /// This intent includes MESSAGE_CREATE, MESSAGE_UPDATE, MESSAGE_DELETE, MESSAGE_DELETE_BULK
+ GuildMessages = 1 << 9,
+ /// This intent includes MESSAGE_REACTION_ADD, MESSAGE_REACTION_REMOVE, MESSAGE_REACTION_REMOVE_ALL, MESSAGE_REACTION_REMOVE_EMOJI
+ GuildMessageReactions = 1 << 10,
+ /// This intent includes TYPING_START
+ GuildMessageTyping = 1 << 11,
+ /// This intent includes CHANNEL_CREATE, MESSAGE_CREATE, MESSAGE_UPDATE, MESSAGE_DELETE, CHANNEL_PINS_UPDATE
+ DirectMessages = 1 << 12,
+ /// This intent includes MESSAGE_REACTION_ADD, MESSAGE_REACTION_REMOVE, MESSAGE_REACTION_REMOVE_ALL, MESSAGE_REACTION_REMOVE_EMOJI
+ DirectMessageReactions = 1 << 13,
+ /// This intent includes TYPING_START
+ DirectMessageTyping = 1 << 14,
+ }
+}
diff --git a/src/Discord.Net.Core/Net/BucketId.cs b/src/Discord.Net.Core/Net/BucketId.cs
new file mode 100644
index 000000000..96281a0ed
--- /dev/null
+++ b/src/Discord.Net.Core/Net/BucketId.cs
@@ -0,0 +1,118 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.Immutable;
+using System.Linq;
+
+namespace Discord.Net
+{
+ ///
+ /// Represents a ratelimit bucket.
+ ///
+ public class BucketId : IEquatable
+ {
+ ///
+ /// Gets the http method used to make the request if available.
+ ///
+ public string HttpMethod { get; }
+ ///
+ /// Gets the endpoint that is going to be requested if available.
+ ///
+ public string Endpoint { get; }
+ ///
+ /// Gets the major parameters of the route.
+ ///
+ public IOrderedEnumerable> MajorParameters { get; }
+ ///
+ /// Gets the hash of this bucket.
+ ///
+ ///
+ /// The hash is provided by Discord to group ratelimits.
+ ///
+ public string BucketHash { get; }
+ ///
+ /// Gets if this bucket is a hash type.
+ ///
+ public bool IsHashBucket { get => BucketHash != null; }
+
+ private BucketId(string httpMethod, string endpoint, IEnumerable> majorParameters, string bucketHash)
+ {
+ HttpMethod = httpMethod;
+ Endpoint = endpoint;
+ MajorParameters = majorParameters.OrderBy(x => x.Key);
+ BucketHash = bucketHash;
+ }
+
+ ///
+ /// Creates a new based on the
+ /// and .
+ ///
+ /// Http method used to make the request.
+ /// Endpoint that is going to receive requests.
+ /// Major parameters of the route of this endpoint.
+ ///
+ /// A based on the
+ /// and the with the provided data.
+ ///
+ public static BucketId Create(string httpMethod, string endpoint, Dictionary majorParams)
+ {
+ Preconditions.NotNullOrWhitespace(endpoint, nameof(endpoint));
+ majorParams ??= new Dictionary();
+ return new BucketId(httpMethod, endpoint, majorParams, null);
+ }
+
+ ///
+ /// Creates a new based on a
+ /// and a previous .
+ ///
+ /// Bucket hash provided by Discord.
+ /// that is going to be upgraded to a hash type.
+ ///
+ /// A based on the
+ /// and .
+ ///
+ public static BucketId Create(string hash, BucketId oldBucket)
+ {
+ Preconditions.NotNullOrWhitespace(hash, nameof(hash));
+ Preconditions.NotNull(oldBucket, nameof(oldBucket));
+ return new BucketId(null, null, oldBucket.MajorParameters, hash);
+ }
+
+ ///
+ /// Gets the string that will define this bucket as a hash based one.
+ ///
+ ///
+ /// A that defines this bucket as a hash based one.
+ ///
+ public string GetBucketHash()
+ => IsHashBucket ? $"{BucketHash}:{string.Join("/", MajorParameters.Select(x => x.Value))}" : null;
+
+ ///
+ /// Gets the string that will define this bucket as an endpoint based one.
+ ///
+ ///
+ /// A that defines this bucket as an endpoint based one.
+ ///
+ public string GetUniqueEndpoint()
+ => HttpMethod != null ? $"{HttpMethod} {Endpoint}" : Endpoint;
+
+ public override bool Equals(object obj)
+ => Equals(obj as BucketId);
+
+ public override int GetHashCode()
+ => IsHashBucket ? (BucketHash, string.Join("/", MajorParameters.Select(x => x.Value))).GetHashCode() : (HttpMethod, Endpoint).GetHashCode();
+
+ public override string ToString()
+ => GetBucketHash() ?? GetUniqueEndpoint();
+
+ public bool Equals(BucketId other)
+ {
+ if (other is null)
+ return false;
+ if (ReferenceEquals(this, other))
+ return true;
+ if (GetType() != other.GetType())
+ return false;
+ return ToString() == other.ToString();
+ }
+ }
+}
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.Core/RequestOptions.cs b/src/Discord.Net.Core/RequestOptions.cs
index 1b05df2a3..ad0a4e33f 100644
--- a/src/Discord.Net.Core/RequestOptions.cs
+++ b/src/Discord.Net.Core/RequestOptions.cs
@@ -1,3 +1,4 @@
+using Discord.Net;
using System.Threading;
namespace Discord
@@ -57,7 +58,7 @@ namespace Discord
public bool? UseSystemClock { get; set; }
internal bool IgnoreState { get; set; }
- internal string BucketId { get; set; }
+ internal BucketId BucketId { get; set; }
internal bool IsClientBucket { get; set; }
internal bool IsReactionBucket { get; set; }
diff --git a/src/Discord.Net.Rest/API/Common/Presence.cs b/src/Discord.Net.Rest/API/Common/Presence.cs
index 22526e8ac..b37ad4229 100644
--- a/src/Discord.Net.Rest/API/Common/Presence.cs
+++ b/src/Discord.Net.Rest/API/Common/Presence.cs
@@ -1,5 +1,6 @@
#pragma warning disable CS1591
using Newtonsoft.Json;
+using System;
using System.Collections.Generic;
namespace Discord.API
@@ -26,5 +27,9 @@ namespace Discord.API
// "client_status": { "desktop": "dnd", "mobile": "dnd" }
[JsonProperty("client_status")]
public Optional> ClientStatus { get; set; }
+ [JsonProperty("activities")]
+ public List Activities { get; set; }
+ [JsonProperty("premium_since")]
+ public Optional PremiumSince { get; set; }
}
}
diff --git a/src/Discord.Net.Rest/API/Rest/CreateGuildChannelParams.cs b/src/Discord.Net.Rest/API/Rest/CreateGuildChannelParams.cs
index a102bd38d..aec43dbef 100644
--- a/src/Discord.Net.Rest/API/Rest/CreateGuildChannelParams.cs
+++ b/src/Discord.Net.Rest/API/Rest/CreateGuildChannelParams.cs
@@ -14,12 +14,16 @@ namespace Discord.API.Rest
public Optional CategoryId { get; set; }
[JsonProperty("position")]
public Optional Position { get; set; }
+ [JsonProperty("permission_overwrites")]
+ public Optional Overwrites { get; set; }
//Text channels
[JsonProperty("topic")]
public Optional Topic { get; set; }
[JsonProperty("nsfw")]
public Optional IsNsfw { get; set; }
+ [JsonProperty("rate_limit_per_user")]
+ public Optional SlowModeInterval { get; set; }
//Voice channels
[JsonProperty("bitrate")]
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/UploadFileParams.cs b/src/Discord.Net.Rest/API/Rest/UploadFileParams.cs
index 7ba21d012..64535e6d7 100644
--- a/src/Discord.Net.Rest/API/Rest/UploadFileParams.cs
+++ b/src/Discord.Net.Rest/API/Rest/UploadFileParams.cs
@@ -19,6 +19,7 @@ namespace Discord.API.Rest
public Optional Nonce { get; set; }
public Optional IsTTS { get; set; }
public Optional