diff --git a/src/Discord.Net.Commands/CommandServiceConfig.cs b/src/Discord.Net.Commands/CommandServiceConfig.cs
index 0d52eacc1..2dedceaa5 100644
--- a/src/Discord.Net.Commands/CommandServiceConfig.cs
+++ b/src/Discord.Net.Commands/CommandServiceConfig.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
namespace Discord.Commands
diff --git a/src/Discord.Net.Commands/Utilities/QuotationAliasUtils.cs b/src/Discord.Net.Commands/Utilities/QuotationAliasUtils.cs
index dc2328c1c..2612e99e5 100644
--- a/src/Discord.Net.Commands/Utilities/QuotationAliasUtils.cs
+++ b/src/Discord.Net.Commands/Utilities/QuotationAliasUtils.cs
@@ -1,7 +1,4 @@
-using System;
using System.Collections.Generic;
-using System.Text;
-using System.Globalization;
namespace Discord.Commands
{
diff --git a/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs b/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs
index a6efa0de6..179f4b03e 100644
--- a/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs
+++ b/src/Discord.Net.Core/Entities/Channels/IAudioChannel.cs
@@ -1,5 +1,4 @@
using Discord.Audio;
-using System;
using System.Threading.Tasks;
namespace Discord
diff --git a/src/Discord.Net.Core/Extensions/MessageExtensions.cs b/src/Discord.Net.Core/Extensions/MessageExtensions.cs
index c53ef9053..a809ee4fa 100644
--- a/src/Discord.Net.Core/Extensions/MessageExtensions.cs
+++ b/src/Discord.Net.Core/Extensions/MessageExtensions.cs
@@ -1,7 +1,17 @@
namespace Discord
{
+ ///
+ /// Provides extension methods for .
+ ///
public static class MessageExtensions
{
+ ///
+ /// Gets a URL that jumps to the message.
+ ///
+ /// The message to jump to.
+ ///
+ /// A string that contains a URL for jumping to the message in chat.
+ ///
public static string GetJumpUrl(this IMessage msg)
{
var channel = msg.Channel;
diff --git a/src/Discord.Net.Core/Extensions/UserExtensions.cs b/src/Discord.Net.Core/Extensions/UserExtensions.cs
index 16d9a56e9..037e5491b 100644
--- a/src/Discord.Net.Core/Extensions/UserExtensions.cs
+++ b/src/Discord.Net.Core/Extensions/UserExtensions.cs
@@ -10,6 +10,19 @@ namespace Discord
///
/// Sends a message via DM.
///
+ ///
+ /// This method attempts to send a direct-message to the user.
+ ///
+ ///
+ /// Please note that this method will throw an
+ /// if the user cannot receive DMs due to privacy reasons or if the user has the sender blocked.
+ ///
+ ///
+ /// You may want to consider catching for
+ /// 50007 when using this method.
+ ///
+ ///
+ ///
/// The user to send the DM to.
/// The message to be sent.
/// Whether the message should be read aloud by Discord or not.
@@ -30,6 +43,19 @@ namespace Discord
///
/// Sends a file to this message channel with an optional caption.
///
+ ///
+ /// This method attempts to send an attachment as a direct-message to the user.
+ ///
+ ///
+ /// Please note that this method will throw an
+ /// if the user cannot receive DMs due to privacy reasons or if the user has the sender blocked.
+ ///
+ ///
+ /// You may want to consider catching for
+ /// 50007 when using this method.
+ ///
+ ///
+ ///
/// The user to send the DM to.
/// The of the file to be sent.
/// The name of the attachment.
@@ -60,6 +86,19 @@ namespace Discord
///
/// Sends a file via DM with an optional caption.
///
+ ///
+ /// This method attempts to send an attachment as a direct-message to the user.
+ ///
+ ///
+ /// Please note that this method will throw an
+ /// if the user cannot receive DMs due to privacy reasons or if the user has the sender blocked.
+ ///
+ ///
+ /// You may want to consider catching for
+ /// 50007 when using this method.
+ ///
+ ///
+ ///
/// The user to send the DM to.
/// The file path of the file.
/// The message to be sent.
diff --git a/src/Discord.Net.Providers.WS4Net/WS4NetClient.cs b/src/Discord.Net.Providers.WS4Net/WS4NetClient.cs
index 1894a8906..afc01f87a 100644
--- a/src/Discord.Net.Providers.WS4Net/WS4NetClient.cs
+++ b/src/Discord.Net.Providers.WS4Net/WS4NetClient.cs
@@ -1,4 +1,4 @@
-using Discord.Net.WebSockets;
+using Discord.Net.WebSockets;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -151,7 +151,7 @@ namespace Discord.Net.Providers.WS4Net
}
private void OnBinaryMessage(object sender, DataReceivedEventArgs e)
{
- BinaryMessage(e.Data, 0, e.Data.Count()).GetAwaiter().GetResult();
+ BinaryMessage(e.Data, 0, e.Data.Length).GetAwaiter().GetResult();
}
private void OnConnected(object sender, object e)
{
diff --git a/src/Discord.Net.Rest/API/Common/EmbedAuthor.cs b/src/Discord.Net.Rest/API/Common/EmbedAuthor.cs
index 4381a9da3..d7f3ae68d 100644
--- a/src/Discord.Net.Rest/API/Common/EmbedAuthor.cs
+++ b/src/Discord.Net.Rest/API/Common/EmbedAuthor.cs
@@ -1,4 +1,3 @@
-using System;
using Newtonsoft.Json;
namespace Discord.API
diff --git a/src/Discord.Net.Rest/API/Common/EmbedFooter.cs b/src/Discord.Net.Rest/API/Common/EmbedFooter.cs
index 3dd7020d9..cd08e7e26 100644
--- a/src/Discord.Net.Rest/API/Common/EmbedFooter.cs
+++ b/src/Discord.Net.Rest/API/Common/EmbedFooter.cs
@@ -1,4 +1,3 @@
-using System;
using Newtonsoft.Json;
namespace Discord.API
diff --git a/src/Discord.Net.Rest/API/Common/EmbedImage.cs b/src/Discord.Net.Rest/API/Common/EmbedImage.cs
index c6b3562a3..e650d99f4 100644
--- a/src/Discord.Net.Rest/API/Common/EmbedImage.cs
+++ b/src/Discord.Net.Rest/API/Common/EmbedImage.cs
@@ -1,5 +1,4 @@
-#pragma warning disable CS1591
-using System;
+#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API
diff --git a/src/Discord.Net.Rest/API/Common/EmbedProvider.cs b/src/Discord.Net.Rest/API/Common/EmbedProvider.cs
index 1658eda1a..e01261483 100644
--- a/src/Discord.Net.Rest/API/Common/EmbedProvider.cs
+++ b/src/Discord.Net.Rest/API/Common/EmbedProvider.cs
@@ -1,5 +1,4 @@
-#pragma warning disable CS1591
-using System;
+#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API
diff --git a/src/Discord.Net.Rest/API/Common/EmbedThumbnail.cs b/src/Discord.Net.Rest/API/Common/EmbedThumbnail.cs
index 993beb72b..9c87ca46b 100644
--- a/src/Discord.Net.Rest/API/Common/EmbedThumbnail.cs
+++ b/src/Discord.Net.Rest/API/Common/EmbedThumbnail.cs
@@ -1,5 +1,4 @@
-#pragma warning disable CS1591
-using System;
+#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API
diff --git a/src/Discord.Net.Rest/API/Common/EmbedVideo.cs b/src/Discord.Net.Rest/API/Common/EmbedVideo.cs
index 610cf58a8..3a034d244 100644
--- a/src/Discord.Net.Rest/API/Common/EmbedVideo.cs
+++ b/src/Discord.Net.Rest/API/Common/EmbedVideo.cs
@@ -1,5 +1,4 @@
-#pragma warning disable CS1591
-using System;
+#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API
diff --git a/src/Discord.Net.Rest/API/Rest/UploadFileParams.cs b/src/Discord.Net.Rest/API/Rest/UploadFileParams.cs
index 9e909b50c..ae15aa5df 100644
--- a/src/Discord.Net.Rest/API/Rest/UploadFileParams.cs
+++ b/src/Discord.Net.Rest/API/Rest/UploadFileParams.cs
@@ -3,7 +3,6 @@ using Discord.Net.Converters;
using Discord.Net.Rest;
using Newtonsoft.Json;
using System.Collections.Generic;
-using System.Globalization;
using System.IO;
using System.Text;
diff --git a/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs b/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs
index 2a89fa4ba..c4a6f8536 100644
--- a/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs
@@ -69,7 +69,6 @@ namespace Discord.Rest
/// Gets a message from this message channel.
///
/// The snowflake identifier of the message.
- /// The that determines whether the object should be fetched from cache.
/// The options to be used when sending the request.
///
/// A task that represents an asynchronous get operation for retrieving the message. The task result contains
diff --git a/src/Discord.Net.WebSocket/DiscordSocketApiClient.cs b/src/Discord.Net.WebSocket/DiscordSocketApiClient.cs
index 20ff85be6..ac36f08a3 100644
--- a/src/Discord.Net.WebSocket/DiscordSocketApiClient.cs
+++ b/src/Discord.Net.WebSocket/DiscordSocketApiClient.cs
@@ -1,6 +1,5 @@
#pragma warning disable CS1591
using Discord.API.Gateway;
-using Discord.API.Rest;
using Discord.Net.Queue;
using Discord.Net.Rest;
using Discord.Net.WebSockets;
diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs
index ee33b3b93..c0a042669 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs
@@ -3,7 +3,6 @@ using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
diff --git a/test/Discord.Net.Tests/AnalyzerTests/GuildAccessTests.cs b/test/Discord.Net.Tests/AnalyzerTests/GuildAccessTests.cs
index 073cc1de7..4cb5cefcb 100644
--- a/test/Discord.Net.Tests/AnalyzerTests/GuildAccessTests.cs
+++ b/test/Discord.Net.Tests/AnalyzerTests/GuildAccessTests.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Linq;
-using System.Threading.Tasks;
+using System;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Discord.Analyzers;
diff --git a/test/Discord.Net.Tests/AnalyzerTests/Helpers/DiagnosticVerifier.Helper.cs b/test/Discord.Net.Tests/AnalyzerTests/Helpers/DiagnosticVerifier.Helper.cs
index 7a8eb2e9c..99654f12c 100644
--- a/test/Discord.Net.Tests/AnalyzerTests/Helpers/DiagnosticVerifier.Helper.cs
+++ b/test/Discord.Net.Tests/AnalyzerTests/Helpers/DiagnosticVerifier.Helper.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
@@ -7,7 +7,6 @@ using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Text;
-using Discord;
using Discord.Commands;
namespace TestHelper
diff --git a/test/Discord.Net.Tests/AnalyzerTests/Verifiers/DiagnosticVerifier.cs b/test/Discord.Net.Tests/AnalyzerTests/Verifiers/DiagnosticVerifier.cs
index 498e5ef27..3564093f8 100644
--- a/test/Discord.Net.Tests/AnalyzerTests/Verifiers/DiagnosticVerifier.cs
+++ b/test/Discord.Net.Tests/AnalyzerTests/Verifiers/DiagnosticVerifier.cs
@@ -1,8 +1,7 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Diagnostics;
//using Microsoft.VisualStudio.TestTools.UnitTesting;
using Xunit;
@@ -104,7 +103,7 @@ namespace TestHelper
/// Diagnostic Results that should have appeared in the code
private static void VerifyDiagnosticResults(IEnumerable actualResults, DiagnosticAnalyzer analyzer, params DiagnosticResult[] expectedResults)
{
- int expectedCount = expectedResults.Count();
+ int expectedCount = expectedResults.Length;
int actualCount = actualResults.Count();
if (expectedCount != actualCount)
diff --git a/test/Discord.Net.Tests/Net/HttpMixin.cs b/test/Discord.Net.Tests/Net/HttpMixin.cs
index c4a78ce0b..6cde2776b 100644
--- a/test/Discord.Net.Tests/Net/HttpMixin.cs
+++ b/test/Discord.Net.Tests/Net/HttpMixin.cs
@@ -9,7 +9,6 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
-using System.Linq;
using System.Net;
using System.Reactive.Linq;
using System.Reactive.Subjects;
@@ -142,4 +141,4 @@ namespace Discord.Net
return stream.WriteAsync(data, start, length).ToObservable();
}
}
-}
\ No newline at end of file
+}
diff --git a/test/Discord.Net.Tests/Tests.Channels.cs b/test/Discord.Net.Tests/Tests.Channels.cs
index 46e28b9da..890cacbf1 100644
--- a/test/Discord.Net.Tests/Tests.Channels.cs
+++ b/test/Discord.Net.Tests/Tests.Channels.cs
@@ -1,5 +1,4 @@
using Discord.Rest;
-using System;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
@@ -171,15 +170,15 @@ namespace Discord
// 2 categories
Assert.Equal(2, categories.Length);
- var cat1 = categories.Where(x => x.Name == "cat1").FirstOrDefault();
- var cat2 = categories.Where(x => x.Name == "cat2").FirstOrDefault();
+ var cat1 = categories.FirstOrDefault(x => x.Name == "cat1");
+ var cat2 = categories.FirstOrDefault(x => x.Name == "cat2");
Assert.NotNull(cat1);
Assert.NotNull(cat2);
// get text1, text2, ensure they have category id == cat1
- var text1 = allChannels.Where(x => x.Name == "text1").FirstOrDefault() as RestTextChannel;
- var text2 = allChannels.Where(x => x.Name == "text2").FirstOrDefault() as RestTextChannel;
+ var text1 = allChannels.FirstOrDefault(x => x.Name == "text1") as RestTextChannel;
+ var text2 = allChannels.FirstOrDefault(x => x.Name == "text2") as RestTextChannel;
Assert.NotNull(text1);
Assert.NotNull(text2);
@@ -197,8 +196,8 @@ namespace Discord
Assert.Equal(text2Cat.Name, cat1.Name);
// do the same for the voice channels
- var voice1 = allChannels.Where(x => x.Name == "voice1").FirstOrDefault() as RestVoiceChannel;
- var voice3 = allChannels.Where(x => x.Name == "voice3").FirstOrDefault() as RestVoiceChannel;
+ var voice1 = allChannels.FirstOrDefault(x => x.Name == "voice1") as RestVoiceChannel;
+ var voice3 = allChannels.FirstOrDefault(x => x.Name == "voice3") as RestVoiceChannel;
Assert.NotNull(voice1);
Assert.NotNull(voice3);
diff --git a/test/Discord.Net.Tests/Tests.Permissions.cs b/test/Discord.Net.Tests/Tests.Permissions.cs
index 2f72f272d..239d0862e 100644
--- a/test/Discord.Net.Tests/Tests.Permissions.cs
+++ b/test/Discord.Net.Tests/Tests.Permissions.cs
@@ -1,4 +1,3 @@
-using System;
using System.Threading.Tasks;
using Xunit;