diff --git a/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs b/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs
index da8b0a637..7abecf54d 100644
--- a/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs
+++ b/src/Discord.Net.Core/Entities/Channels/IMessageChannel.cs
@@ -117,7 +117,7 @@ namespace Discord
///
/// The options to be used when sending the request.
///
- /// A collection of messages.
+ /// An awaitable Task containing a collection of messages.
///
Task> GetPinnedMessagesAsync(RequestOptions options = null);
diff --git a/src/Discord.Net.Core/Entities/Messages/IMessage.cs b/src/Discord.Net.Core/Entities/Messages/IMessage.cs
index d66a6b883..c8ed14f0c 100644
--- a/src/Discord.Net.Core/Entities/Messages/IMessage.cs
+++ b/src/Discord.Net.Core/Entities/Messages/IMessage.cs
@@ -31,14 +31,20 @@ namespace Discord
///
/// Gets the time this message was sent.
///
+ ///
+ /// Time of when the message was sent.
+ ///
DateTimeOffset Timestamp { get; }
///
- /// Gets the time of this message's last edit, or if none is set.
+ /// Gets the time of this message's last edit.
///
+ ///
+ /// Time of when the message was last edited; when the message is never edited.
+ ///
DateTimeOffset? EditedTimestamp { get; }
///
- /// Gets the channel this message was sent to.
+ /// Gets the source channel of the message.
///
IMessageChannel Channel { get; }
///
@@ -49,10 +55,16 @@ namespace Discord
///
/// Returns all attachments included in this message.
///
+ ///
+ /// Collection of attachments.
+ ///
IReadOnlyCollection Attachments { get; }
///
/// Returns all embeds included in this message.
///
+ ///
+ /// Collection of embed objects.
+ ///
IReadOnlyCollection Embeds { get; }
///
/// Returns all tags included in this message's content.
@@ -61,14 +73,23 @@ namespace Discord
///
/// Returns the IDs of channels mentioned in this message.
///
+ ///
+ /// Collection of channel IDs.
+ ///
IReadOnlyCollection MentionedChannelIds { get; }
///
/// Returns the IDs of roles mentioned in this message.
///
+ ///
+ /// Collection of role IDs.
+ ///
IReadOnlyCollection MentionedRoleIds { get; }
///
/// Returns the IDs of users mentioned in this message.
///
+ ///
+ /// Collection of user IDs.
+ ///
IReadOnlyCollection MentionedUserIds { get; }
}
}
diff --git a/src/Discord.Net.Core/Entities/Messages/ISystemMessage.cs b/src/Discord.Net.Core/Entities/Messages/ISystemMessage.cs
index 0f5a171d1..89cd17a35 100644
--- a/src/Discord.Net.Core/Entities/Messages/ISystemMessage.cs
+++ b/src/Discord.Net.Core/Entities/Messages/ISystemMessage.cs
@@ -1,7 +1,7 @@
namespace Discord
{
///
- /// Represents a message sent by the system.
+ /// Represents a generic message sent by the system.
///
public interface ISystemMessage : IMessage
{
diff --git a/src/Discord.Net.Core/Entities/Messages/IUserMessage.cs b/src/Discord.Net.Core/Entities/Messages/IUserMessage.cs
index 1afb3a3b2..18ef93266 100644
--- a/src/Discord.Net.Core/Entities/Messages/IUserMessage.cs
+++ b/src/Discord.Net.Core/Entities/Messages/IUserMessage.cs
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
namespace Discord
{
///
- /// Represents a Discord message object.
+ /// Represents a generic message sent by a user.
///
public interface IUserMessage : IMessage
{
diff --git a/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs b/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs
index 2895dc17d..37a5ef9cf 100644
--- a/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/IRestMessageChannel.cs
@@ -12,37 +12,102 @@ namespace Discord.Rest
///
/// Sends a message to this message channel.
///
+ /// The message to be sent.
+ /// Whether the message should be read aloud by Discord or not.
+ /// The to be sent.
+ /// The options to be used when sending the request.
+ ///
+ /// An awaitable Task containing the message sent to the channel.
+ ///
new Task SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null);
#if FILESYSTEM
///
/// Sends a file to this message channel, with an optional caption.
///
+ /// The file path of the file.
+ /// The message to be sent.
+ /// Whether the message should be read aloud by Discord or not.
+ /// The to be sent.
+ /// The options to be used when sending the request.
+ ///
+ /// If you wish to upload an image and have it embedded in a embed, you may
+ /// upload the file and refer to the file with "attachment://filename.ext" in the
+ /// .
+ ///
+ ///
+ /// An awaitable Task containing the message sent to the channel.
+ ///
new Task SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null);
#endif
///
/// Sends a file to this message channel, with an optional caption.
///
+ /// The of the file to be sent.
+ /// The name of the attachment.
+ /// The message to be sent.
+ /// Whether the message should be read aloud by Discord or not.
+ /// The to be sent.
+ /// The options to be used when sending the request.
+ ///
+ /// If you wish to upload an image and have it embedded in a embed, you may
+ /// upload the file and refer to the file with "attachment://filename.ext" in the
+ /// .
+ ///
+ ///
+ /// An awaitable Task containing the message sent to the channel.
+ ///
new Task SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null);
///
- /// Gets a message from this message channel with the given ID, or if not found.
+ /// Gets a message from this message channel with the given id, or if not found.
///
+ /// The ID of the message.
+ /// The options to be used when sending the request.
+ ///
+ /// The message gotten from either the cache or the download, or if none is found.
+ ///
Task GetMessageAsync(ulong id, RequestOptions options = null);
///
/// Gets the last N messages from this message channel.
///
+ /// The numbers of message to be gotten from.
+ /// The options to be used when sending the request.
+ ///
+ /// Paged collection of messages. Flattening the paginated response into a collection of messages with
+ /// is required if you wish to access the messages.
+ ///
IAsyncEnumerable> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null);
///
/// Gets a collection of messages in this channel.
///
+ /// The ID of the starting message to get the messages from.
+ /// The direction of the messages to be gotten from.
+ /// The numbers of message to be gotten from.
+ /// The options to be used when sending the request.
+ ///
+ /// Paged collection of messages. Flattening the paginated response into a collection of messages with
+ /// is required if you wish to access the messages.
+ ///
IAsyncEnumerable> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null);
///
/// Gets a collection of messages in this channel.
///
+ /// The starting message to get the messages from.
+ /// The direction of the messages to be gotten from.
+ /// The numbers of message to be gotten from.
+ /// The options to be used when sending the request.
+ ///
+ /// Paged collection of messages. Flattening the paginated response into a collection of messages with
+ /// is required if you wish to access the messages.
+ ///
IAsyncEnumerable> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null);
///
/// Gets a collection of pinned messages in this channel.
///
+ /// The options to be used when sending the request.
+ ///
+ /// An awaitable Task containing a collection of messages.
+ ///
new Task> GetPinnedMessagesAsync(RequestOptions options = null);
}
}
diff --git a/src/Discord.Net.WebSocket/Entities/Channels/ISocketMessageChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/ISocketMessageChannel.cs
index 6d769b9c4..59c382184 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/ISocketMessageChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/ISocketMessageChannel.cs
@@ -10,7 +10,12 @@ namespace Discord.WebSocket
///
public interface ISocketMessageChannel : IMessageChannel
{
- /// Gets all messages in this channel's cache.
+ ///
+ /// Gets all messages in this channel's cache.
+ ///
+ ///
+ /// A collection of WebSocket-based messages.
+ ///
IReadOnlyCollection CachedMessages { get; }
///
@@ -20,6 +25,9 @@ namespace Discord.WebSocket
/// Whether the message should be read aloud by Discord or not.
/// The to be sent.
/// The options to be used when sending the request.
+ ///
+ /// An awaitable Task containing the message sent to the channel.
+ ///
new Task SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null);
#if FILESYSTEM
///
@@ -35,6 +43,9 @@ namespace Discord.WebSocket
/// upload the file and refer to the file with "attachment://filename.ext" in the
/// .
///
+ ///
+ /// An awaitable Task containing the message sent to the channel.
+ ///
new Task SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null);
#endif
///
@@ -51,14 +62,47 @@ namespace Discord.WebSocket
/// upload the file and refer to the file with "attachment://filename.ext" in the
/// .
///
+ ///
+ /// An awaitable Task containing the message sent to the channel.
+ ///
new Task SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null);
+ ///
+ /// Gets the cached message if one exists.
+ ///
+ /// The ID of the message.
+ ///
+ /// Cached message object; if it doesn't exist in the cache.
+ ///
SocketMessage GetCachedMessage(ulong id);
- /// Gets the last N messages from this message channel.
+ ///
+ /// Gets the last N messages from this message channel.
+ ///
+ /// The number of messages to get.
+ ///
+ /// A collection of WebSocket-based messages.
+ ///
IReadOnlyCollection GetCachedMessages(int limit = DiscordConfig.MaxMessagesPerBatch);
- /// Gets a collection of messages in this channel.
+
+ ///
+ /// Gets a collection of messages in this channel.
+ ///
+ /// The message ID to start the fetching from.
+ /// The direction of which the message should be gotten from.
+ /// The number of messages to get.
+ ///
+ /// A collection of WebSocket-based messages.
+ ///
IReadOnlyCollection GetCachedMessages(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch);
- /// Gets a collection of messages in this channel.
+ ///
+ /// Gets a collection of messages in this channel.
+ ///
+ /// The message to start the fetching from.
+ /// The direction of which the message should be gotten from.
+ /// The number of messages to get.
+ ///
+ /// A collection of WebSocket-based messages.
+ ///
IReadOnlyCollection GetCachedMessages(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch);
///
/// Gets a collection of pinned messages in this channel.
diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketCategoryChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketCategoryChannel.cs
index 1305233e4..37e6afef1 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketCategoryChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketCategoryChannel.cs
@@ -14,6 +14,7 @@ namespace Discord.WebSocket
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class SocketCategoryChannel : SocketGuildChannel, ICategoryChannel
{
+ ///
public override IReadOnlyCollection Users
=> Guild.Users.Where(x => Permissions.GetValue(
Permissions.ResolveChannel(Guild, x, this, Permissions.ResolveGuild(Guild, x)),
diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs
index 8008d434a..eab60f6c9 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketDMChannel.cs
@@ -30,7 +30,7 @@ namespace Discord.WebSocket
Recipient = recipient;
recipient.GlobalUser.AddRef();
if (Discord.MessageCacheSize > 0)
- _messages = new MessageCache(Discord, this);
+ _messages = new MessageCache(Discord);
}
internal static SocketDMChannel Create(DiscordSocketClient discord, ClientState state, Model model)
{
diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs
index 94bf70493..57fcc51a2 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketGroupChannel.cs
@@ -39,7 +39,7 @@ namespace Discord.WebSocket
: base(discord, id)
{
if (Discord.MessageCacheSize > 0)
- _messages = new MessageCache(Discord, this);
+ _messages = new MessageCache(Discord);
_voiceStates = new ConcurrentDictionary(ConcurrentHashSet.DefaultConcurrencyLevel, 5);
_users = new ConcurrentDictionary(ConcurrentHashSet.DefaultConcurrencyLevel, 5);
}
@@ -108,6 +108,7 @@ namespace Discord.WebSocket
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options);
///
+ /// Message content is too long, length must be less or equal to .
public Task SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null)
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
#if FILESYSTEM
diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs
index 8d6f22133..ecbbbcd49 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs
@@ -21,7 +21,7 @@ namespace Discord.WebSocket
/// Gets the guild associated with this channel.
///
///
- /// The guild that this channel belongs to.
+ /// A guild that this channel belongs to.
///
public SocketGuild Guild { get; }
///
@@ -34,7 +34,7 @@ namespace Discord.WebSocket
/// Gets the parent category of this channel.
///
///
- /// The parent category ID associated with this channel, or if none is set.
+ /// A parent category ID associated with this channel, or if none is set.
///
public ICategoryChannel Category
=> CategoryId.HasValue ? Guild.GetChannel(CategoryId.Value) as ICategoryChannel : null;
@@ -42,7 +42,7 @@ namespace Discord.WebSocket
///
public IReadOnlyCollection PermissionOverwrites => _overwrites;
///
- /// Returns a collection of users that are able to view the channel.
+ /// Gets a collection of users that are able to view the channel.
///
///
/// A collection of users that can access the channel (i.e. the users seen in the user list).
diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs
index ae8ab54da..eed8f45b9 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketTextChannel.cs
@@ -39,7 +39,7 @@ namespace Discord.WebSocket
: base(discord, id, guild)
{
if (Discord.MessageCacheSize > 0)
- _messages = new MessageCache(Discord, this);
+ _messages = new MessageCache(Discord);
}
internal new static SocketTextChannel Create(SocketGuild guild, ClientState state, Model model)
{
diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
index 1f027e321..029e600fc 100644
--- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
+++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
@@ -91,11 +91,11 @@ namespace Discord.WebSocket
public Task SyncPromise => _syncPromise.Task;
public Task DownloaderPromise => _downloaderPromise.Task;
///
- /// Returns the associated with this guild.
+ /// Gets the associated with this guild.
///
public IAudioClient AudioClient => _audioClient;
///
- /// Returns the first viewable text channel.
+ /// Gets the first viewable text channel.
///
///
/// This property does not guarantee the user can send message to it.
@@ -105,7 +105,7 @@ namespace Discord.WebSocket
.OrderBy(c => c.Position)
.FirstOrDefault();
///
- /// Returns the AFK voice channel, or if none is set.
+ /// Gets the AFK voice channel, or if none is set.
///
public SocketVoiceChannel AFKChannel
{
@@ -138,31 +138,34 @@ namespace Discord.WebSocket
}
}
///
- /// Returns a collection of text channels present in this guild.
+ /// Gets a collection of text channels present in this guild.
///
public IReadOnlyCollection TextChannels
=> Channels.Select(x => x as SocketTextChannel).Where(x => x != null).ToImmutableArray();
///
- /// Returns a collection of voice channels present in this guild.
+ /// Gets a collection of voice channels present in this guild.
///
public IReadOnlyCollection VoiceChannels
=> Channels.Select(x => x as SocketVoiceChannel).Where(x => x != null).ToImmutableArray();
///
- /// Returns a collection of category channels present in this guild.
+ /// Gets a collection of category channels present in this guild.
///
public IReadOnlyCollection CategoryChannels
=> Channels.Select(x => x as SocketCategoryChannel).Where(x => x != null).ToImmutableArray();
///
- /// Returns the current logged-in user.
+ /// Gets the current logged-in user.
///
public SocketGuildUser CurrentUser => _members.TryGetValue(Discord.CurrentUser.Id, out SocketGuildUser member) ? member : null;
///
- /// Returns the @everyone role in this guild.
+ /// Gets the @everyone role in this guild.
///
public SocketRole EveryoneRole => GetRole(Id);
///
- /// Returns a collection of channels present in this guild.
+ /// Gets a collection of channels present in this guild.
///
+ ///
+ /// Collection of channels.
+ ///
public IReadOnlyCollection Channels
{
get
@@ -175,10 +178,16 @@ namespace Discord.WebSocket
///
/// Gets a collection of emotes created in this guild.
///
+ ///
+ /// Collection of emotes.
+ ///
public IReadOnlyCollection Emotes => _emotes;
///
/// Gets a collection of features enabled in this guild.
///
+ ///
+ /// Collection of features in string.
+ ///
public IReadOnlyCollection Features => _features;
///
/// Gets a collection of users in this guild.
@@ -188,10 +197,16 @@ namespace Discord.WebSocket
/// You may need to enable to fetch the full user list
/// upon startup, or use to manually download the users.
///
+ ///
+ /// Collection of users.
+ ///
public IReadOnlyCollection Users => _members.ToReadOnlyCollection();
///
/// Gets a collection of roles in this guild.
///
+ ///
+ /// Collection of roles.
+ ///
public IReadOnlyCollection Roles => _roles.ToReadOnlyCollection();
internal SocketGuild(DiscordSocketClient client, ulong id)
@@ -378,7 +393,7 @@ namespace Discord.WebSocket
//Bans
///
- /// Gets a collection of the banned users in this guild.
+ /// Returns a collection of the banned users in this guild.
///
/// The options to be used when sending the request.
///
@@ -634,7 +649,7 @@ namespace Discord.WebSocket
/// The ID of the webhook.
/// The options to be used when sending the request.
///
- /// A webhook associated with the ID.
+ /// An awaitable Task containing the webhook associated with the ID.
///
public Task GetWebhookAsync(ulong id, RequestOptions options = null)
=> GuildHelper.GetWebhookAsync(this, Discord, id, options);
@@ -643,7 +658,7 @@ namespace Discord.WebSocket
///
/// The options to be used when sending the request.
///
- /// A collection of webhooks.
+ /// An awaitable Task containing a collection of webhooks.
///
public Task> GetWebhooksAsync(RequestOptions options = null)
=> GuildHelper.GetWebhooksAsync(this, Discord, options);
diff --git a/src/Discord.Net.WebSocket/Entities/Messages/MessageCache.cs b/src/Discord.Net.WebSocket/Entities/Messages/MessageCache.cs
index c2cad4d86..8cac95cd3 100644
--- a/src/Discord.Net.WebSocket/Entities/Messages/MessageCache.cs
+++ b/src/Discord.Net.WebSocket/Entities/Messages/MessageCache.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -14,7 +14,7 @@ namespace Discord.WebSocket
public IReadOnlyCollection Messages => _messages.ToReadOnlyCollection();
- public MessageCache(DiscordSocketClient discord, IChannel channel)
+ public MessageCache(DiscordSocketClient discord)
{
_size = discord.MessageCacheSize;
_messages = new ConcurrentDictionary(ConcurrentHashSet.DefaultConcurrencyLevel, (int)(_size * 1.05));
@@ -28,7 +28,7 @@ namespace Discord.WebSocket
_orderedMessages.Enqueue(message.Id);
while (_orderedMessages.Count > _size && _orderedMessages.TryDequeue(out ulong msgId))
- _messages.TryRemove(msgId, out SocketMessage msg);
+ _messages.TryRemove(msgId, out SocketMessage _);
}
}
@@ -44,6 +44,8 @@ namespace Discord.WebSocket
return result;
return null;
}
+
+ /// is less than 0.
public IReadOnlyCollection GetMany(ulong? fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch)
{
if (limit < 0) throw new ArgumentOutOfRangeException(nameof(limit));
diff --git a/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs b/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs
index d339a20ed..0767f2ad7 100644
--- a/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs
+++ b/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs
@@ -14,8 +14,20 @@ namespace Discord.WebSocket
public abstract class SocketMessage : SocketEntity, IMessage
{
private long _timestampTicks;
-
+
+ ///
+ /// Gets the author of this message.
+ ///
+ ///
+ /// A WebSocket-based user object.
+ ///
public SocketUser Author { get; }
+ ///
+ /// Gets the source channel of the message.
+ ///
+ ///
+ /// A WebSocket-based message channel.
+ ///
public ISocketMessageChannel Channel { get; }
///
public MessageSource Source { get; }
@@ -31,10 +43,40 @@ namespace Discord.WebSocket
public virtual bool IsPinned => false;
///
public virtual DateTimeOffset? EditedTimestamp => null;
+ ///
+ /// Returns all attachments included in this message.
+ ///
+ ///
+ /// Collection of attachments.
+ ///
public virtual IReadOnlyCollection Attachments => ImmutableArray.Create();
+ ///
+ /// Returns all embeds included in this message.
+ ///
+ ///
+ /// Collection of embed objects.
+ ///
public virtual IReadOnlyCollection