diff --git a/docs/guides/getting_started/samples/first-bot/structure.cs b/docs/guides/getting_started/samples/first-bot/structure.cs
index a9a018c3a..9ec1043c9 100644
--- a/docs/guides/getting_started/samples/first-bot/structure.cs
+++ b/docs/guides/getting_started/samples/first-bot/structure.cs
@@ -36,7 +36,7 @@ class Program
// you must set the MessageCacheSize. You may adjust the number as needed.
//MessageCacheSize = 50,
- // If your platform doesn't have native websockets,
+ // If your platform doesn't have native WebSockets,
// add Discord.Net.Providers.WS4Net from NuGet,
// add the `using` at the top, and uncomment this line:
//WebSocketProvider = WS4NetProvider.Instance
diff --git a/experiment/Discord.Net.Rpc/DiscordRpcApiClient.cs b/experiment/Discord.Net.Rpc/DiscordRpcApiClient.cs
index 50d467054..300784f4e 100644
--- a/experiment/Discord.Net.Rpc/DiscordRpcApiClient.cs
+++ b/experiment/Discord.Net.Rpc/DiscordRpcApiClient.cs
@@ -192,7 +192,7 @@ namespace Discord.API
internal override async Task DisconnectInternalAsync()
{
if (_webSocketClient == null)
- throw new NotSupportedException("This client is not configured with websocket support.");
+ throw new NotSupportedException("This client is not configured with WebSocket support.");
if (ConnectionState == ConnectionState.Disconnected) return;
ConnectionState = ConnectionState.Disconnecting;
diff --git a/experiment/Discord.Net.Rpc/DiscordRpcConfig.cs b/experiment/Discord.Net.Rpc/DiscordRpcConfig.cs
index fd6b74ff1..90df8d1a7 100644
--- a/experiment/Discord.Net.Rpc/DiscordRpcConfig.cs
+++ b/experiment/Discord.Net.Rpc/DiscordRpcConfig.cs
@@ -14,7 +14,7 @@ namespace Discord.Rpc
/// Gets or sets the time, in milliseconds, to wait for a connection to complete before aborting.
public int ConnectionTimeout { get; set; } = 30000;
- /// Gets or sets the provider used to generate new websocket connections.
+ /// Gets or sets the provider used to generate new WebSocket connections.
public WebSocketProvider WebSocketProvider { get; set; }
public DiscordRpcConfig()
@@ -24,7 +24,7 @@ namespace Discord.Rpc
#else
WebSocketProvider = () =>
{
- throw new InvalidOperationException("The default websocket provider is not supported on this platform.\n" +
+ throw new InvalidOperationException("The default WebSocket provider is not supported on this platform.\n" +
"You must specify a WebSocketProvider or target a runtime supporting .NET Standard 1.3, such as .NET Framework 4.6+.");
};
#endif
diff --git a/src/Discord.Net.Commands/Builders/CommandBuilder.cs b/src/Discord.Net.Commands/Builders/CommandBuilder.cs
index 70045453f..7dcba8362 100644
--- a/src/Discord.Net.Commands/Builders/CommandBuilder.cs
+++ b/src/Discord.Net.Commands/Builders/CommandBuilder.cs
@@ -117,6 +117,7 @@ namespace Discord.Commands.Builders
return this;
}
+ /// Only the last parameter in a command may have the Remainder or Multiple flag.
internal CommandInfo Build(ModuleInfo info, CommandService service)
{
//Default name to primary alias
diff --git a/src/Discord.Net.Commands/CommandService.cs b/src/Discord.Net.Commands/CommandService.cs
index 57809d78b..a8ef5b62a 100644
--- a/src/Discord.Net.Commands/CommandService.cs
+++ b/src/Discord.Net.Commands/CommandService.cs
@@ -40,17 +40,17 @@ namespace Discord.Commands
internal readonly LogManager _logManager;
///
- /// Represents all modules loaded within .
+ /// Represents all modules loaded within .
///
public IEnumerable Modules => _moduleDefs.Select(x => x);
///
- /// Represents all commands loaded within .
+ /// Represents all commands loaded within .
///
public IEnumerable Commands => _moduleDefs.SelectMany(x => x.Commands);
///
- /// Represents all loaded within .
+ /// Represents all loaded within .
///
public ILookup TypeReaders => _typeReaders.SelectMany(x => x.Value.Select(y => new { y.Key, y.Value })).ToLookup(x => x.Key, x => x.Value);
@@ -122,12 +122,12 @@ namespace Discord.Commands
}
///
- /// Add a command module from a .
+ /// Add a command module from a .
///
/// The type of module.
///
/// The for your dependency injection solution, if using one - otherwise, pass
- /// .
+ /// .
///
///
/// A built module.
@@ -135,12 +135,12 @@ namespace Discord.Commands
public Task AddModuleAsync(IServiceProvider services) => AddModuleAsync(typeof(T), services);
///
- /// Adds a command module from a .
+ /// Adds a command module from a .
///
/// The type of module.
///
/// The for your dependency injection solution, if using one - otherwise, pass
- /// .
+ /// .
///
///
/// A built module.
@@ -174,12 +174,12 @@ namespace Discord.Commands
}
}
///
- /// Add command modules from an .
+ /// Add command modules from an .
///
/// The containing command modules.
///
/// An for your dependency injection solution, if using one - otherwise, pass
- /// .
+ /// .
///
///
/// A collection of built modules.
diff --git a/src/Discord.Net.Commands/Info/CommandInfo.cs b/src/Discord.Net.Commands/Info/CommandInfo.cs
index de1462a3f..65581dcc3 100644
--- a/src/Discord.Net.Commands/Info/CommandInfo.cs
+++ b/src/Discord.Net.Commands/Info/CommandInfo.cs
@@ -16,7 +16,7 @@ namespace Discord.Commands
///
///
/// This object contains the information of a command. This can include the module of the command, various
- /// descriptions regarding the command, and its .
+ /// descriptions regarding the command, and its .
///
[DebuggerDisplay("{Name,nq}")]
public class CommandInfo
diff --git a/src/Discord.Net.Commands/Map/CommandMapNode.cs b/src/Discord.Net.Commands/Map/CommandMapNode.cs
index db69af415..4f798e718 100644
--- a/src/Discord.Net.Commands/Map/CommandMapNode.cs
+++ b/src/Discord.Net.Commands/Map/CommandMapNode.cs
@@ -23,6 +23,7 @@ namespace Discord.Commands
_commands = ImmutableArray.Create();
}
+ /// Cannot add commands to the root node.
public void AddCommand(CommandService service, string text, int index, CommandInfo command)
{
int nextSegment = NextSegment(text, index, service._separatorChar);
diff --git a/src/Discord.Net.Commands/Readers/PrimitiveTypeReader.cs b/src/Discord.Net.Commands/Readers/PrimitiveTypeReader.cs
index 011854a23..cb74139df 100644
--- a/src/Discord.Net.Commands/Readers/PrimitiveTypeReader.cs
+++ b/src/Discord.Net.Commands/Readers/PrimitiveTypeReader.cs
@@ -17,10 +17,12 @@ namespace Discord.Commands
private readonly TryParseDelegate _tryParse;
private readonly float _score;
+ /// must be within the range [0, 1].
public PrimitiveTypeReader()
: this(PrimitiveParsers.Get(), 1)
{ }
+ /// must be within the range [0, 1].
public PrimitiveTypeReader(TryParseDelegate tryParse, float score)
{
if (score < 0 || score > 1)
diff --git a/src/Discord.Net.Core/Audio/IAudioClient.cs b/src/Discord.Net.Core/Audio/IAudioClient.cs
index 9be8ceef5..018c8bc05 100644
--- a/src/Discord.Net.Core/Audio/IAudioClient.cs
+++ b/src/Discord.Net.Core/Audio/IAudioClient.cs
@@ -15,7 +15,7 @@ namespace Discord.Audio
/// Gets the current connection state of this client.
ConnectionState ConnectionState { get; }
- /// Gets the estimated round-trip latency, in milliseconds, to the voice websocket server.
+ /// Gets the estimated round-trip latency, in milliseconds, to the voice WebSocket server.
int Latency { get; }
/// Gets the estimated round-trip latency, in milliseconds, to the voice UDP server.
int UdpLatency { get; }
diff --git a/src/Discord.Net.Core/CDN.cs b/src/Discord.Net.Core/CDN.cs
index 0c713f135..bd83b64e9 100644
--- a/src/Discord.Net.Core/CDN.cs
+++ b/src/Discord.Net.Core/CDN.cs
@@ -13,7 +13,7 @@ namespace Discord
public static string GetApplicationIconUrl(ulong appId, string iconId)
=> iconId != null ? $"{DiscordConfig.CDNUrl}app-icons/{appId}/{iconId}.jpg" : null;
///
- /// Returns the user avatar URL based on the and .
+ /// Returns the user avatar URL based on the and .
///
public static string GetUserAvatarUrl(ulong userId, string avatarId, ushort size, ImageFormat format)
{
@@ -52,7 +52,7 @@ namespace Discord
=> $"{DiscordConfig.CDNUrl}emojis/{emojiId}.{(animated ? "gif" : "png")}";
///
- /// Returns the rich presence asset URL based on the asset ID and .
+ /// Returns the rich presence asset URL based on the asset ID and .
///
public static string GetRichAssetUrl(ulong appId, string assetId, ushort size, ImageFormat format)
{
diff --git a/src/Discord.Net.Core/Commands/ICommandContext.cs b/src/Discord.Net.Core/Commands/ICommandContext.cs
index 8b682ba1c..d56eb38a0 100644
--- a/src/Discord.Net.Core/Commands/ICommandContext.cs
+++ b/src/Discord.Net.Core/Commands/ICommandContext.cs
@@ -1,7 +1,7 @@
namespace Discord.Commands
{
///
- /// Represents the context of a command. This may include the client, guild, channel, user, and message.
+ /// Represents a context of a command. This may include the client, guild, channel, user, and message.
///
public interface ICommandContext
{
diff --git a/src/Discord.Net.Core/Entities/Activities/Game.cs b/src/Discord.Net.Core/Entities/Activities/Game.cs
index 471cc9f64..62b2853d5 100644
--- a/src/Discord.Net.Core/Entities/Activities/Game.cs
+++ b/src/Discord.Net.Core/Entities/Activities/Game.cs
@@ -18,7 +18,7 @@ namespace Discord
/// Creates a with the provided and .
///
/// The name of the game.
- /// The type of activity. Default is .
+ /// The type of activity. Default is .
public Game(string name, ActivityType type = ActivityType.Playing)
{
Name = name;
diff --git a/src/Discord.Net.Core/Entities/Channels/ReorderChannelProperties.cs b/src/Discord.Net.Core/Entities/Channels/ReorderChannelProperties.cs
index 02cb2547c..255279fa8 100644
--- a/src/Discord.Net.Core/Entities/Channels/ReorderChannelProperties.cs
+++ b/src/Discord.Net.Core/Entities/Channels/ReorderChannelProperties.cs
@@ -1,7 +1,7 @@
namespace Discord
{
///
- /// Properties that are used to reorder an .
+ /// Properties that are used to reorder an .
///
public class ReorderChannelProperties
{
diff --git a/src/Discord.Net.Core/Entities/Emotes/EmoteProperties.cs b/src/Discord.Net.Core/Entities/Emotes/EmoteProperties.cs
index 255bf0721..721345afe 100644
--- a/src/Discord.Net.Core/Entities/Emotes/EmoteProperties.cs
+++ b/src/Discord.Net.Core/Entities/Emotes/EmoteProperties.cs
@@ -8,11 +8,11 @@ namespace Discord
public class EmoteProperties
{
///
- /// Gets or sets the name of the .
+ /// Gets or sets the name of the .
///
public Optional Name { get; set; }
///
- /// Gets or sets the roles that can access this .
+ /// Gets or sets the roles that can access this .
///
public Optional> Roles { get; set; }
}
diff --git a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
index 664ac017d..057b94788 100644
--- a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
+++ b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Discord
{
///
- /// Represents a generic guild object.
+ /// Represents a generic guild/server.
///
public interface IGuild : IDeletable, ISnowflakeEntity
{
@@ -23,7 +23,7 @@ namespace Discord
/// Determines if this guild is embeddable (i.e. can use widget).
///
///
- /// Returns if this guild can be embedded via widgets.
+ /// if this guild can be embedded via widgets; otherwise .
///
bool IsEmbeddable { get; }
///
@@ -91,58 +91,91 @@ namespace Discord
///
/// Gets the currently associated with this guild.
///
+ ///
+ /// currently associated with this guild.
+ ///
IAudioClient AudioClient { get; }
///
/// Gets the built-in role containing all users in this guild.
///
+ ///
+ /// Built-in role that represents an @everyone role in this guild.
+ ///
IRole EveryoneRole { get; }
///
/// Gets a collection of all custom emotes for this guild.
///
+ ///
+ /// A collection of all custom emotes for this guild.
+ ///
IReadOnlyCollection Emotes { get; }
///
/// Gets a collection of all extra features added to this guild.
///
+ ///
+ /// A collection of enabled features in this guild.
+ ///
IReadOnlyCollection Features { get; }
///
/// Gets a collection of all roles in this guild.
///
+ ///
+ /// A collection of roles found within this guild.
+ ///
IReadOnlyCollection Roles { get; }
///
/// Modifies this guild.
///
- /// The properties to modify the guild with.
+ /// The delegate containing the properties to modify the guild with.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable .
+ ///
Task ModifyAsync(Action func, RequestOptions options = null);
///
/// Modifies this guild's embed channel.
///
- /// The properties to modify the guild widget with.
+ /// The delegate containing the properties to modify the guild widget with.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable .
+ ///
Task ModifyEmbedAsync(Action func, RequestOptions options = null);
///
/// Bulk modifies the order of channels in this guild.
///
- /// The properties to modify the channel positions with.
+ /// The properties used to modify the channel positions with.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable .
+ ///
Task ReorderChannelsAsync(IEnumerable args, RequestOptions options = null);
///
/// Bulk modifies the order of roles in this guild.
///
- /// The properties to modify the role positions with.
+ /// The properties used to modify the role positions with.
/// The options to be used when sending the request.
Task ReorderRolesAsync(IEnumerable args, RequestOptions options = null);
+ ///
+ /// An awaitable .
+ ///
///
/// Leaves this guild. If you are the owner, use instead.
///
/// The options to be used when sending the request.
+ ///
+ /// An awaitable .
+ ///
Task LeaveAsync(RequestOptions options = null);
///
/// Gets a collection of all users banned on this guild.
///
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing a collection of banned users with reasons.
+ ///
Task> GetBansAsync(RequestOptions options = null);
///
/// Bans the provided user from this guild and optionally prunes their recent messages.
@@ -154,6 +187,9 @@ namespace Discord
/// The reason of the ban to be written in the audit log.
/// The options to be used when sending the request.
/// is not between 0 to 7.
+ ///
+ /// An awaitable .
+ ///
Task AddBanAsync(IUser user, int pruneDays = 0, string reason = null, RequestOptions options = null);
///
/// Bans the provided user ID from this guild and optionally prunes their recent messages.
@@ -165,14 +201,27 @@ namespace Discord
/// The reason of the ban to be written in the audit log.
/// The options to be used when sending the request.
/// is not between 0 to 7.
+ ///
+ /// An awaitable .
+ ///
Task AddBanAsync(ulong userId, int pruneDays = 0, string reason = null, RequestOptions options = null);
///
/// Unbans the provided user if they are currently banned.
///
+ /// The user to be unbanned.
+ /// The options to be used when sending the request.
+ ///
+ /// An awaitable .
+ ///
Task RemoveBanAsync(IUser user, RequestOptions options = null);
///
/// Unbans the provided user ID if it is currently banned.
///
+ /// The snowflake ID of the user to be unbanned.
+ /// The options to be used when sending the request.
+ ///
+ /// An awaitable .
+ ///
Task RemoveBanAsync(ulong userId, RequestOptions options = null);
///
@@ -182,15 +231,22 @@ namespace Discord
/// The that determines whether the object should be fetched from cache.
///
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing a collection of generic channels found within this guild.
+ ///
Task> GetChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
- /// Gets the channel in this guild with the provided ID, or if not found.
+ /// Gets the channel in this guild with the provided ID.
///
/// The channel ID.
///
/// The that determines whether the object should be fetched from cache.
///
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the generic channel with the specified ID, or
+ /// if none is found.
+ ///
Task GetChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
/// Gets a collection of all text channels in this guild.
@@ -199,6 +255,9 @@ namespace Discord
/// The that determines whether the object should be fetched from cache.
///
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing a collection of text channels found within this guild.
+ ///
Task> GetTextChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
/// Gets a text channel in this guild with the provided ID, or if not found.
@@ -208,6 +267,10 @@ namespace Discord
/// The that determines whether the object should be fetched from cache.
///
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the text channel with the specified ID, or
+ /// if none is found.
+ ///
Task GetTextChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
/// Gets a collection of all voice channels in this guild.
@@ -216,6 +279,9 @@ namespace Discord
/// The that determines whether the object should be fetched from cache.
///
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing a collection of voice channels found within this guild.
+ ///
Task> GetVoiceChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
/// Gets a collection of all category channels in this guild.
@@ -224,68 +290,97 @@ namespace Discord
/// The that determines whether the object should be fetched from cache.
///
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing a collection of category channels found within this guild.
+ ///
Task> GetCategoriesAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
- /// Gets the voice channel in this guild with the provided ID, or if not found.
+ /// Gets the voice channel in this guild with the provided ID.
///
/// The text channel ID.
///
/// The that determines whether the object should be fetched from cache.
///
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the voice channel with the specified ID, or
+ /// if none is found.
+ ///
Task GetVoiceChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
- /// Gets the voice AFK channel in this guild with the provided ID, or if not found.
+ /// Gets the AFK voice channel in this guild.
///
///
/// The that determines whether the object should be fetched from cache.
///
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the AFK voice channel set within this guild, or
+ /// if none is set.
+ ///
Task GetAFKChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
- /// Gets the default system text channel in this guild with the provided ID, or if
- /// none is set.
+ /// Gets the default system text channel in this guild with the provided ID.
///
///
/// The that determines whether the object should be fetched from cache.
///
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the system channel within this guild, or
+ /// if none is set.
+ ///
Task GetSystemChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
- /// Gets the top viewable text channel in this guild with the provided ID, or if not
- /// found.
+ /// Gets the top viewable text channel in this guild with the provided ID.
///
///
/// The that determines whether the object should be fetched from cache.
///
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the first viewable text channel in this guild, or
+ /// if none is found.
+ ///
Task GetDefaultChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
- /// Gets the embed channel (i.e. the channel set in the guild's widget settings) in this guild, or
- /// if none is set.
+ /// Gets the embed 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.
+ ///
+ /// An awaitable containing the embed channel set within the server's widget settings, or
+ /// if none is set.
+ ///
Task GetEmbedChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
/// Creates a new text channel.
///
/// The new name for the text channel.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the newly created text channel.
+ ///
Task CreateTextChannelAsync(string name, RequestOptions options = null);
///
/// Creates a new voice channel.
///
/// The new name for the voice channel.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the newly created voice channel.
+ ///
Task CreateVoiceChannelAsync(string name, RequestOptions options = null);
///
/// Creates a new channel category.
///
/// The new name for the category.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the newly created category channel.
+ ///
Task CreateCategoryAsync(string name, RequestOptions options = null);
Task> GetIntegrationsAsync(RequestOptions options = null);
@@ -309,13 +404,24 @@ namespace Discord
/// The color of the role.
/// Whether the role is separated from others on the sidebar.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the newly crated role.
+ ///
Task CreateRoleAsync(string name, GuildPermissions? permissions = null, Color? color = null, bool isHoisted = false, RequestOptions options = null);
///
/// Gets a collection of all users in this guild.
///
- /// The that determines whether the object should be fetched from cache.
+ /// The that determines whether the object should be fetched from
+ /// cache.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing a collection of users found within this guild.
+ ///
+ ///
+ /// This may return an incomplete list on the WebSocket implementation because Discord only sends offline
+ /// users on large guilds.
+ ///
Task> GetUsersAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
/// Gets the user in this guild with the provided ID, or if not found.
@@ -323,22 +429,34 @@ namespace Discord
/// The user ID.
/// The that determines whether the object should be fetched from cache.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the guild user with the specified ID, otherwise .
+ ///
Task GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
/// Gets the current user for this guild.
///
/// The that determines whether the object should be fetched from cache.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the currently logged-in user within this guild.
+ ///
Task GetCurrentUserAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
/// Gets the owner of this guild.
///
/// The that determines whether the object should be fetched from cache.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the owner of this guild.
+ ///
Task GetOwnerAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
///
/// Downloads all users for this guild if the current list is incomplete.
///
+ ///
+ /// An awaitable .
+ ///
Task DownloadUsersAsync();
///
/// Removes all users from this guild if they have not logged on in a provided number of
@@ -349,7 +467,7 @@ namespace Discord
/// Whether this prune action is a simulation.
/// The options to be used when sending the request.
///
- /// The number of users removed from this guild.
+ /// An awaitable containing the number of users to be or has been removed from this guild.
///
Task PruneUsersAsync(int days = 30, bool simulate = false, RequestOptions options = null);
@@ -358,11 +476,17 @@ namespace Discord
///
/// The webhook ID.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the webhook with the specified ID, otherwise .
+ ///
Task GetWebhookAsync(ulong id, RequestOptions options = null);
///
/// Gets a collection of all webhook from this guild.
///
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing a collection of webhooks found within the guild.
+ ///
Task> GetWebhooksAsync(RequestOptions options = null);
///
@@ -370,6 +494,9 @@ namespace Discord
///
/// The guild emote ID.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the emote found with the specified ID, or if not found.
+ ///
Task GetEmoteAsync(ulong id, RequestOptions options = null);
///
/// Creates a new in this guild.
@@ -378,20 +505,29 @@ namespace Discord
/// The image of the new emote.
/// The roles to limit the emote usage to.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the created emote.
+ ///
Task CreateEmoteAsync(string name, Image image, Optional> roles = default(Optional>), RequestOptions options = null);
///
/// Modifies an existing in this guild.
///
/// The emote to be modified.
- /// The properties to modify the emote with.
+ /// The delegate containing the properties to modify the emote with.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable containing the newly modified emote.
+ ///
Task ModifyEmoteAsync(GuildEmote emote, Action func, RequestOptions options = null);
///
/// Deletes an existing from this guild.
///
/// The emote to delete.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable .
+ ///
Task DeleteEmoteAsync(GuildEmote emote, RequestOptions options = null);
}
}
diff --git a/src/Discord.Net.Core/Entities/IUpdateable.cs b/src/Discord.Net.Core/Entities/IUpdateable.cs
index b4bbe169a..3ae4613f5 100644
--- a/src/Discord.Net.Core/Entities/IUpdateable.cs
+++ b/src/Discord.Net.Core/Entities/IUpdateable.cs
@@ -3,7 +3,7 @@ using System.Threading.Tasks;
namespace Discord
{
///
- /// Represents whether the object is updatable or not.
+ /// Defines whether the object is updateable or not.
///
public interface IUpdateable
{
diff --git a/src/Discord.Net.Core/Entities/Image.cs b/src/Discord.Net.Core/Entities/Image.cs
index 921902f5d..dd77ec6ae 100644
--- a/src/Discord.Net.Core/Entities/Image.cs
+++ b/src/Discord.Net.Core/Entities/Image.cs
@@ -33,9 +33,9 @@ namespace Discord
/// The path to the file.
///
/// is a zero-length string, contains only white space, or contains one or more invalid
- /// characters as defined by .
+ /// characters as defined by .
///
- /// is .
+ /// is .
///
/// The specified path, file name, or both exceed the system-defined maximum length. For example, on
/// Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260
diff --git a/src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs b/src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs
index 4568bd56c..087b30993 100644
--- a/src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs
+++ b/src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs
@@ -172,7 +172,7 @@ namespace Discord
}
///
- /// Sets the title of an .
+ /// Sets the title of an .
///
/// The title to be set.
///
diff --git a/src/Discord.Net.Core/Entities/Messages/EmbedField.cs b/src/Discord.Net.Core/Entities/Messages/EmbedField.cs
index d7f37befa..3ae000022 100644
--- a/src/Discord.Net.Core/Entities/Messages/EmbedField.cs
+++ b/src/Discord.Net.Core/Entities/Messages/EmbedField.cs
@@ -3,7 +3,7 @@ using System.Diagnostics;
namespace Discord
{
///
- /// Represents a field for an .
+ /// Represents a field for an .
///
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public struct EmbedField
diff --git a/src/Discord.Net.Core/Entities/Messages/EmbedVideo.cs b/src/Discord.Net.Core/Entities/Messages/EmbedVideo.cs
index 525c25562..4368f74a4 100644
--- a/src/Discord.Net.Core/Entities/Messages/EmbedVideo.cs
+++ b/src/Discord.Net.Core/Entities/Messages/EmbedVideo.cs
@@ -3,7 +3,7 @@ using System.Diagnostics;
namespace Discord
{
///
- /// A video featured in an .
+ /// A video featured in an .
///
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public struct EmbedVideo
diff --git a/src/Discord.Net.Core/Entities/Messages/IMessage.cs b/src/Discord.Net.Core/Entities/Messages/IMessage.cs
index e390fa682..d66a6b883 100644
--- a/src/Discord.Net.Core/Entities/Messages/IMessage.cs
+++ b/src/Discord.Net.Core/Entities/Messages/IMessage.cs
@@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace Discord
{
///
- /// Represents a Discord message object.
+ /// Represents a message object.
///
public interface IMessage : ISnowflakeEntity, IDeletable
{
diff --git a/src/Discord.Net.Core/Entities/Messages/MessageProperties.cs b/src/Discord.Net.Core/Entities/Messages/MessageProperties.cs
index 9daec32d3..d52b309b5 100644
--- a/src/Discord.Net.Core/Entities/Messages/MessageProperties.cs
+++ b/src/Discord.Net.Core/Entities/Messages/MessageProperties.cs
@@ -4,20 +4,21 @@ namespace Discord
/// Properties that are used to modify an with the specified changes.
///
///
- /// The content of a message can be cleared with String.Empty; if and only if an Embed is present.
+ /// The content of a message can be cleared with if and only if an is present.
///
///
///
- /// var message = await ReplyAsync("abc");
- /// await message.ModifyAsync(x =>
- /// {
- /// x.Content = "";
- /// x.Embed = new EmbedBuilder()
- /// .WithColor(new Color(40, 40, 120))
- /// .WithAuthor(a => a.Name = "foxbot")
- /// .WithTitle("Embed!")
- /// .WithDescription("This is an embed.");
- /// });
+ /// var message = await ReplyAsync("abc");
+ /// await message.ModifyAsync(x =>
+ /// {
+ /// x.Content = "";
+ /// x.Embed = new EmbedBuilder()
+ /// .WithColor(new Color(40, 40, 120))
+ /// .WithAuthor(a => a.Name = "foxbot")
+ /// .WithTitle("Embed!")
+ /// .WithDescription("This is an embed.")
+ /// .Build();
+ /// });
///
///
public class MessageProperties
@@ -26,7 +27,7 @@ namespace Discord
/// Gets or sets the content of the message.
///
///
- /// This must be less than 2000 characters.
+ /// This must be less than the constant defined by .
///
public Optional Content { get; set; }
///
diff --git a/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs b/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs
index 58d25daac..99134bb90 100644
--- a/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs
+++ b/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs
@@ -19,7 +19,8 @@ namespace Discord
public static readonly ChannelPermissions DM = new ChannelPermissions(0b00000_1000110_1011100110000_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 channelType.
+ /// Gets a that grants all permissions for a given channel type.
+ /// Unknown channel type.
public static ChannelPermissions All(IChannel channel)
{
switch (channel)
diff --git a/src/Discord.Net.Core/Entities/Roles/ReorderRoleProperties.cs b/src/Discord.Net.Core/Entities/Roles/ReorderRoleProperties.cs
index fcfa08da5..e13083f1d 100644
--- a/src/Discord.Net.Core/Entities/Roles/ReorderRoleProperties.cs
+++ b/src/Discord.Net.Core/Entities/Roles/ReorderRoleProperties.cs
@@ -1,7 +1,7 @@
namespace Discord
{
///
- /// Properties that are used to reorder an .
+ /// Properties that are used to reorder an .
///
public class ReorderRoleProperties
{
diff --git a/src/Discord.Net.Core/Entities/Roles/RoleProperties.cs b/src/Discord.Net.Core/Entities/Roles/RoleProperties.cs
index 7769a2a04..79372b86d 100644
--- a/src/Discord.Net.Core/Entities/Roles/RoleProperties.cs
+++ b/src/Discord.Net.Core/Entities/Roles/RoleProperties.cs
@@ -23,7 +23,7 @@ namespace Discord
///
public Optional Name { get; set; }
///
- /// Gets or sets the role's .
+ /// Gets or sets the role's .
///
public Optional Permissions { get; set; }
///
diff --git a/src/Discord.Net.Core/Entities/Users/GuildUserProperties.cs b/src/Discord.Net.Core/Entities/Users/GuildUserProperties.cs
index c731f1459..beb2c392f 100644
--- a/src/Discord.Net.Core/Entities/Users/GuildUserProperties.cs
+++ b/src/Discord.Net.Core/Entities/Users/GuildUserProperties.cs
@@ -7,10 +7,10 @@ namespace Discord
///
///
///
- /// await (Context.User as IGuildUser)?.ModifyAsync(x =>
- /// {
- /// x.Nickname = $"festive {Context.User.Username}";
- /// });
+ /// await guildUser.ModifyAsync(x =>
+ /// {
+ /// x.Nickname = $"festive {guildUser.Username}";
+ /// });
///
///
///
@@ -35,7 +35,7 @@ namespace Discord
///
///
/// To clear the user's nickname, this value can be set to or
- /// .
+ /// .
///
public Optional Nickname { get; set; }
///
diff --git a/src/Discord.Net.Core/Entities/Webhooks/WebhookProperties.cs b/src/Discord.Net.Core/Entities/Webhooks/WebhookProperties.cs
index 52adbe99a..387ee6106 100644
--- a/src/Discord.Net.Core/Entities/Webhooks/WebhookProperties.cs
+++ b/src/Discord.Net.Core/Entities/Webhooks/WebhookProperties.cs
@@ -27,14 +27,14 @@ namespace Discord
/// Gets or sets the channel for this webhook.
///
///
- /// This field is not used when authenticated with .
+ /// This field is not used when authenticated with .
///
public Optional Channel { get; set; }
///
/// Gets or sets the channel ID for this webhook.
///
///
- /// This field is not used when authenticated with .
+ /// This field is not used when authenticated with .
///
public Optional ChannelId { get; set; }
}
diff --git a/src/Discord.Net.Core/Utils/ConcurrentHashSet.cs b/src/Discord.Net.Core/Utils/ConcurrentHashSet.cs
index 1fc11587e..233d1b0b0 100644
--- a/src/Discord.Net.Core/Utils/ConcurrentHashSet.cs
+++ b/src/Discord.Net.Core/Utils/ConcurrentHashSet.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -157,12 +157,16 @@ namespace Discord
: this(collection, EqualityComparer.Default) { }
public ConcurrentHashSet(IEqualityComparer comparer)
: this(DefaultConcurrencyLevel, DefaultCapacity, true, comparer) { }
+ /// is
public ConcurrentHashSet(IEnumerable collection, IEqualityComparer comparer)
: this(comparer)
{
if (collection == null) throw new ArgumentNullException(nameof(collection));
InitializeFromCollection(collection);
}
+ ///
+ /// or is
+ ///
public ConcurrentHashSet(int concurrencyLevel, IEnumerable collection, IEqualityComparer comparer)
: this(concurrencyLevel, DefaultCapacity, false, comparer)
{
@@ -197,7 +201,7 @@ namespace Discord
{
foreach (var value in collection)
{
- if (value == null) throw new ArgumentNullException("key");
+ if (value == null) throw new ArgumentNullException(nameof(value));
if (!TryAddInternal(value, _comparer.GetHashCode(value), false))
throw new ArgumentException();
@@ -206,10 +210,10 @@ namespace Discord
if (_budget == 0)
_budget = _tables._buckets.Length / _tables._locks.Length;
}
-
+ /// is
public bool ContainsKey(T value)
{
- if (value == null) throw new ArgumentNullException("key");
+ if (value == null) throw new ArgumentNullException(nameof(value));
return ContainsKeyInternal(value, _comparer.GetHashCode(value));
}
private bool ContainsKeyInternal(T value, int hashcode)
@@ -230,9 +234,10 @@ namespace Discord
return false;
}
+ /// is
public bool TryAdd(T value)
{
- if (value == null) throw new ArgumentNullException("key");
+ if (value == null) throw new ArgumentNullException(nameof(value));
return TryAddInternal(value, _comparer.GetHashCode(value), true);
}
private bool TryAddInternal(T value, int hashcode, bool acquireLock)
@@ -279,9 +284,10 @@ namespace Discord
}
}
+ /// is
public bool TryRemove(T value)
{
- if (value == null) throw new ArgumentNullException("key");
+ if (value == null) throw new ArgumentNullException(nameof(value));
return TryRemoveInternal(value);
}
private bool TryRemoveInternal(T value)
@@ -467,4 +473,4 @@ namespace Discord
Monitor.Exit(_tables._locks[i]);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Discord.Net.Core/Utils/Optional.cs b/src/Discord.Net.Core/Utils/Optional.cs
index 9284645f5..348179699 100644
--- a/src/Discord.Net.Core/Utils/Optional.cs
+++ b/src/Discord.Net.Core/Utils/Optional.cs
@@ -11,6 +11,7 @@ namespace Discord
private readonly T _value;
/// Gets the value for this parameter.
+ /// This property has no value set.
public T Value
{
get
diff --git a/src/Discord.Net.Core/Utils/Preconditions.cs b/src/Discord.Net.Core/Utils/Preconditions.cs
index 1af6dc35d..569917312 100644
--- a/src/Discord.Net.Core/Utils/Preconditions.cs
+++ b/src/Discord.Net.Core/Utils/Preconditions.cs
@@ -183,7 +183,7 @@ namespace Discord
}
// Bulk Delete
- /// Messages are younger than 2 weeks..
+ /// Messages are younger than 2 weeks.
public static void YoungerThanTwoWeeks(ulong[] collection, string name)
{
var minimum = SnowflakeUtils.ToSnowflake(DateTimeOffset.UtcNow.Subtract(TimeSpan.FromDays(14)));
@@ -194,7 +194,7 @@ namespace Discord
throw new ArgumentOutOfRangeException(name, "Messages must be younger than two weeks old.");
}
}
- /// The everyone role cannot be assigned to a user
+ /// The everyone role cannot be assigned to a user.
public static void NotEveryoneRole(ulong[] roles, ulong guildId, string name)
{
for (var i = 0; i < roles.Length; i++)
diff --git a/src/Discord.Net.Rest/ClientHelper.cs b/src/Discord.Net.Rest/ClientHelper.cs
index 73e1a08f0..155430a7f 100644
--- a/src/Discord.Net.Rest/ClientHelper.cs
+++ b/src/Discord.Net.Rest/ClientHelper.cs
@@ -1,3 +1,4 @@
+using System;
using Discord.API.Rest;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -24,6 +25,7 @@ namespace Discord.Rest
return RestChannel.Create(client, model);
return null;
}
+ /// Unexpected channel type.
public static async Task> GetPrivateChannelsAsync(BaseDiscordClient client, RequestOptions options)
{
var models = await client.ApiClient.GetMyPrivateChannelsAsync(options).ConfigureAwait(false);
diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs
index c8ff616e2..8ffe7dbf9 100644
--- a/src/Discord.Net.Rest/DiscordRestApiClient.cs
+++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs
@@ -58,6 +58,9 @@ namespace Discord.API
SetBaseUrl(DiscordConfig.APIUrl);
}
+
+ /// Unknown OAuth token type.
+ /// A delegate callback throws an exception.
internal void SetBaseUrl(string baseUrl)
{
RestClient = _restClientProvider(baseUrl);
@@ -65,6 +68,7 @@ namespace Discord.API
RestClient.SetHeader("user-agent", UserAgent);
RestClient.SetHeader("authorization", GetPrefixedToken(AuthTokenType, AuthToken));
}
+ /// Unknown OAuth token type.
internal static string GetPrefixedToken(TokenType tokenType, string token)
{
switch (tokenType)
@@ -76,7 +80,7 @@ namespace Discord.API
case TokenType.Bearer:
return $"Bearer {token}";
default:
- throw new ArgumentException("Unknown OAuth token type", nameof(tokenType));
+ throw new ArgumentException("Unknown OAuth token type.", nameof(tokenType));
}
}
internal virtual void Dispose(bool disposing)
@@ -463,6 +467,7 @@ namespace Discord.API
endpoint = () => $"channels/{channelId}/messages?limit={limit}";
return await SendAsync>("GET", endpoint, ids, options: options).ConfigureAwait(false);
}
+ /// Message content is too long, length must be less or equal to .
public async Task CreateMessageAsync(ulong channelId, CreateMessageParams args, RequestOptions options = null)
{
Preconditions.NotNull(args, nameof(args));
@@ -471,12 +476,14 @@ namespace Discord.API
Preconditions.NotNullOrEmpty(args.Content, nameof(args.Content));
if (args.Content?.Length > DiscordConfig.MaxMessageSize)
- throw new ArgumentException($"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", nameof(args.Content));
+ throw new ArgumentOutOfRangeException($"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", nameof(args.Content));
options = RequestOptions.CreateOrClone(options);
var ids = new BucketIds(channelId: channelId);
return await SendJsonAsync("POST", () => $"channels/{channelId}/messages", args, ids, clientBucket: ClientBucketType.SendEdit, options: options).ConfigureAwait(false);
}
+ /// Message content is too long, length must be less or equal to .
+ /// This operation may only be called with a token.
public async Task CreateWebhookMessageAsync(ulong webhookId, CreateWebhookMessageParams args, RequestOptions options = null)
{
if (AuthTokenType != TokenType.Webhook)
@@ -488,11 +495,12 @@ namespace Discord.API
Preconditions.NotNullOrEmpty(args.Content, nameof(args.Content));
if (args.Content?.Length > DiscordConfig.MaxMessageSize)
- throw new ArgumentException($"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", nameof(args.Content));
+ throw new ArgumentOutOfRangeException($"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", nameof(args.Content));
options = RequestOptions.CreateOrClone(options);
return await SendJsonAsync("POST", () => $"webhooks/{webhookId}/{AuthToken}?wait=true", args, new BucketIds(), clientBucket: ClientBucketType.SendEdit, options: options).ConfigureAwait(false);
}
+ /// Message content is too long, length must be less or equal to .
public async Task UploadFileAsync(ulong channelId, UploadFileParams args, RequestOptions options = null)
{
Preconditions.NotNull(args, nameof(args));
@@ -507,6 +515,9 @@ namespace Discord.API
var ids = new BucketIds(channelId: channelId);
return await SendMultipartAsync("POST", () => $"channels/{channelId}/messages", args.ToDictionary(), ids, clientBucket: ClientBucketType.SendEdit, options: options).ConfigureAwait(false);
}
+
+ /// Message content is too long, length must be less or equal to .
+ /// This operation may only be called with a token.
public async Task UploadWebhookFileAsync(ulong webhookId, UploadWebhookFileParams args, RequestOptions options = null)
{
if (AuthTokenType != TokenType.Webhook)
@@ -559,6 +570,7 @@ namespace Discord.API
break;
}
}
+ /// Message content is too long, length must be less or equal to .
public async Task ModifyMessageAsync(ulong channelId, ulong messageId, Rest.ModifyMessageParams args, RequestOptions options = null)
{
Preconditions.NotEqual(channelId, 0, nameof(channelId));
@@ -1267,6 +1279,7 @@ namespace Discord.API
}
//Helpers
+ /// Client is not logged in.
protected void CheckState()
{
if (LoginState != LoginState.LoggedIn)
diff --git a/src/Discord.Net.Rest/DiscordRestClient.cs b/src/Discord.Net.Rest/DiscordRestClient.cs
index 471f8ee6c..6092e008c 100644
--- a/src/Discord.Net.Rest/DiscordRestClient.cs
+++ b/src/Discord.Net.Rest/DiscordRestClient.cs
@@ -22,12 +22,14 @@ namespace Discord.Rest
ApiClient.Dispose();
}
+ ///
internal override async Task OnLoginAsync(TokenType tokenType, string token)
{
var user = await ApiClient.GetMyUserAsync(new RequestOptions { RetryMode = RetryMode.AlwaysRetry }).ConfigureAwait(false);
ApiClient.CurrentUserId = user.Id;
base.CurrentUser = RestSelfUser.Create(this, user);
}
+ ///
internal override Task OnLogoutAsync()
{
_applicationInfo = null;
@@ -80,9 +82,11 @@ namespace Discord.Rest
=> ClientHelper.GetWebhookAsync(this, id, options);
//IDiscordClient
+ ///
async Task IDiscordClient.GetApplicationInfoAsync(RequestOptions options)
=> await GetApplicationInfoAsync(options).ConfigureAwait(false);
+ ///
async Task IDiscordClient.GetChannelAsync(ulong id, CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -90,6 +94,7 @@ namespace Discord.Rest
else
return null;
}
+ ///
async Task> IDiscordClient.GetPrivateChannelsAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -97,6 +102,7 @@ namespace Discord.Rest
else
return ImmutableArray.Create();
}
+ ///
async Task> IDiscordClient.GetDMChannelsAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -104,6 +110,7 @@ namespace Discord.Rest
else
return ImmutableArray.Create();
}
+ ///
async Task> IDiscordClient.GetGroupChannelsAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -112,12 +119,15 @@ namespace Discord.Rest
return ImmutableArray.Create();
}
+ ///
async Task> IDiscordClient.GetConnectionsAsync(RequestOptions options)
=> await GetConnectionsAsync(options).ConfigureAwait(false);
+ ///
async Task IDiscordClient.GetInviteAsync(string inviteId, RequestOptions options)
=> await GetInviteAsync(inviteId, options).ConfigureAwait(false);
+ ///
async Task IDiscordClient.GetGuildAsync(ulong id, CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -125,6 +135,7 @@ namespace Discord.Rest
else
return null;
}
+ ///
async Task> IDiscordClient.GetGuildsAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -132,9 +143,11 @@ namespace Discord.Rest
else
return ImmutableArray.Create();
}
+ ///
async Task IDiscordClient.CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon, RequestOptions options)
=> await CreateGuildAsync(name, region, jpegIcon, options).ConfigureAwait(false);
+ ///
async Task IDiscordClient.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -143,11 +156,14 @@ namespace Discord.Rest
return null;
}
+ ///
async Task> IDiscordClient.GetVoiceRegionsAsync(RequestOptions options)
=> await GetVoiceRegionsAsync(options).ConfigureAwait(false);
+ ///
async Task IDiscordClient.GetVoiceRegionAsync(string id, RequestOptions options)
=> await GetVoiceRegionAsync(id, options).ConfigureAwait(false);
+ ///
async Task IDiscordClient.GetWebhookAsync(ulong id, RequestOptions options)
=> await GetWebhookAsync(id, options).ConfigureAwait(false);
}
diff --git a/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs b/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
index 7723861fa..65b0da6a8 100644
--- a/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
@@ -7,7 +7,6 @@ using System.Linq;
using System.Threading.Tasks;
using Model = Discord.API.Channel;
using UserModel = Discord.API.User;
-using WebhookModel = Discord.API.Webhook;
namespace Discord.Rest
{
@@ -77,14 +76,8 @@ namespace Discord.Rest
int? maxAge, int? maxUses, bool isTemporary, bool isUnique, RequestOptions options)
{
var args = new CreateChannelInviteParams { IsTemporary = isTemporary, IsUnique = isUnique };
- if (maxAge.HasValue)
- args.MaxAge = maxAge.Value;
- else
- args.MaxAge = 0;
- if (maxUses.HasValue)
- args.MaxUses = maxUses.Value;
- else
- args.MaxUses = 0;
+ args.MaxAge = maxAge.GetValueOrDefault(0);
+ args.MaxUses = maxUses.GetValueOrDefault(0);
var model = await client.ApiClient.CreateChannelInviteAsync(channel.Id, args, options).ConfigureAwait(false);
return RestInviteMetadata.Create(client, null, channel, model);
}
@@ -160,6 +153,7 @@ namespace Discord.Rest
return builder.ToImmutable();
}
+ /// Message content is too long, length must be less or equal to .
public static async Task SendMessageAsync(IMessageChannel channel, BaseDiscordClient client,
string text, bool isTTS, Embed embed, RequestOptions options)
{
@@ -169,6 +163,30 @@ namespace Discord.Rest
}
#if FILESYSTEM
+ ///
+ /// is a zero-length string, contains only white space, or contains one or more
+ /// invalid characters as defined by .
+ ///
+ ///
+ /// is .
+ ///
+ ///
+ /// The specified path, file name, or both exceed the system-defined maximum length. For example, on
+ /// Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260
+ /// characters.
+ ///
+ ///
+ /// The specified path is invalid, (for example, it is on an unmapped drive).
+ ///
+ ///
+ /// specified a directory.-or- The caller does not have the required permission.
+ ///
+ ///
+ /// The file specified in was not found.
+ ///
+ /// is in an invalid format.
+ /// An I/O error occurred while opening the file.
+ /// Message content is too long, length must be less or equal to .
public static async Task SendFileAsync(IMessageChannel channel, BaseDiscordClient client,
string filePath, string text, bool isTTS, Embed embed, RequestOptions options)
{
@@ -177,6 +195,7 @@ namespace Discord.Rest
return await SendFileAsync(channel, client, file, filename, text, isTTS, embed, options).ConfigureAwait(false);
}
#endif
+ /// Message content is too long, length must be less or equal to .
public static async Task SendFileAsync(IMessageChannel channel, BaseDiscordClient client,
Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options)
{
@@ -249,6 +268,7 @@ namespace Discord.Rest
return user;
}
+ /// Resolving permissions requires the parent guild to be downloaded.
public static IAsyncEnumerable> GetUsersAsync(IGuildChannel channel, IGuild guild, BaseDiscordClient client,
ulong? fromUserId, int? limit, RequestOptions options)
{
diff --git a/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs b/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs
index 8668d890a..2895dc17d 100644
--- a/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
namespace Discord.Rest
{
///
- /// Represents a REST channel that can send and receive messages.
+ /// Represents a REST-based channel that can send and receive messages.
///
public interface IRestMessageChannel : IMessageChannel
{
diff --git a/src/Discord.Net.Rest/Entities/Channels/IRestPrivateChannel.cs b/src/Discord.Net.Rest/Entities/Channels/IRestPrivateChannel.cs
index 628dcb776..f387ac2d4 100644
--- a/src/Discord.Net.Rest/Entities/Channels/IRestPrivateChannel.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/IRestPrivateChannel.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace Discord.Rest
{
///
- /// Represents a REST channel that is private to select recipients.
+ /// Represents a REST-based channel that is private to select recipients.
///
public interface IRestPrivateChannel : IPrivateChannel
{
diff --git a/src/Discord.Net.Rest/Entities/Channels/RestCategoryChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestCategoryChannel.cs
index c6cbeeecc..eb3fdd94b 100644
--- a/src/Discord.Net.Rest/Entities/Channels/RestCategoryChannel.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/RestCategoryChannel.cs
@@ -7,7 +7,7 @@ using Model = Discord.API.Channel;
namespace Discord.Rest
{
///
- /// Represents a REST category channel.
+ /// Represents a REST-based category channel.
///
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class RestCategoryChannel : RestGuildChannel, ICategoryChannel
diff --git a/src/Discord.Net.Rest/Entities/Channels/RestChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestChannel.cs
index 04cc5a937..c6d765787 100644
--- a/src/Discord.Net.Rest/Entities/Channels/RestChannel.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/RestChannel.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@@ -8,12 +8,14 @@ namespace Discord.Rest
{
public class RestChannel : RestEntity, IChannel, IUpdateable
{
+ ///
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
internal RestChannel(BaseDiscordClient discord, ulong id)
: base(discord, id)
{
}
+ /// Unexpected channel type.
internal static RestChannel Create(BaseDiscordClient discord, Model model)
{
switch (model.Type)
@@ -28,6 +30,7 @@ namespace Discord.Rest
return new RestChannel(discord, model.Id);
}
}
+ /// Unexpected channel type.
internal static IRestPrivateChannel CreatePrivate(BaseDiscordClient discord, Model model)
{
switch (model.Type)
@@ -42,13 +45,17 @@ namespace Discord.Rest
}
internal virtual void Update(Model model) { }
+ ///
public virtual Task UpdateAsync(RequestOptions options = null) => Task.Delay(0);
//IChannel
+ ///
string IChannel.Name => null;
+ ///
Task IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
=> Task.FromResult(null); //Overridden
+ ///
IAsyncEnumerable> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
=> AsyncEnumerable.Empty>(); //Overridden
}
diff --git a/src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs
index ca71e719b..a3161c72c 100644
--- a/src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/RestDMChannel.cs
@@ -10,7 +10,7 @@ using Model = Discord.API.Channel;
namespace Discord.Rest
{
///
- /// Represents a REST DM channel.
+ /// Represents a REST-based DM channel.
///
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class RestDMChannel : RestChannel, IDMChannel, IRestPrivateChannel, IRestMessageChannel
@@ -37,6 +37,7 @@ namespace Discord.Rest
Recipient.Update(model.Recipients.Value[0]);
}
+ ///
public override async Task UpdateAsync(RequestOptions options = null)
{
var model = await Discord.ApiClient.GetChannelAsync(Id, options).ConfigureAwait(false);
@@ -93,16 +94,20 @@ namespace Discord.Rest
public override string ToString() => $"@{Recipient}";
private string DebuggerDisplay => $"@{Recipient} ({Id}, DM)";
- //IDMChannel
+ //IDMChannel
+ ///
IUser IDMChannel.Recipient => Recipient;
//IRestPrivateChannel
+ ///
IReadOnlyCollection IRestPrivateChannel.Recipients => ImmutableArray.Create(Recipient);
//IPrivateChannel
+ ///
IReadOnlyCollection IPrivateChannel.Recipients => ImmutableArray.Create(Recipient);
//IMessageChannel
+ ///
async Task IMessageChannel.GetMessageAsync(ulong id, CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -110,6 +115,7 @@ namespace Discord.Rest
else
return null;
}
+ ///
IAsyncEnumerable> IMessageChannel.GetMessagesAsync(int limit, CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -117,6 +123,7 @@ namespace Discord.Rest
else
return AsyncEnumerable.Empty>();
}
+ ///
IAsyncEnumerable> IMessageChannel.GetMessagesAsync(ulong fromMessageId, Direction dir, int limit, CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -124,6 +131,7 @@ namespace Discord.Rest
else
return AsyncEnumerable.Empty>();
}
+ ///
IAsyncEnumerable> IMessageChannel.GetMessagesAsync(IMessage fromMessage, Direction dir, int limit, CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -131,25 +139,33 @@ namespace Discord.Rest
else
return AsyncEnumerable.Empty>();
}
+ ///
async Task> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
=> await GetPinnedMessagesAsync(options).ConfigureAwait(false);
#if FILESYSTEM
+ ///
async Task IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options)
=> await SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false);
#endif
+ ///
async Task IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options)
=> await SendFileAsync(stream, filename, text, isTTS, embed, options).ConfigureAwait(false);
+ ///
async Task IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options)
=> await SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
+ ///
IDisposable IMessageChannel.EnterTypingState(RequestOptions options)
=> EnterTypingState(options);
//IChannel
+ ///
string IChannel.Name => $"@{Recipient}";
+ ///
Task IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
=> Task.FromResult(GetUser(id));
+ ///
IAsyncEnumerable> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
=> ImmutableArray.Create>(Users).ToAsyncEnumerable();
}
diff --git a/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs
index c8eeabf00..7c3cc53c9 100644
--- a/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs
@@ -146,6 +146,7 @@ namespace Discord.Rest
public override string ToString() => Name;
//IGuildChannel
+ ///
IGuild IGuildChannel.Guild
{
get
@@ -156,32 +157,44 @@ namespace Discord.Rest
}
}
+ ///
async Task> IGuildChannel.GetInvitesAsync(RequestOptions options)
=> await GetInvitesAsync(options).ConfigureAwait(false);
+ ///
async Task IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, bool isUnique, RequestOptions options)
=> await CreateInviteAsync(maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false);
+ ///
OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IRole role)
=> GetPermissionOverwrite(role);
+ ///
OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IUser user)
=> GetPermissionOverwrite(user);
+ ///
async Task IGuildChannel.AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options)
=> await AddPermissionOverwriteAsync(role, permissions, options).ConfigureAwait(false);
+ ///
async Task IGuildChannel.AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options)
=> await AddPermissionOverwriteAsync(user, permissions, options).ConfigureAwait(false);
+ ///
async Task IGuildChannel.RemovePermissionOverwriteAsync(IRole role, RequestOptions options)
=> await RemovePermissionOverwriteAsync(role, options).ConfigureAwait(false);
+ ///
async Task IGuildChannel.RemovePermissionOverwriteAsync(IUser user, RequestOptions options)
=> await RemovePermissionOverwriteAsync(user, options).ConfigureAwait(false);
+ ///
IAsyncEnumerable> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
=> AsyncEnumerable.Empty>(); //Overridden //Overridden in Text/Voice
+ ///
Task IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
=> Task.FromResult(null); //Overridden in Text/Voice
//IChannel
+ ///
IAsyncEnumerable> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
=> AsyncEnumerable.Empty>(); //Overridden in Text/Voice
+ ///
Task IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
=> Task.FromResult(null); //Overridden in Text/Voice
}
diff --git a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
index 38c5fe9e2..b279f06a3 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
@@ -1,4 +1,4 @@
-using Discord.API.Rest;
+using Discord.API.Rest;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -14,10 +14,11 @@ namespace Discord.Rest
internal static class GuildHelper
{
//General
+ /// is .
public static async Task ModifyAsync(IGuild guild, BaseDiscordClient client,
Action func, RequestOptions options)
{
- if (func == null) throw new NullReferenceException(nameof(func));
+ if (func == null) throw new ArgumentNullException(nameof(func));
var args = new GuildProperties();
func(args);
@@ -62,10 +63,11 @@ namespace Discord.Rest
return await client.ApiClient.ModifyGuildAsync(guild.Id, apiArgs, options).ConfigureAwait(false);
}
+ /// is .
public static async Task ModifyEmbedAsync(IGuild guild, BaseDiscordClient client,
Action func, RequestOptions options)
{
- if (func == null) throw new NullReferenceException(nameof(func));
+ if (func == null) throw new ArgumentNullException(nameof(func));
var args = new GuildEmbedProperties();
func(args);
@@ -139,6 +141,7 @@ namespace Discord.Rest
var models = await client.ApiClient.GetGuildChannelsAsync(guild.Id, options).ConfigureAwait(false);
return models.Select(x => RestGuildChannel.Create(client, guild, x)).ToImmutableArray();
}
+ /// is .
public static async Task CreateTextChannelAsync(IGuild guild, BaseDiscordClient client,
string name, RequestOptions options)
{
@@ -148,6 +151,7 @@ namespace Discord.Rest
var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false);
return RestTextChannel.Create(client, guild, model);
}
+ /// is .
public static async Task CreateVoiceChannelAsync(IGuild guild, BaseDiscordClient client,
string name, RequestOptions options)
{
@@ -157,6 +161,7 @@ namespace Discord.Rest
var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false);
return RestVoiceChannel.Create(client, guild, model);
}
+ /// is .
public static async Task CreateCategoryChannelAsync(IGuild guild, BaseDiscordClient client,
string name, RequestOptions options)
{
@@ -191,6 +196,7 @@ namespace Discord.Rest
}
//Roles
+ /// is .
public static async Task CreateRoleAsync(IGuild guild, BaseDiscordClient client,
string name, GuildPermissions? permissions, Color? color, bool isHoisted, RequestOptions options)
{
@@ -292,11 +298,12 @@ namespace Discord.Rest
Image = image.ToModel()
};
if (roles.IsSpecified)
- apiargs.RoleIds = roles.Value?.Select(xr => xr.Id)?.ToArray();
+ apiargs.RoleIds = roles.Value?.Select(xr => xr.Id).ToArray();
var emote = await client.ApiClient.CreateGuildEmoteAsync(guild.Id, apiargs, options).ConfigureAwait(false);
return emote.ToEntity();
}
+ /// is .
public static async Task ModifyEmoteAsync(IGuild guild, BaseDiscordClient client, ulong id, Action func,
RequestOptions options)
{
@@ -310,7 +317,7 @@ namespace Discord.Rest
Name = props.Name
};
if (props.Roles.IsSpecified)
- apiargs.RoleIds = props.Roles.Value?.Select(xr => xr.Id)?.ToArray();
+ apiargs.RoleIds = props.Roles.Value?.Select(xr => xr.Id).ToArray();
var emote = await client.ApiClient.ModifyGuildEmoteAsync(guild.Id, id, apiargs, options).ConfigureAwait(false);
return emote.ToEntity();
diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestBan.cs b/src/Discord.Net.Rest/Entities/Guilds/RestBan.cs
index 104bec903..2c65c8b59 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/RestBan.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/RestBan.cs
@@ -1,4 +1,4 @@
-using System.Diagnostics;
+using System.Diagnostics;
using Model = Discord.API.Ban;
namespace Discord.Rest
@@ -7,6 +7,7 @@ namespace Discord.Rest
public class RestBan : IBan
{
public RestUser User { get; }
+ ///
public string Reason { get; }
internal RestBan(RestUser user, string reason)
@@ -23,6 +24,7 @@ namespace Discord.Rest
private string DebuggerDisplay => $"{User}: {Reason}";
//IBan
+ ///
IUser IBan.User => User;
}
}
diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
index fc5ef307f..5a79565ba 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
@@ -10,6 +10,9 @@ using Model = Discord.API.Guild;
namespace Discord.Rest
{
+ ///
+ /// Represents a REST-based guild/server.
+ ///
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class RestGuild : RestEntity, IGuild, IUpdateable
{
@@ -17,32 +20,50 @@ namespace Discord.Rest
private ImmutableArray _emotes;
private ImmutableArray _features;
+ ///
public string Name { get; private set; }
+ ///
public int AFKTimeout { get; private set; }
+ ///
public bool IsEmbeddable { get; private set; }
+ ///
public VerificationLevel VerificationLevel { get; private set; }
+ ///
public MfaLevel MfaLevel { get; private set; }
+ ///
public DefaultMessageNotifications DefaultMessageNotifications { get; private set; }
+ ///
public ulong? AFKChannelId { get; private set; }
+ ///
public ulong? EmbedChannelId { get; private set; }
+ ///
public ulong? SystemChannelId { get; private set; }
+ ///
public ulong OwnerId { get; private set; }
+ ///
public string VoiceRegionId { get; private set; }
+ ///
public string IconId { get; private set; }
+ ///
public string SplashId { get; private set; }
internal bool Available { get; private set; }
+ ///
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
[Obsolete("DefaultChannelId is deprecated, use GetDefaultChannelAsync")]
public ulong DefaultChannelId => Id;
+ ///
public string IconUrl => CDN.GetGuildIconUrl(Id, IconId);
+ ///
public string SplashUrl => CDN.GetGuildSplashUrl(Id, SplashId);
public RestRole EveryoneRole => GetRole(Id);
public IReadOnlyCollection Roles => _roles.ToReadOnlyCollection();
+ ///
public IReadOnlyCollection Emotes => _emotes;
+ ///
public IReadOnlyCollection Features => _features;
internal RestGuild(BaseDiscordClient client, ulong id)
@@ -103,37 +124,48 @@ namespace Discord.Rest
}
//General
+ ///
public async Task UpdateAsync(RequestOptions options = null)
=> Update(await Discord.ApiClient.GetGuildAsync(Id, options).ConfigureAwait(false));
+ ///
public Task DeleteAsync(RequestOptions options = null)
=> GuildHelper.DeleteAsync(this, Discord, options);
+ ///
+ /// is .
public async Task ModifyAsync(Action func, RequestOptions options = null)
{
var model = await GuildHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false);
Update(model);
}
+
+ ///
+ /// is .
public async Task ModifyEmbedAsync(Action func, RequestOptions options = null)
{
var model = await GuildHelper.ModifyEmbedAsync(this, Discord, func, options).ConfigureAwait(false);
Update(model);
}
+
+ ///
+ /// is .
public async Task ReorderChannelsAsync(IEnumerable args, RequestOptions options = null)
{
var arr = args.ToArray();
await GuildHelper.ReorderChannelsAsync(this, Discord, arr, options).ConfigureAwait(false);
}
+ ///
public async Task ReorderRolesAsync(IEnumerable args, RequestOptions options = null)
{
var models = await GuildHelper.ReorderRolesAsync(this, Discord, args, options).ConfigureAwait(false);
foreach (var model in models)
{
var role = GetRole(model.Id);
- if (role != null)
- role.Update(model);
+ role?.Update(model);
}
}
-
+
+ ///
public Task LeaveAsync(RequestOptions options = null)
=> GuildHelper.LeaveAsync(this, Discord, options);
@@ -141,13 +173,17 @@ namespace Discord.Rest
public Task> GetBansAsync(RequestOptions options = null)
=> GuildHelper.GetBansAsync(this, Discord, options);
+ ///
public Task AddBanAsync(IUser user, int pruneDays = 0, string reason = null, RequestOptions options = null)
=> GuildHelper.AddBanAsync(this, Discord, user.Id, pruneDays, reason, options);
+ ///
public Task AddBanAsync(ulong userId, int pruneDays = 0, string reason = null, RequestOptions options = null)
=> GuildHelper.AddBanAsync(this, Discord, userId, pruneDays, reason, options);
+ ///
public Task RemoveBanAsync(IUser user, RequestOptions options = null)
=> GuildHelper.RemoveBanAsync(this, Discord, user.Id, options);
+ ///
public Task RemoveBanAsync(ulong userId, RequestOptions options = null)
=> GuildHelper.RemoveBanAsync(this, Discord, userId, options);
@@ -261,6 +297,7 @@ namespace Discord.Rest
public Task GetOwnerAsync(RequestOptions options = null)
=> GuildHelper.GetUserAsync(this, Discord, OwnerId, options);
+ ///
public Task PruneUsersAsync(int days = 30, bool simulate = false, RequestOptions options = null)
=> GuildHelper.PruneUsersAsync(this, Discord, days, simulate, options);
@@ -270,28 +307,45 @@ namespace Discord.Rest
public Task> GetWebhooksAsync(RequestOptions options = null)
=> GuildHelper.GetWebhooksAsync(this, Discord, options);
+ ///
+ /// Returns the name of the guild.
+ ///
+ ///
+ /// The name of the guild.
+ ///
public override string ToString() => Name;
private string DebuggerDisplay => $"{Name} ({Id})";
//Emotes
+ ///
public Task GetEmoteAsync(ulong id, RequestOptions options = null)
=> GuildHelper.GetEmoteAsync(this, Discord, id, options);
+ ///
public Task CreateEmoteAsync(string name, Image image, Optional> roles = default(Optional>), RequestOptions options = null)
=> GuildHelper.CreateEmoteAsync(this, Discord, name, image, roles, options);
+ ///
+ /// is .
public Task ModifyEmoteAsync(GuildEmote emote, Action func, RequestOptions options = null)
=> GuildHelper.ModifyEmoteAsync(this, Discord, emote.Id, func, options);
+ ///
public Task DeleteEmoteAsync(GuildEmote emote, RequestOptions options = null)
=> GuildHelper.DeleteEmoteAsync(this, Discord, emote.Id, options);
//IGuild
+ ///
bool IGuild.Available => Available;
+ ///
IAudioClient IGuild.AudioClient => null;
+ ///
IRole IGuild.EveryoneRole => EveryoneRole;
+ ///
IReadOnlyCollection IGuild.Roles => Roles;
+ ///
async Task> IGuild.GetBansAsync(RequestOptions options)
=> await GetBansAsync(options).ConfigureAwait(false);
+ ///
async Task> IGuild.GetChannelsAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -299,6 +353,7 @@ namespace Discord.Rest
else
return ImmutableArray.Create();
}
+ ///
async Task IGuild.GetChannelAsync(ulong id, CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -306,6 +361,7 @@ namespace Discord.Rest
else
return null;
}
+ ///
async Task> IGuild.GetTextChannelsAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -313,6 +369,7 @@ namespace Discord.Rest
else
return ImmutableArray.Create();
}
+ ///
async Task IGuild.GetTextChannelAsync(ulong id, CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -320,6 +377,7 @@ namespace Discord.Rest
else
return null;
}
+ ///
async Task> IGuild.GetVoiceChannelsAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -327,6 +385,7 @@ namespace Discord.Rest
else
return ImmutableArray.Create();
}
+ ///
async Task> IGuild.GetCategoriesAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -334,6 +393,7 @@ namespace Discord.Rest
else
return null;
}
+ ///
async Task IGuild.GetVoiceChannelAsync(ulong id, CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -341,6 +401,7 @@ namespace Discord.Rest
else
return null;
}
+ ///
async Task IGuild.GetAFKChannelAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -348,6 +409,7 @@ namespace Discord.Rest
else
return null;
}
+ ///
async Task IGuild.GetDefaultChannelAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -355,6 +417,7 @@ namespace Discord.Rest
else
return null;
}
+ ///
async Task IGuild.GetEmbedChannelAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -362,6 +425,7 @@ namespace Discord.Rest
else
return null;
}
+ ///
async Task IGuild.GetSystemChannelAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -369,26 +433,35 @@ namespace Discord.Rest
else
return null;
}
+ ///
async Task IGuild.CreateTextChannelAsync(string name, RequestOptions options)
=> await CreateTextChannelAsync(name, options).ConfigureAwait(false);
+ ///
async Task IGuild.CreateVoiceChannelAsync(string name, RequestOptions options)
=> await CreateVoiceChannelAsync(name, options).ConfigureAwait(false);
+ ///
async Task IGuild.CreateCategoryAsync(string name, RequestOptions options)
=> await CreateCategoryChannelAsync(name, options).ConfigureAwait(false);
+ ///
async Task> IGuild.GetIntegrationsAsync(RequestOptions options)
=> await GetIntegrationsAsync(options).ConfigureAwait(false);
+ ///
async Task IGuild.CreateIntegrationAsync(ulong id, string type, RequestOptions options)
=> await CreateIntegrationAsync(id, type, options).ConfigureAwait(false);
+ ///
async Task> IGuild.GetInvitesAsync(RequestOptions options)
=> await GetInvitesAsync(options).ConfigureAwait(false);
+ ///
IRole IGuild.GetRole(ulong id)
=> GetRole(id);
+ ///
async Task IGuild.CreateRoleAsync(string name, GuildPermissions? permissions, Color? color, bool isHoisted, RequestOptions options)
=> await CreateRoleAsync(name, permissions, color, isHoisted, options).ConfigureAwait(false);
+ ///
async Task IGuild.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -396,6 +469,7 @@ namespace Discord.Rest
else
return null;
}
+ ///
async Task IGuild.GetCurrentUserAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -403,6 +477,7 @@ namespace Discord.Rest
else
return null;
}
+ ///
async Task IGuild.GetOwnerAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -410,6 +485,7 @@ namespace Discord.Rest
else
return null;
}
+ ///
async Task> IGuild.GetUsersAsync(CacheMode mode, RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
@@ -418,12 +494,14 @@ namespace Discord.Rest
return ImmutableArray.Create();
}
///
- /// Downloading users is not supported with a REST-based guild.
+ /// Downloading users is not supported for a REST-based guild.
Task IGuild.DownloadUsersAsync() =>
throw new NotSupportedException();
+ ///
async Task IGuild.GetWebhookAsync(ulong id, RequestOptions options)
=> await GetWebhookAsync(id, options).ConfigureAwait(false);
+ ///
async Task> IGuild.GetWebhooksAsync(RequestOptions options)
=> await GetWebhooksAsync(options).ConfigureAwait(false);
}
diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuildEmbed.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuildEmbed.cs
index f26a62d8d..00f3fae69 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/RestGuildEmbed.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuildEmbed.cs
@@ -1,4 +1,4 @@
-using System.Diagnostics;
+using System.Diagnostics;
using Model = Discord.API.GuildEmbed;
namespace Discord
@@ -19,7 +19,7 @@ namespace Discord
return new RestGuildEmbed(model.Enabled, model.ChannelId);
}
- public override string ToString() => ChannelId?.ToString();
+ public override string ToString() => ChannelId?.ToString() ?? "Unknown";
private string DebuggerDisplay => $"{ChannelId} ({(IsEnabled ? "Enabled" : "Disabled")})";
}
}
diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuildIntegration.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuildIntegration.cs
index eadda53f2..9759e64d2 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/RestGuildIntegration.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuildIntegration.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Model = Discord.API.Integration;
@@ -10,18 +10,28 @@ namespace Discord.Rest
{
private long _syncedAtTicks;
+ ///
public string Name { get; private set; }
+ ///
public string Type { get; private set; }
+ ///
public bool IsEnabled { get; private set; }
+ ///
public bool IsSyncing { get; private set; }
+ ///
public ulong ExpireBehavior { get; private set; }
+ ///
public ulong ExpireGracePeriod { get; private set; }
+ ///
public ulong GuildId { get; private set; }
+ ///
public ulong RoleId { get; private set; }
public RestUser User { get; private set; }
+ ///
public IntegrationAccount Account { get; private set; }
internal IGuild Guild { get; private set; }
+ ///
public DateTimeOffset SyncedAt => DateTimeUtils.FromTicks(_syncedAtTicks);
internal RestGuildIntegration(BaseDiscordClient discord, IGuild guild, ulong id)
@@ -78,6 +88,7 @@ namespace Discord.Rest
public override string ToString() => Name;
private string DebuggerDisplay => $"{Name} ({Id}{(IsEnabled ? ", Enabled" : "")})";
+ ///
IGuild IGuildIntegration.Guild
{
get
@@ -87,6 +98,7 @@ namespace Discord.Rest
throw new InvalidOperationException("Unable to return this entity's parent unless it was fetched through that object.");
}
}
+ ///
IUser IGuildIntegration.User => User;
}
}
diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestUserGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestUserGuild.cs
index de5a5f7d9..b75d6288e 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/RestUserGuild.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/RestUserGuild.cs
@@ -9,12 +9,17 @@ namespace Discord.Rest
public class RestUserGuild : RestEntity, IUserGuild
{
private string _iconId;
-
+
+ ///
public string Name { get; private set; }
+ ///
public bool IsOwner { get; private set; }
+ ///
public GuildPermissions Permissions { get; private set; }
+ ///
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
+ ///
public string IconUrl => CDN.GetGuildIconUrl(Id, _iconId);
internal RestUserGuild(BaseDiscordClient discord, ulong id)
@@ -40,6 +45,7 @@ namespace Discord.Rest
{
await Discord.ApiClient.LeaveGuildAsync(Id, options).ConfigureAwait(false);
}
+ ///
public async Task DeleteAsync(RequestOptions options = null)
{
await Discord.ApiClient.DeleteGuildAsync(Id, options).ConfigureAwait(false);
diff --git a/src/Discord.Net.Rest/Entities/Invites/RestInvite.cs b/src/Discord.Net.Rest/Entities/Invites/RestInvite.cs
index 6df97f6f7..62fdaeaba 100644
--- a/src/Discord.Net.Rest/Entities/Invites/RestInvite.cs
+++ b/src/Discord.Net.Rest/Entities/Invites/RestInvite.cs
@@ -59,7 +59,8 @@ namespace Discord.Rest
public override string ToString() => Url;
private string DebuggerDisplay => $"{Url} ({GuildName} / {ChannelName})";
-
+
+ ///
IGuild IInvite.Guild
{
get
@@ -71,6 +72,7 @@ namespace Discord.Rest
throw new InvalidOperationException("Unable to return this entity's parent unless it was fetched through that object.");
}
}
+ ///
IChannel IInvite.Channel
{
get
diff --git a/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs b/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
index 071628da0..34e64cd5a 100644
--- a/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
@@ -10,11 +10,13 @@ namespace Discord.Rest
{
internal static class MessageHelper
{
+ /// Only the author of a message may modify the message.
+ /// Message content is too long, length must be less or equal to .
public static async Task ModifyAsync(IMessage msg, BaseDiscordClient client, Action func,
RequestOptions options)
{
if (msg.Author.Id != client.CurrentUser.Id)
- throw new InvalidOperationException("Only the author of a message may change it.");
+ throw new InvalidOperationException("Only the author of a message may modify the message.");
var args = new MessageProperties();
func(args);
diff --git a/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs b/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs
index 84fef4c18..6d18beaad 100644
--- a/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs
+++ b/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs
@@ -35,6 +35,7 @@ namespace Discord.Rest
///
public virtual IReadOnlyCollection MentionedRoleIds => ImmutableArray.Create();
public virtual IReadOnlyCollection MentionedUsers => ImmutableArray.Create();
+ ///
public virtual IReadOnlyCollection Tags => ImmutableArray.Create();
///
@@ -75,10 +76,14 @@ namespace Discord.Rest
public override string ToString() => Content;
+ ///
MessageType IMessage.Type => MessageType.Default;
IUser IMessage.Author => Author;
+ ///
IReadOnlyCollection IMessage.Attachments => Attachments;
+ ///
IReadOnlyCollection IMessage.Embeds => Embeds;
+ ///
IReadOnlyCollection IMessage.MentionedUserIds => MentionedUsers.Select(x => x.Id).ToImmutableArray();
}
}
diff --git a/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs b/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs
index 0d1f3be2b..de295af94 100644
--- a/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs
+++ b/src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs
@@ -17,23 +17,33 @@ namespace Discord.Rest
private ImmutableArray