@@ -130,33 +130,33 @@ namespace Discord.Commands | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Add a command module from a <see cref="Type"/>. | |||||
/// Add a command module from a <see cref="Type" /> . | |||||
/// </summary> | /// </summary> | ||||
/// <typeparam name="T">The type of module.</typeparam> | /// <typeparam name="T">The type of module.</typeparam> | ||||
/// <param name="services"> | |||||
/// The <see cref="IServiceProvider"/> for your dependency injection solution if using one; otherwise, pass | |||||
/// <c>null</c>. | |||||
/// </param> | |||||
/// <param name="services">The <see cref="IServiceProvider" /> for your dependency injection solution if using one; otherwise, pass <c>null</c> .</param> | |||||
/// <exception cref="ArgumentException">This module has already been added.</exception> | |||||
/// <exception cref="InvalidOperationException"> | |||||
/// The <see cref="ModuleInfo"/> fails to be built; an invalid type may have been provided. | |||||
/// </exception> | |||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing the built module. | |||||
/// A task that represents the asynchronous operation for adding the module. The task result contains the | |||||
/// built module. | |||||
/// </returns> | /// </returns> | ||||
/// <exception cref="ArgumentException">This module has already been added.</exception> | |||||
/// <exception cref="InvalidOperationException">The <see cref="ModuleInfo"/> fails to be built; an invalid type may have been provided.</exception> | |||||
public Task<ModuleInfo> AddModuleAsync<T>(IServiceProvider services) => AddModuleAsync(typeof(T), services); | public Task<ModuleInfo> AddModuleAsync<T>(IServiceProvider services) => AddModuleAsync(typeof(T), services); | ||||
/// <summary> | /// <summary> | ||||
/// Adds a command module from a <see cref="Type"/>. | |||||
/// Adds a command module from a <see cref="Type" /> . | |||||
/// </summary> | /// </summary> | ||||
/// <param name="type">The type of module.</param> | /// <param name="type">The type of module.</param> | ||||
/// <param name="services"> | |||||
/// The <see cref="IServiceProvider"/> for your dependency injection solution if using one; otherwise, pass | |||||
/// <c>null</c>. | |||||
/// </param> | |||||
/// <param name="services">The <see cref="IServiceProvider" /> for your dependency injection solution if using one; otherwise, pass <c>null</c> .</param> | |||||
/// <exception cref="ArgumentException">This module has already been added.</exception> | |||||
/// <exception cref="InvalidOperationException"> | |||||
/// The <see cref="ModuleInfo"/> fails to be built; an invalid type may have been provided. | |||||
/// </exception> | |||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing the built module. | |||||
/// A task that represents the asynchronous operation for adding the module. The task result contains the | |||||
/// built module. | |||||
/// </returns> | /// </returns> | ||||
/// <exception cref="ArgumentException">This module has already been added.</exception> | |||||
/// <exception cref="InvalidOperationException">The <see cref="ModuleInfo"/> fails to be built; an invalid type may have been provided.</exception> | |||||
public async Task<ModuleInfo> AddModuleAsync(Type type, IServiceProvider services) | public async Task<ModuleInfo> AddModuleAsync(Type type, IServiceProvider services) | ||||
{ | { | ||||
services = services ?? EmptyServiceProvider.Instance; | services = services ?? EmptyServiceProvider.Instance; | ||||
@@ -186,13 +186,11 @@ namespace Discord.Commands | |||||
/// <summary> | /// <summary> | ||||
/// Add command modules from an <see cref="Assembly"/>. | /// Add command modules from an <see cref="Assembly"/>. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="assembly">The <see cref="Assembly" /> containing command modules.</param> | |||||
/// <param name="services"> | |||||
/// The <see cref="IServiceProvider"/> for your dependency injection solution if using one; otherwise, pass | |||||
/// <c>null</c>. | |||||
/// </param> | |||||
/// <param name="assembly">The <see cref="Assembly"/> containing command modules.</param> | |||||
/// <param name="services">The <see cref="IServiceProvider"/> for your dependency injection solution if using one; otherwise, pass <c>null</c>.</param> | |||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing the built module. | |||||
/// A task that represents the asynchronous operation for adding the command modules. The task result | |||||
/// contains an enumerable collection of modules added. | |||||
/// </returns> | /// </returns> | ||||
public async Task<IEnumerable<ModuleInfo>> AddModulesAsync(Assembly assembly, IServiceProvider services) | public async Task<IEnumerable<ModuleInfo>> AddModulesAsync(Assembly assembly, IServiceProvider services) | ||||
{ | { | ||||
@@ -234,7 +232,8 @@ namespace Discord.Commands | |||||
/// </summary> | /// </summary> | ||||
/// <param name="module">The <see cref="ModuleInfo" /> to be removed from the service.</param> | /// <param name="module">The <see cref="ModuleInfo" /> to be removed from the service.</param> | ||||
/// <returns> | /// <returns> | ||||
/// Returns whether the module is successfully removed. | |||||
/// A task that represents the asynchronous removal operation. The task result contains a value that | |||||
/// indicates whether the <paramref name="module"/> is successfully removed. | |||||
/// </returns> | /// </returns> | ||||
public async Task<bool> RemoveModuleAsync(ModuleInfo module) | public async Task<bool> RemoveModuleAsync(ModuleInfo module) | ||||
{ | { | ||||
@@ -253,7 +252,8 @@ namespace Discord.Commands | |||||
/// </summary> | /// </summary> | ||||
/// <typeparam name="T">The <see cref="Type"/> of the module.</typeparam> | /// <typeparam name="T">The <see cref="Type"/> of the module.</typeparam> | ||||
/// <returns> | /// <returns> | ||||
/// Returns whether the module is successfully removed. | |||||
/// A task that represents the asynchronous removal operation. The task result contains a value that | |||||
/// indicates whether the module is successfully removed. | |||||
/// </returns> | /// </returns> | ||||
public Task<bool> RemoveModuleAsync<T>() => RemoveModuleAsync(typeof(T)); | public Task<bool> RemoveModuleAsync<T>() => RemoveModuleAsync(typeof(T)); | ||||
/// <summary> | /// <summary> | ||||
@@ -261,7 +261,8 @@ namespace Discord.Commands | |||||
/// </summary> | /// </summary> | ||||
/// <param name="type">The <see cref="Type"/> of the module.</param> | /// <param name="type">The <see cref="Type"/> of the module.</param> | ||||
/// <returns> | /// <returns> | ||||
/// Returns whether the module is successfully removed. | |||||
/// A task that represents the asynchronous removal operation. The task result contains a value that | |||||
/// indicates whether the module is successfully removed. | |||||
/// </returns> | /// </returns> | ||||
public async Task<bool> RemoveModuleAsync(Type type) | public async Task<bool> RemoveModuleAsync(Type type) | ||||
{ | { | ||||
@@ -455,7 +456,10 @@ namespace Discord.Commands | |||||
/// <param name="argPos">The position of which the command starts at.</param> | /// <param name="argPos">The position of which the command starts at.</param> | ||||
/// <param name="services">The service to be used in the command's dependency injection.</param> | /// <param name="services">The service to be used in the command's dependency injection.</param> | ||||
/// <param name="multiMatchHandling">The handling mode when multiple command matches are found.</param> | /// <param name="multiMatchHandling">The handling mode when multiple command matches are found.</param> | ||||
/// <returns>The result of the command execution.</returns> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous execution operation. The task result contains the result of the | |||||
/// command execution. | |||||
/// </returns> | |||||
public Task<IResult> ExecuteAsync(ICommandContext context, int argPos, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) | public Task<IResult> ExecuteAsync(ICommandContext context, int argPos, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) | ||||
=> ExecuteAsync(context, context.Message.Content.Substring(argPos), services, multiMatchHandling); | => ExecuteAsync(context, context.Message.Content.Substring(argPos), services, multiMatchHandling); | ||||
/// <summary> | /// <summary> | ||||
@@ -465,7 +469,10 @@ namespace Discord.Commands | |||||
/// <param name="input">The command string.</param> | /// <param name="input">The command string.</param> | ||||
/// <param name="services">The service to be used in the command's dependency injection.</param> | /// <param name="services">The service to be used in the command's dependency injection.</param> | ||||
/// <param name="multiMatchHandling">The handling mode when multiple command matches are found.</param> | /// <param name="multiMatchHandling">The handling mode when multiple command matches are found.</param> | ||||
/// <returns>The result of the command execution.</returns> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous execution operation. The task result contains the result of the | |||||
/// command execution. | |||||
/// </returns> | |||||
public async Task<IResult> ExecuteAsync(ICommandContext context, string input, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) | public async Task<IResult> ExecuteAsync(ICommandContext context, string input, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) | ||||
{ | { | ||||
services = services ?? EmptyServiceProvider.Instance; | services = services ?? EmptyServiceProvider.Instance; | ||||
@@ -55,7 +55,9 @@ namespace Discord.Commands | |||||
/// </example> | /// </example> | ||||
public Dictionary<char, char> QuotationMarkAliasMap { get; set; } = QuotationAliasUtils.GetDefaultAliasMap; | public Dictionary<char, char> QuotationMarkAliasMap { get; set; } = QuotationAliasUtils.GetDefaultAliasMap; | ||||
/// <summary> Determines whether extra parameters should be ignored. </summary> | |||||
/// <summary> | |||||
/// Gets or sets a value that indicates whether extra parameters should be ignored. | |||||
/// </summary> | |||||
public bool IgnoreExtraArgs { get; set; } = false; | public bool IgnoreExtraArgs { get; set; } = false; | ||||
} | } | ||||
} | } |
@@ -15,7 +15,7 @@ namespace Discord.Commands | |||||
/// <param name="input">The raw input of the command.</param> | /// <param name="input">The raw input of the command.</param> | ||||
/// <param name="services">The service collection used for dependency injection.</param> | /// <param name="services">The service collection used for dependency injection.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable Task containing the result of the type reading process. | |||||
/// A task that represents the asynchronous parsing operation. The task result contains the parsing result. | |||||
/// </returns> | /// </returns> | ||||
public abstract Task<TypeReaderResult> ReadAsync(ICommandContext context, string input, IServiceProvider services); | public abstract Task<TypeReaderResult> ReadAsync(ICommandContext context, string input, IServiceProvider services); | ||||
} | } | ||||
@@ -25,7 +25,7 @@ namespace Discord | |||||
/// Disconnects from this audio channel. | /// Disconnects from this audio channel. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// A task representing the asynchronous disconnection operation. | |||||
/// A task representing the asynchronous operation for disconnecting from the audio channel. | |||||
/// </returns> | /// </returns> | ||||
Task DisconnectAsync(); | Task DisconnectAsync(); | ||||
} | } | ||||
@@ -58,7 +58,7 @@ namespace Discord | |||||
/// </returns> | /// </returns> | ||||
Task<IInviteMetadata> CreateInviteAsync(int? maxAge = 86400, int? maxUses = default(int?), bool isTemporary = false, bool isUnique = false, RequestOptions options = null); | Task<IInviteMetadata> CreateInviteAsync(int? maxAge = 86400, int? maxUses = default(int?), bool isTemporary = false, bool isUnique = false, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Returns a collection of all invites to this channel. | |||||
/// Gets a collection of all invites to this channel. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
@@ -78,7 +78,7 @@ namespace Discord | |||||
Task ModifyAsync(Action<GuildChannelProperties> func, RequestOptions options = null); | Task ModifyAsync(Action<GuildChannelProperties> func, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Gets the permission overwrite for a specific role, or <c>null</c> if one does not exist. | |||||
/// Gets the permission overwrite for a specific role. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="role">The role to get the overwrite from.</param> | /// <param name="role">The role to get the overwrite from.</param> | ||||
/// <returns> | /// <returns> | ||||
@@ -86,7 +86,7 @@ namespace Discord | |||||
/// </returns> | /// </returns> | ||||
OverwritePermissions? GetPermissionOverwrite(IRole role); | OverwritePermissions? GetPermissionOverwrite(IRole role); | ||||
/// <summary> | /// <summary> | ||||
/// Gets the permission overwrite for a specific user, or <c>null</c> if one does not exist. | |||||
/// Gets the permission overwrite for a specific user. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="user">The user to get the overwrite from.</param> | /// <param name="user">The user to get the overwrite from.</param> | ||||
/// <returns> | /// <returns> | ||||
@@ -99,7 +99,7 @@ namespace Discord | |||||
/// <param name="role">The role to remove the overwrite from.</param> | /// <param name="role">The role to remove the overwrite from.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A task representing the asynchronous removal operation. | |||||
/// A task representing the asynchronous operation for removing the specified permissions from the channel. | |||||
/// </returns> | /// </returns> | ||||
Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null); | Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
@@ -108,7 +108,7 @@ namespace Discord | |||||
/// <param name="user">The user to remove the overwrite from.</param> | /// <param name="user">The user to remove the overwrite from.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A task representing the asynchronous removal operation. | |||||
/// A task representing the asynchronous operation for removing the specified permissions from the channel. | |||||
/// </returns> | /// </returns> | ||||
Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null); | Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null); | ||||
@@ -119,7 +119,7 @@ namespace Discord | |||||
/// <param name="permissions">The overwrite to add to the role.</param> | /// <param name="permissions">The overwrite to add to the role.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A task representing the asynchronous permission addition operation. | |||||
/// A task representing the asynchronous permission operation for adding the specified permissions to the channel. | |||||
/// </returns> | /// </returns> | ||||
Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null); | Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
@@ -129,16 +129,14 @@ namespace Discord | |||||
/// <param name="permissions">The overwrite to add to the user.</param> | /// <param name="permissions">The overwrite to add to the user.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A task representing the asynchronous permission addition operation. | |||||
/// A task representing the asynchronous permission operation for adding the specified permissions to the channel. | |||||
/// </returns> | /// </returns> | ||||
Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null); | Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Gets a collection of all users in this channel. | |||||
/// Gets a collection of users that are able to view the channel. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="mode"> | |||||
/// The <see cref="CacheMode" /> that determines whether the object should be fetched from cache. | |||||
/// </param> | |||||
/// <param name="mode">The <see cref="CacheMode" /> that determines whether the object should be fetched from cache.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A paged collection containing a collection of guild users that can access this channel. Flattening the | /// A paged collection containing a collection of guild users that can access this channel. Flattening the | ||||
@@ -147,13 +145,13 @@ namespace Discord | |||||
/// </returns> | /// </returns> | ||||
new IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> GetUsersAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | new IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> GetUsersAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Gets a user in this channel with the provided ID. | |||||
/// Gets a user in this channel. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="id">The ID of the user.</param> | |||||
/// <param name="id">The snowflake identifier of the user.</param> | |||||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | /// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A task representing the asynchrnous get operation. The task result contains a guild user object that | |||||
/// A task representing the asynchronous get operation. The task result contains a guild user object that | |||||
/// represents the user; <c>null</c> if none is found. | /// represents the user; <c>null</c> if none is found. | ||||
/// </returns> | /// </returns> | ||||
new Task<IGuildUser> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | new Task<IGuildUser> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
@@ -18,7 +18,7 @@ namespace Discord | |||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | /// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A task that represents an asynchrnous send operation for delievering the message. The task result | |||||
/// A task that represents an asynchronous send operation for delievering the message. The task result | |||||
/// contains the sent message. | /// contains the sent message. | ||||
/// </returns> | /// </returns> | ||||
Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | Task<IUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
@@ -39,7 +39,7 @@ namespace Discord | |||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich" /> <see cref="Embed" /> to be sent.</param> | /// <param name="embed">The <see cref="Discord.EmbedType.Rich" /> <see cref="Embed" /> to be sent.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A task that represents an asynchrnous send operation for delievering the message. The task result | |||||
/// A task that represents an asynchronous send operation for delievering the message. The task result | |||||
/// contains the sent message. | /// contains the sent message. | ||||
/// </returns> | /// </returns> | ||||
Task<IUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | Task<IUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
@@ -61,7 +61,7 @@ namespace Discord | |||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | /// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A task that represents an asynchrnous send operation for delievering the message. The task result | |||||
/// A task that represents an asynchronous send operation for delievering the message. The task result | |||||
/// contains the sent message. | /// contains the sent message. | ||||
/// </returns> | /// </returns> | ||||
Task<IUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | Task<IUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
@@ -73,7 +73,7 @@ namespace Discord | |||||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | /// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A task that represents an asynchrnous get operation for retrieving the message. The task result contains | |||||
/// A task that represents an asynchronous get operation for retrieving the message. The task result contains | |||||
/// the retrieved message; <c>null</c> if no message is found with the specified identifier. | /// the retrieved message; <c>null</c> if no message is found with the specified identifier. | ||||
/// </returns> | /// </returns> | ||||
Task<IMessage> GetMessageAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<IMessage> GetMessageAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
@@ -21,7 +21,7 @@ namespace Discord | |||||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | /// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A task that represents the asynchrnous get operation. The task result contains the category channel | |||||
/// A task that represents the asynchronous get operation. The task result contains the category channel | |||||
/// representing the parent of this channel; <c>null</c> if none is set. | /// representing the parent of this channel; <c>null</c> if none is set. | ||||
/// </returns> | /// </returns> | ||||
Task<ICategoryChannel> GetCategoryAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<ICategoryChannel> GetCategoryAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
@@ -11,7 +11,7 @@ namespace Discord | |||||
public interface ITextChannel : IMessageChannel, IMentionable, INestedChannel | public interface ITextChannel : IMessageChannel, IMentionable, INestedChannel | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether the channel is NSFW. | |||||
/// Gets a value that indicates whether the channel is NSFW. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// <c>true</c> if the channel has the NSFW flag enabled; otherwise <c>false</c>. | /// <c>true</c> if the channel has the NSFW flag enabled; otherwise <c>false</c>. | ||||
@@ -27,7 +27,7 @@ namespace Discord | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether the specified emoji is equal to the current emoji. | |||||
/// Determines whether the specified emoji is equal to the current one. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="other">The object to compare with the current object.</param> | /// <param name="other">The object to compare with the current object.</param> | ||||
public override bool Equals(object other) | public override bool Equals(object other) | ||||
@@ -42,6 +42,9 @@ namespace Discord | |||||
/// <summary> | /// <summary> | ||||
/// Gets the raw representation of the emote. | /// Gets the raw representation of the emote. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// A string representing the raw presentation of the emote (e.g. <c><:thonkang:282745590985523200></c>). | |||||
/// </returns> | |||||
public override string ToString() => $"<{(Animated ? "a" : "")}:{Name}:{Id}>"; | public override string ToString() => $"<{(Animated ? "a" : "")}:{Name}:{Id}>"; | ||||
} | } | ||||
} | } |
@@ -27,7 +27,7 @@ namespace Discord | |||||
/// </returns> | /// </returns> | ||||
int AFKTimeout { get; } | int AFKTimeout { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Determines if this guild is embeddable (i.e. can use widget). | |||||
/// Gets a value that indicates whether this guild is embeddable (i.e. can use widget). | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// <c>true</c> if this guild can be embedded via widgets; otherwise <c>false</c>. | /// <c>true</c> if this guild can be embedded via widgets; otherwise <c>false</c>. | ||||
@@ -8,26 +8,44 @@ namespace Discord | |||||
/// <summary> | /// <summary> | ||||
/// Gets the unique identifier for this voice region. | /// Gets the unique identifier for this voice region. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// A string that represents the identifier for this voice region (e.g. <c>eu-central</c>). | |||||
/// </returns> | |||||
string Id { get; } | string Id { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the name of this voice region. | /// Gets the name of this voice region. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// A string that represents the human-readable name of this voice region (e.g. <c>Central Europe</c>). | |||||
/// </returns> | |||||
string Name { get; } | string Name { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Returns <c>true</c> if this voice region is exclusive to VIP accounts. | |||||
/// Gets a value that indicates whether or not this voice region is exclusive to partnered servers. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// <c>true</c> if this voice region is exclusive to VIP accounts; otherwise <c>false</c>. | |||||
/// </returns> | |||||
bool IsVip { get; } | bool IsVip { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Returns <c>true</c> if this voice region is the closest to your machine. | |||||
/// Gets a value that indicates whether this voice region is optimal for your client in terms of latency. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// <c>true</c> if this voice region is the closest to your machine; otherwise <c>false</c> . | |||||
/// </returns> | |||||
bool IsOptimal { get; } | bool IsOptimal { get; } | ||||
/// <summary> | |||||
/// Returns <c>true</c> if this is a deprecated voice region (avoid switching to these). | |||||
/// <summary> | |||||
/// Gets a value that indicates whether this voice region is no longer being maintained. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// <c>true</c> if this is a deprecated voice region; otherwise <c>false</c>. | |||||
/// </returns> | |||||
bool IsDeprecated { get; } | bool IsDeprecated { get; } | ||||
/// <summary> | |||||
/// Returns <c>true</c> if this is a custom voice region (used for events/etc). | |||||
/// <summary> | |||||
/// Gets a value that indicates whether this voice region is custom-made for events. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// <c>true</c> if this is a custom voice region (used for events/etc); otherwise <c>false</c>/ | |||||
/// </returns> | |||||
bool IsCustom { get; } | bool IsCustom { get; } | ||||
} | } | ||||
} | } |
@@ -15,15 +15,14 @@ namespace Discord | |||||
/// </returns> | /// </returns> | ||||
IUser Inviter { get; } | IUser Inviter { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether the invite has been revoked. | |||||
/// Gets a value that indicates whether the invite has been revoked. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// <c>true</c> if this invite was revoked; otherwise <c>false</c>. | /// <c>true</c> if this invite was revoked; otherwise <c>false</c>. | ||||
/// </returns> | /// </returns> | ||||
bool IsRevoked { get; } | bool IsRevoked { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether the invite is a temporary one (i.e. whether the invite will be removed from the guild | |||||
/// when the user logs off). | |||||
/// Gets a value that indicates whether the invite is a temporary one. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// <c>true</c> if users accepting this invite will be removed from the guild when they log off; otherwise | /// <c>true</c> if users accepting this invite will be removed from the guild when they log off; otherwise | ||||
@@ -492,7 +492,7 @@ namespace Discord | |||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether the field should be in-line with each other. | |||||
/// Gets or sets a value that indicates whether the field should be in-line with each other. | |||||
/// </summary> | /// </summary> | ||||
public bool IsInline { get; set; } | public bool IsInline { get; set; } | ||||
@@ -17,7 +17,7 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
public string Value { get; internal set; } | public string Value { get; internal set; } | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether the field should be in-line with each other. | |||||
/// Gets a value that indicates whether the field should be in-line with each other. | |||||
/// </summary> | /// </summary> | ||||
public bool Inline { get; internal set; } | public bool Inline { get; internal set; } | ||||
@@ -32,6 +32,9 @@ namespace Discord | |||||
/// <summary> | /// <summary> | ||||
/// Gets the name of the field. | /// Gets the name of the field. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// A string that resolves to <see cref="EmbedField.Name"/>. | |||||
/// </returns> | |||||
public override string ToString() => Name; | public override string ToString() => Name; | ||||
} | } | ||||
} | } |
@@ -17,12 +17,18 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
MessageSource Source { get; } | MessageSource Source { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Returns <c>true</c> if this message was sent as a text-to-speech message. | |||||
/// Gets the value that indicates whether this message was meant to be read-aloud by Discord. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// <c>true</c> if this message was sent as a text-to-speech message; otherwise <c>false</c>. | |||||
/// </returns> | |||||
bool IsTTS { get; } | bool IsTTS { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Returns <c>true</c> if this message was added to its channel's pinned messages. | |||||
/// Gets the value that indicates whether this message is pinned. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// <c>true</c> if this message was added to its channel's pinned messages; otherwise <c>false</c>. | |||||
/// </returns> | |||||
bool IsPinned { get; } | bool IsPinned { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Returns the content for this message. | /// Returns the content for this message. | ||||
@@ -56,14 +62,14 @@ namespace Discord | |||||
/// Returns all attachments included in this message. | /// Returns all attachments included in this message. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// Collection of attachments. | |||||
/// A read-only collection of attachments. | |||||
/// </returns> | /// </returns> | ||||
IReadOnlyCollection<IAttachment> Attachments { get; } | IReadOnlyCollection<IAttachment> Attachments { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Returns all embeds included in this message. | /// Returns all embeds included in this message. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// Collection of embed objects. | |||||
/// A read-only collection of embed objects. | |||||
/// </returns> | /// </returns> | ||||
IReadOnlyCollection<IEmbed> Embeds { get; } | IReadOnlyCollection<IEmbed> Embeds { get; } | ||||
/// <summary> | /// <summary> | ||||
@@ -74,21 +80,21 @@ namespace Discord | |||||
/// Returns the IDs of channels mentioned in this message. | /// Returns the IDs of channels mentioned in this message. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// Collection of channel IDs. | |||||
/// A read-only collection of channel IDs. | |||||
/// </returns> | /// </returns> | ||||
IReadOnlyCollection<ulong> MentionedChannelIds { get; } | IReadOnlyCollection<ulong> MentionedChannelIds { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Returns the IDs of roles mentioned in this message. | /// Returns the IDs of roles mentioned in this message. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// Collection of role IDs. | |||||
/// A read-only collection of role IDs. | |||||
/// </returns> | /// </returns> | ||||
IReadOnlyCollection<ulong> MentionedRoleIds { get; } | IReadOnlyCollection<ulong> MentionedRoleIds { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Returns the IDs of users mentioned in this message. | /// Returns the IDs of users mentioned in this message. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// Collection of user IDs. | |||||
/// A read-only collection of user IDs. | |||||
/// </returns> | /// </returns> | ||||
IReadOnlyCollection<ulong> MentionedUserIds { get; } | IReadOnlyCollection<ulong> MentionedUserIds { get; } | ||||
} | } | ||||
@@ -20,7 +20,7 @@ namespace Discord | |||||
/// <param name="func">A delegate containing the properties to modify the message with.</param> | /// <param name="func">A delegate containing the properties to modify the message with.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task that represents the asynchronous modification operation. | |||||
/// </returns> | /// </returns> | ||||
Task ModifyAsync(Action<MessageProperties> func, RequestOptions options = null); | Task ModifyAsync(Action<MessageProperties> func, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
@@ -28,7 +28,7 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task that represents the asynchronous operation for pinning this message. | |||||
/// </returns> | /// </returns> | ||||
Task PinAsync(RequestOptions options = null); | Task PinAsync(RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
@@ -36,7 +36,7 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task that represents the asynchronous operation for unpinning this message. | |||||
/// </returns> | /// </returns> | ||||
Task UnpinAsync(RequestOptions options = null); | Task UnpinAsync(RequestOptions options = null); | ||||
@@ -56,8 +56,9 @@ namespace Discord | |||||
/// <param name="emote">The emoji used to react to this message.</param> | /// <param name="emote">The emoji used to react to this message.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task that represents the asynchronous operation for adding a reaction to this message. | |||||
/// </returns> | /// </returns> | ||||
/// <seealso cref="IEmote"/> | |||||
Task AddReactionAsync(IEmote emote, RequestOptions options = null); | Task AddReactionAsync(IEmote emote, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Removes a reaction from message. | /// Removes a reaction from message. | ||||
@@ -71,20 +72,36 @@ namespace Discord | |||||
/// <param name="user">The user that added the emoji.</param> | /// <param name="user">The user that added the emoji.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task that represents the asynchronous operation for removing a reaction to this message. | |||||
/// </returns> | /// </returns> | ||||
/// <seealso cref="IEmote"/> | |||||
Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null); | Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Removes all reactions from this message. | /// Removes all reactions from this message. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task that represents the asynchronous removal operation. | |||||
/// </returns> | /// </returns> | ||||
Task RemoveAllReactionsAsync(RequestOptions options = null); | Task RemoveAllReactionsAsync(RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Gets all users that reacted to a message with a given emote. | /// Gets all users that reacted to a message with a given emote. | ||||
/// </summary> | /// </summary> | ||||
/// <example> | |||||
/// <code language="cs"> | |||||
/// var emoji = new Emoji("\U0001f495"); | |||||
/// var reactedUsers = await message.GetReactionUsersAsync(emoji, 100).FlattenAsync(); | |||||
/// </code> | |||||
/// </example> | |||||
/// <param name="emoji">The emoji that represents the reaction that you wish to get.</param> | |||||
/// <param name="limit">The number of users to request.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A paged collection containing a read-only collection of users that has reacted to this message. | |||||
/// Flattening the paginated response into a collection of users with | |||||
/// <see cref="AsyncEnumerableExtensions.FlattenAsync{T}"/> is required if you wish to access the users. | |||||
/// </returns> | |||||
IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emoji, int limit, RequestOptions options = null); | IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emoji, int limit, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
@@ -24,21 +24,21 @@ namespace Discord | |||||
/// </returns> | /// </returns> | ||||
Color Color { get; } | Color Color { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether the role can be separated in the user list. | |||||
/// Gets a value that indicates whether the role can be separated in the user list. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// <c>true</c> if users of this role are separated in the user list; otherwise <c>false</c>. | /// <c>true</c> if users of this role are separated in the user list; otherwise <c>false</c>. | ||||
/// </returns> | /// </returns> | ||||
bool IsHoisted { get; } | bool IsHoisted { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether the role is managed by Discord. | |||||
/// Gets a value that indicates whether the role is managed by Discord. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// <c>true</c> if this role is automatically managed by Discord; otherwise <c>false</c>. | /// <c>true</c> if this role is automatically managed by Discord; otherwise <c>false</c>. | ||||
/// </returns> | /// </returns> | ||||
bool IsManaged { get; } | bool IsManaged { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether the role is mentionable. | |||||
/// Gets a value that indicates whether the role is mentionable. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// <c>true</c> if this role may be mentioned in messages; otherwise <c>false</c>. | /// <c>true</c> if this role may be mentioned in messages; otherwise <c>false</c>. | ||||
@@ -82,7 +82,7 @@ namespace Discord | |||||
/// <param name="func">A delegate containing the properties to modify the role with.</param> | /// <param name="func">A delegate containing the properties to modify the role with.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task that represents the asynchronous modification operation. | |||||
/// </returns> | /// </returns> | ||||
Task ModifyAsync(Action<RoleProperties> func, RequestOptions options = null); | Task ModifyAsync(Action<RoleProperties> func, RequestOptions options = null); | ||||
} | } | ||||
@@ -15,9 +15,7 @@ namespace Discord | |||||
/// Returns a URL to this user's avatar. | /// Returns a URL to this user's avatar. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="format">The format to return.</param> | /// <param name="format">The format to return.</param> | ||||
/// <param name="size"> | |||||
/// The size of the image to return in. This can be any power of two between 16 and 2048. | |||||
/// </param> | |||||
/// <param name="size">The size of the image to return in. This can be any power of two between 16 and 2048.</param> | |||||
/// <returns> | /// <returns> | ||||
/// User's avatar URL. | /// User's avatar URL. | ||||
/// </returns> | /// </returns> | ||||
@@ -35,12 +33,18 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
ushort DiscriminatorValue { get; } | ushort DiscriminatorValue { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets <c>true</c> if this user is a bot user. | |||||
/// Gets a value that indicates whether this user is a bot user. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// <c>true</c> if the user is a bot; otherwise <c>false</c>. | |||||
/// </returns> | |||||
bool IsBot { get; } | bool IsBot { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets <c>true</c> if this user is a webhook user. | |||||
/// Gets a value that indicates whether this user is a webhook user. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// <c>true</c> if the user is a webhook; otherwise <c>false</c>. | |||||
/// </returns> | |||||
bool IsWebhook { get; } | bool IsWebhook { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the username for this user. | /// Gets the username for this user. | ||||
@@ -52,7 +56,7 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable Task containing the DM channel. | |||||
/// A task that represents the asynchronous operation for getting or creating a DM channel. | |||||
/// </returns> | /// </returns> | ||||
Task<IDMChannel> GetOrCreateDMChannelAsync(RequestOptions options = null); | Task<IDMChannel> GetOrCreateDMChannelAsync(RequestOptions options = null); | ||||
} | } | ||||
@@ -16,7 +16,7 @@ namespace Discord | |||||
/// <param name="embed">The <see cref="EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | /// <param name="embed">The <see cref="EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable Task containing the message sent to the channel. | |||||
/// A task that represents the asynchrnonous send operation. The task result contains the sent message. | |||||
/// </returns> | /// </returns> | ||||
public static async Task<IUserMessage> SendMessageAsync(this IUser user, | public static async Task<IUserMessage> SendMessageAsync(this IUser user, | ||||
string text = null, | string text = null, | ||||
@@ -43,7 +43,7 @@ namespace Discord | |||||
/// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | /// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | ||||
/// </remarks> | /// </remarks> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable Task containing the message sent to the channel. | |||||
/// A task that represents the asynchrnonous send operation. The task result contains the sent message. | |||||
/// </returns> | /// </returns> | ||||
public static async Task<IUserMessage> SendFileAsync(this IUser user, | public static async Task<IUserMessage> SendFileAsync(this IUser user, | ||||
Stream stream, | Stream stream, | ||||
@@ -72,7 +72,7 @@ namespace Discord | |||||
/// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | /// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | ||||
/// </remarks> | /// </remarks> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable Task containing the message sent to the channel. | |||||
/// A task that represents the asynchrnonous send operation. The task result contains the sent message. | |||||
/// </returns> | /// </returns> | ||||
public static async Task<IUserMessage> SendFileAsync(this IUser user, | public static async Task<IUserMessage> SendFileAsync(this IUser user, | ||||
string filePath, | string filePath, | ||||
@@ -85,15 +85,16 @@ namespace Discord | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Bans the provided user from the guild and optionally prunes their recent messages. | |||||
/// Bans the user from the guild and optionally prunes their recent messages. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="user">The user to ban.</param> | /// <param name="user">The user to ban.</param> | ||||
/// <param name="pruneDays"> | |||||
/// The number of days to remove messages from this user for - must be between [0, 7] | |||||
/// </param> | |||||
/// <param name="pruneDays">The number of days to remove messages from this <paramref name="user"/> for - must be between [0, 7]</param> | |||||
/// <param name="reason">The reason of the ban to be written in the audit log.</param> | /// <param name="reason">The reason of the ban to be written in the audit log.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <exception cref="ArgumentException"><paramref name="pruneDays" /> is not between 0 to 7.</exception> | /// <exception cref="ArgumentException"><paramref name="pruneDays" /> is not between 0 to 7.</exception> | ||||
/// <returns> | |||||
/// A task that represents the asynchrnous operation for banning a user. | |||||
/// </returns> | |||||
public static Task BanAsync(this IGuildUser user, int pruneDays = 0, string reason = null, RequestOptions options = null) | public static Task BanAsync(this IGuildUser user, int pruneDays = 0, string reason = null, RequestOptions options = null) | ||||
=> user.Guild.AddBanAsync(user, pruneDays, reason, options); | => user.Guild.AddBanAsync(user, pruneDays, reason, options); | ||||
} | } | ||||
@@ -34,14 +34,14 @@ namespace Discord | |||||
/// </note> | /// </note> | ||||
/// </remarks> | /// </remarks> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task that represents the asynchronous start operation. | |||||
/// </returns> | /// </returns> | ||||
Task StartAsync(); | Task StartAsync(); | ||||
/// <summary> | /// <summary> | ||||
/// Stops the connection between Discord and the client. | /// Stops the connection between Discord and the client. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task that represents the asynchronous stop operation. | |||||
/// </returns> | /// </returns> | ||||
Task StopAsync(); | Task StopAsync(); | ||||
@@ -54,37 +54,35 @@ namespace Discord | |||||
/// </remarks> | /// </remarks> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing the application information. | |||||
/// A task that represents the asynchronous get operation. The task result contains the application | |||||
/// information. | |||||
/// </returns> | /// </returns> | ||||
Task<IApplication> GetApplicationInfoAsync(RequestOptions options = null); | Task<IApplication> GetApplicationInfoAsync(RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Gets a generic channel via the snowflake identifier. | |||||
/// Gets a generic channel. | |||||
/// </summary> | /// </summary> | ||||
/// <example> | /// <example> | ||||
/// <code language="cs" title="Example method"> | |||||
/// <code lang="cs" title="Example method"> | |||||
/// var channel = await _client.GetChannelAsync(381889909113225237); | /// var channel = await _client.GetChannelAsync(381889909113225237); | ||||
/// if (channel != null && channel is IMessageChannel msgChannel) | /// if (channel != null && channel is IMessageChannel msgChannel) | ||||
/// { | /// { | ||||
/// await msgChannel.SendMessageAsync($"{msgChannel} is created at {msgChannel.CreatedAt}"); | /// await msgChannel.SendMessageAsync($"{msgChannel} is created at {msgChannel.CreatedAt}"); | ||||
/// } | /// } | ||||
/// </code> | |||||
/// </code> | |||||
/// </example> | /// </example> | ||||
/// <param name="id">The snowflake identifier of the channel (e.g. `381889909113225237`).</param> | /// <param name="id">The snowflake identifier of the channel (e.g. `381889909113225237`).</param> | ||||
/// <param name="mode"> | |||||
/// The <see cref="CacheMode"/> that determines whether the object should be fetched from cache. | |||||
/// </param> | |||||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing the channel associated with the snowflake identifier. | |||||
/// A task that represents the asynchronous get operation. The task result contains the channel associated | |||||
/// with the snowflake identifier; <c>null</c> when the channel cannot be found. | |||||
/// </returns> | /// </returns> | ||||
Task<IChannel> GetChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<IChannel> GetChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Gets a collection of private channels opened in this session. | /// Gets a collection of private channels opened in this session. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="mode"> | |||||
/// The <see cref="CacheMode" /> that determines whether the object should be fetched from cache. | |||||
/// </param> | |||||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <remarks> | /// <remarks> | ||||
/// This method will retrieve all private channels (including direct-message, group channel and such) that | /// This method will retrieve all private channels (including direct-message, group channel and such) that | ||||
@@ -95,8 +93,8 @@ namespace Discord | |||||
/// </note> | /// </note> | ||||
/// </remarks> | /// </remarks> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task" /> containing a collection of private channels that have been opened in | |||||
/// this session. | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection | |||||
/// of private channels that the user currently partakes in. | |||||
/// </returns> | /// </returns> | ||||
Task<IReadOnlyCollection<IPrivateChannel>> GetPrivateChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<IReadOnlyCollection<IPrivateChannel>> GetPrivateChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
@@ -109,13 +107,11 @@ namespace Discord | |||||
/// have just started the client, this may return an empty collection. | /// have just started the client, this may return an empty collection. | ||||
/// </note> | /// </note> | ||||
/// </remarks> | /// </remarks> | ||||
/// <param name="mode"> | |||||
/// The <see cref="CacheMode" /> that determines whether the object should be fetched from cache. | |||||
/// </param> | |||||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task" /> containing a collection of DM channels that have been opened in this | |||||
/// session. | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection | |||||
/// of direct-message channels that the user currently partakes in. | |||||
/// </returns> | /// </returns> | ||||
Task<IReadOnlyCollection<IDMChannel>> GetDMChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<IReadOnlyCollection<IDMChannel>> GetDMChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
@@ -128,64 +124,145 @@ namespace Discord | |||||
/// have just started the client, this may return an empty collection. | /// have just started the client, this may return an empty collection. | ||||
/// </note> | /// </note> | ||||
/// </remarks> | /// </remarks> | ||||
/// <param name="mode"> | |||||
/// The <see cref="CacheMode" /> that determines whether the object should be fetched from cache. | |||||
/// </param> | |||||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task" /> containing a collection of group channels that have been opened in this | |||||
/// session. | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection | |||||
/// of group channels that the user currently partakes in. | |||||
/// </returns> | /// </returns> | ||||
Task<IReadOnlyCollection<IGroupChannel>> GetGroupChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<IReadOnlyCollection<IGroupChannel>> GetGroupChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
/// <summary> | |||||
/// Gets the connections that the user has set up. | |||||
/// </summary> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection of connections. | |||||
/// </returns> | |||||
Task<IReadOnlyCollection<IConnection>> GetConnectionsAsync(RequestOptions options = null); | Task<IReadOnlyCollection<IConnection>> GetConnectionsAsync(RequestOptions options = null); | ||||
/// <summary> | |||||
/// Gets a guild. | |||||
/// </summary> | |||||
/// <param name="id">The guild snowflake identifier.</param> | |||||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous get operation. The task result contains the guild associated | |||||
/// with the snowflake identifier; <c>null</c> when the guild cannot be found. | |||||
/// </returns> | |||||
Task<IGuild> GetGuildAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<IGuild> GetGuildAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
/// <summary> | |||||
/// Gets a collection of guilds that the user is currently in. | |||||
/// </summary> | |||||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection | |||||
/// of guilds that the current user is in. | |||||
/// </returns> | |||||
Task<IReadOnlyCollection<IGuild>> GetGuildsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<IReadOnlyCollection<IGuild>> GetGuildsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
/// <summary> | |||||
/// Creates a guild for the logged-in user who is in less than 10 active guilds. | |||||
/// </summary> | |||||
/// <remarks> | |||||
/// This method creates a new guild on behalf of the logged-in user. | |||||
/// <note type="warning"> | |||||
/// Due to Discord's limitation, this method will only work for users that are in less than 10 guilds. | |||||
/// </note> | |||||
/// </remarks> | |||||
/// <param name="name">The name of the new guild.</param> | |||||
/// <param name="region">The voice region to create the guild with.</param> | |||||
/// <param name="jpegIcon">The icon of the guild.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous creation operation. The task result contains the created guild. | |||||
/// </returns> | |||||
Task<IGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null, RequestOptions options = null); | Task<IGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null, RequestOptions options = null); | ||||
/// <summary> | |||||
/// Gets an invite. | |||||
/// </summary> | |||||
/// <param name="inviteId">The invitation identifier.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous get operation. The task result contains the invite information. | |||||
/// </returns> | |||||
Task<IInvite> GetInviteAsync(string inviteId, RequestOptions options = null); | Task<IInvite> GetInviteAsync(string inviteId, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Gets a user via the snowflake identifier. | |||||
/// Gets a user. | |||||
/// </summary> | /// </summary> | ||||
/// <example> | /// <example> | ||||
/// <code language="cs" title="Example method"> | |||||
/// <code lang="cs" title="Example method"> | |||||
/// var user = await _client.GetUserAsync(168693960628371456); | /// var user = await _client.GetUserAsync(168693960628371456); | ||||
/// if (user != null) | /// if (user != null) | ||||
/// Console.WriteLine($"{user} is created at {user.CreatedAt}."; | /// Console.WriteLine($"{user} is created at {user.CreatedAt}."; | ||||
/// </code> | /// </code> | ||||
/// </example> | /// </example> | ||||
/// <param name="id">The snowflake identifier of the user (e.g. `168693960628371456`).</param> | /// <param name="id">The snowflake identifier of the user (e.g. `168693960628371456`).</param> | ||||
/// <param name="mode"> | |||||
/// The <see cref="CacheMode"/> that determines whether the object should be fetched from cache. | |||||
/// </param> | |||||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing the fetched user; <c>null</c> if none is found. | |||||
/// A task that represents the asynchronous get operation. The task result contains the user associated with | |||||
/// the snowflake identifier; <c>null</c> if the user is not found. | |||||
/// </returns> | /// </returns> | ||||
Task<IUser> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | Task<IUser> GetUserAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Gets a user via the username and discriminator combo. | |||||
/// Gets a user. | |||||
/// </summary> | /// </summary> | ||||
/// <example> | /// <example> | ||||
/// <code language="cs" title="Example method"> | |||||
/// var user = await _client.GetUserAsync("Still", "2876"); | |||||
/// if (user != null) | |||||
/// Console.WriteLine($"{user} is created at {user.CreatedAt}."; | |||||
/// </code> | |||||
/// <code lang="cs" title="Example method"> | |||||
/// var user = await _client.GetUserAsync("Still", "2876"); | |||||
/// if (user != null) | |||||
/// Console.WriteLine($"{user} is created at {user.CreatedAt}."; | |||||
/// </code> | |||||
/// </example> | /// </example> | ||||
/// <param name="username">The name of the user (e.g. `Still`).</param> | /// <param name="username">The name of the user (e.g. `Still`).</param> | ||||
/// <param name="discriminator">The discriminator value of the user (e.g. `2876`).</param> | /// <param name="discriminator">The discriminator value of the user (e.g. `2876`).</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task" /> containing the fetched user; <c>null</c> if none is found. | |||||
/// A task that represents the asynchronous get operation. The task result contains the user associated with | |||||
/// the name and the discriminator; <c>null</c> if the user is not found. | |||||
/// </returns> | /// </returns> | ||||
Task<IUser> GetUserAsync(string username, string discriminator, RequestOptions options = null); | Task<IUser> GetUserAsync(string username, string discriminator, RequestOptions options = null); | ||||
/// <summary> | |||||
/// Gets a collection of the available voice regions. | |||||
/// </summary> | |||||
/// <example> | |||||
/// The following example gets the most optimal voice region from the collection. | |||||
/// <code lang="cs"> | |||||
/// var regions = await client.GetVoiceRegionsAsync(); | |||||
/// var optimalRegion = regions.FirstOrDefault(x => x.IsOptimal); | |||||
/// </code> | |||||
/// </example> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection | |||||
/// with all of the available voice regions in this session. | |||||
/// </returns> | |||||
Task<IReadOnlyCollection<IVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null); | Task<IReadOnlyCollection<IVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null); | ||||
/// <summary> | |||||
/// Gets a voice region. | |||||
/// </summary> | |||||
/// <param name="id">The identifier of the voice region (e.g. <c>eu-central</c> ).</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous get operation. The task result contains the voice region | |||||
/// associated with the identifier; <c>null</c> if the voice region is not found. | |||||
/// </returns> | |||||
Task<IVoiceRegion> GetVoiceRegionAsync(string id, RequestOptions options = null); | Task<IVoiceRegion> GetVoiceRegionAsync(string id, RequestOptions options = null); | ||||
/// <summary> | |||||
/// Gets a webhook available. | |||||
/// </summary> | |||||
/// <param name="id">The identifier of the webhook.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous get operation. The task result contains a webhook associated | |||||
/// with the identifier; <c>null</c> if the webhook is not found. | |||||
/// </returns> | |||||
Task<IWebhook> GetWebhookAsync(ulong id, RequestOptions options = null); | Task<IWebhook> GetWebhookAsync(ulong id, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
@@ -193,8 +270,8 @@ namespace Discord | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing an <see cref="int"/> that represents the number of shards | |||||
/// that should be used with this account. | |||||
/// A task that represents the asynchronous get operation. The task result contains an <see cref="Int32"/> | |||||
/// that represents the number of shards that should be used with this account. | |||||
/// </returns> | /// </returns> | ||||
Task<int> GetRecommendedShardCountAsync(RequestOptions options = null); | Task<int> GetRecommendedShardCountAsync(RequestOptions options = null); | ||||
} | } | ||||
@@ -44,7 +44,8 @@ namespace Discord | |||||
/// <exception cref="Discord.Net.HttpException">Thrown when used from a user account.</exception> | /// <exception cref="Discord.Net.HttpException">Thrown when used from a user account.</exception> | ||||
/// <exception cref="NullReferenceException">Thrown when the message is deleted.</exception> | /// <exception cref="NullReferenceException">Thrown when the message is deleted.</exception> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing the downloaded entity. | |||||
/// A task that represents the asynchronous download operation. The task result contains the downloaded | |||||
/// entity. | |||||
/// </returns> | /// </returns> | ||||
public async Task<TEntity> DownloadAsync() | public async Task<TEntity> DownloadAsync() | ||||
{ | { | ||||
@@ -57,7 +58,8 @@ namespace Discord | |||||
/// <exception cref="Discord.Net.HttpException">Thrown when used from a user account.</exception> | /// <exception cref="Discord.Net.HttpException">Thrown when used from a user account.</exception> | ||||
/// <exception cref="NullReferenceException">Thrown when the message is deleted and is not in cache.</exception> | /// <exception cref="NullReferenceException">Thrown when the message is deleted and is not in cache.</exception> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing a cached or downloaded entity. | |||||
/// A task that represents the asynchronous operation that attempts to get the message via cache or to | |||||
/// download the message. The task result contains the downloaded entity. | |||||
/// </returns> | /// </returns> | ||||
public async Task<TEntity> GetOrDownloadAsync() => HasValue ? Value : await DownloadAsync().ConfigureAwait(false); | public async Task<TEntity> GetOrDownloadAsync() => HasValue ? Value : await DownloadAsync().ConfigureAwait(false); | ||||
} | } | ||||
@@ -32,9 +32,7 @@ namespace Discord.Rest | |||||
/// Gets the logged-in user. | /// Gets the logged-in user. | ||||
/// </summary> | /// </summary> | ||||
public ISelfUser CurrentUser { get; protected set; } | public ISelfUser CurrentUser { get; protected set; } | ||||
/// <summary> | |||||
/// Gets the type of the authentication token. | |||||
/// </summary> | |||||
/// <inheritdoc /> | |||||
public TokenType TokenType => ApiClient.AuthTokenType; | public TokenType TokenType => ApiClient.AuthTokenType; | ||||
/// <summary> Creates a new REST-only Discord client. </summary> | /// <summary> Creates a new REST-only Discord client. </summary> | ||||
@@ -62,8 +62,7 @@ namespace Discord.Rest | |||||
/// </returns> | /// </returns> | ||||
public string Code { get; } | public string Code { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether the invite is a temporary one (i.e. whether the invite will be removed from the guild | |||||
/// when the user logs off). | |||||
/// Gets a value that determines whether the invite is a temporary one. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// <c>true</c> if users accepting this invite will be removed from the guild when they log off; otherwise | /// <c>true</c> if users accepting this invite will be removed from the guild when they log off; otherwise | ||||
@@ -62,8 +62,7 @@ namespace Discord.Rest | |||||
/// </returns> | /// </returns> | ||||
public string Code { get; } | public string Code { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether the invite is a temporary one (i.e. whether the invite will be removed from the guild | |||||
/// when the user logs off). | |||||
/// Gets a value that indicates whether the invite is a temporary one. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// <c>true</c> if users accepting this invite will be removed from the guild when they log off; otherwise | /// <c>true</c> if users accepting this invite will be removed from the guild when they log off; otherwise | ||||
@@ -30,8 +30,7 @@ namespace Discord.Rest | |||||
/// </returns> | /// </returns> | ||||
public string Code { get; } | public string Code { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether the invite is a temporary one (i.e. whether the invite will be removed from the guild | |||||
/// when the user logs off). | |||||
/// Gets a value that indicates whether the invite is a temporary one. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// <c>true</c> if users accepting this invite will be removed from the guild when they log off, | /// <c>true</c> if users accepting this invite will be removed from the guild when they log off, | ||||
@@ -27,7 +27,7 @@ namespace Discord.Rest | |||||
/// </returns> | /// </returns> | ||||
public ulong RoleId { get; } | public ulong RoleId { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether the role was added to the user. | |||||
/// Gets a value that indicates whether the role was added to the user. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// <c>true</c> if the role was added to the user; otherwise <c>false</c>. | /// <c>true</c> if the role was added to the user; otherwise <c>false</c>. | ||||
@@ -24,19 +24,20 @@ namespace Discord.Rest | |||||
/// </returns> | /// </returns> | ||||
public Color? Color { get; } | public Color? Color { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether this role is mentionable (i.e. it can be mentioned in a text channel). | |||||
/// Gets a value that indicates whether this role is mentionable. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// <c>true</c> if other members can mention this role in a text channel; otherwise <c>false</c>. | |||||
/// <c>true</c> if other members can mention this role in a text channel; otherwise <c>false</c>; | |||||
/// <c>null</c> if this is not mentioned in this entry. | |||||
/// </returns> | /// </returns> | ||||
public bool? Mentionable { get; } | public bool? Mentionable { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Determines whether this role is hoisted (i.e its members will appear in a seperate section on the user | |||||
/// list). | |||||
/// Gets a value that indicates whether this role is hoisted (i.e. its members will appear in a separate | |||||
/// section on the user list). | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// <c>true</c> if this role's members will appear in a seperate section in the user list; otherwise | |||||
/// <c>false</c>. | |||||
/// <c>true</c> if this role's members will appear in a separate section in the user list; otherwise | |||||
/// <c>false</c>; <c>null</c> if this is not mentioned in this entry. | |||||
/// </returns> | /// </returns> | ||||
public bool? Hoist { get; } | public bool? Hoist { get; } | ||||
/// <summary> | /// <summary> | ||||
@@ -13,56 +13,67 @@ namespace Discord.Rest | |||||
/// Sends a message to this message channel. | /// Sends a message to this message channel. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="text">The message to be sent.</param> | /// <param name="text">The message to be sent.</param> | ||||
/// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | |||||
/// <param name="embed">The <see cref="EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||||
/// <param name="isTTS">Determines whether the message should be read aloud by Discord or not.</param> | |||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable Task containing the message sent to the channel. | |||||
/// A task that represents an asynchronous send operation for delievering the message. The task result | |||||
/// contains the sent message. | |||||
/// </returns> | /// </returns> | ||||
new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Sends a file to this message channel, with an optional caption. | |||||
/// Sends a file to this message channel with an optional caption. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | |||||
/// This method sends a file as if you are uploading an attachment directly from your Discord client. | |||||
/// <note> | |||||
/// If you wish to upload an image and have it embedded in a <see cref="Discord.EmbedType.Rich"/>embed, | |||||
/// you may upload the file and refer to the file with "attachment://filename.ext" in the | |||||
/// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | |||||
/// </note> | |||||
/// </remarks> | |||||
/// <param name="filePath">The file path of the file.</param> | /// <param name="filePath">The file path of the file.</param> | ||||
/// <param name="text">The message to be sent.</param> | /// <param name="text">The message to be sent.</param> | ||||
/// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | /// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | ||||
/// <param name="embed">The <see cref="EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich" /> <see cref="Embed" /> to be sent.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <remarks> | |||||
/// If you wish to upload an image and have it embedded in a <see cref="EmbedType.Rich"/> embed, you may | |||||
/// upload the file and refer to the file with "attachment://filename.ext" in the | |||||
/// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | |||||
/// </remarks> | |||||
/// <returns> | /// <returns> | ||||
/// An awaitable Task containing the message sent to the channel. | |||||
/// A task that represents an asynchronous send operation for delievering the message. The task result | |||||
/// contains the sent message. | |||||
/// </returns> | /// </returns> | ||||
new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Sends a file to this message channel, with an optional caption. | |||||
/// Sends a file to this message channel with an optional caption. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="stream">The <see cref="Stream"/> of the file to be sent.</param> | |||||
/// <remarks> | |||||
/// This method sends a file as if you are uploading an attachment directly from your Discord client. | |||||
/// <note> | |||||
/// If you wish to upload an image and have it embedded in a <see cref="Discord.EmbedType.Rich"/>embed, | |||||
/// you may upload the file and refer to the file with "attachment://filename.ext" in the | |||||
/// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | |||||
/// </note> | |||||
/// </remarks> | |||||
/// <param name="stream">The <see cref="Stream" /> of the file to be sent.</param> | |||||
/// <param name="filename">The name of the attachment.</param> | /// <param name="filename">The name of the attachment.</param> | ||||
/// <param name="text">The message to be sent.</param> | /// <param name="text">The message to be sent.</param> | ||||
/// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | /// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | ||||
/// <param name="embed">The <see cref="EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <remarks> | |||||
/// If you wish to upload an image and have it embedded in a <see cref="EmbedType.Rich"/> embed, you may | |||||
/// upload the file and refer to the file with "attachment://filename.ext" in the | |||||
/// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | |||||
/// </remarks> | |||||
/// <returns> | /// <returns> | ||||
/// An awaitable Task containing the message sent to the channel. | |||||
/// A task that represents an asynchronous send operation for delievering the message. The task result | |||||
/// contains the sent message. | |||||
/// </returns> | /// </returns> | ||||
new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Gets a message from this message channel with the given id, or <c>null</c> if not found. | |||||
/// Gets a message from this message channel. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="id">The ID of the message.</param> | |||||
/// <param name="id">The snowflake identifier of the message.</param> | |||||
/// <param name="mode">The <see cref="CacheMode"/> that determines whether the object should be fetched from cache.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// The message gotten from either the cache or the download, or <c>null</c> if none is found. | |||||
/// A task that represents an asynchronous get operation for retrieving the message. The task result contains | |||||
/// the retrieved message; <c>null</c> if no message is found with the specified identifier. | |||||
/// </returns> | /// </returns> | ||||
Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null); | Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
@@ -104,7 +115,8 @@ namespace Discord.Rest | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable Task containing a collection of messages. | |||||
/// A task that represents the asynchronous get operation for retrieving pinned messages in this channel. | |||||
/// The task result contains a collection of messages found in the pinned messages. | |||||
/// </returns> | /// </returns> | ||||
new Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null); | new Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null); | ||||
} | } | ||||
@@ -73,11 +73,11 @@ namespace Discord.Rest | |||||
=> ChannelHelper.DeleteAsync(this, Discord, options); | => ChannelHelper.DeleteAsync(this, Discord, options); | ||||
/// <summary> | /// <summary> | ||||
/// Gets the overwrite permissions of the specified <paramref name="user"/>. | |||||
/// Gets the permission overwrite for a specific user. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="user">The user that you want to get the overwrite permissions for.</param> | |||||
/// <param name="user">The user to get the overwrite from.</param> | |||||
/// <returns> | /// <returns> | ||||
/// The overwrite permissions for the requested user; otherwise <c>null</c>. | |||||
/// An overwrite object for the targeted user; <c>null</c> if none is set. | |||||
/// </returns> | /// </returns> | ||||
public OverwritePermissions? GetPermissionOverwrite(IUser user) | public OverwritePermissions? GetPermissionOverwrite(IUser user) | ||||
{ | { | ||||
@@ -90,11 +90,11 @@ namespace Discord.Rest | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the overwrite permissions of the specified <paramref name="role"/>. | |||||
/// Gets the permission overwrite for a specific role. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="role">The role that you want to get the overwrite permissions for.</param> | |||||
/// <param name="role">The role to get the overwrite from.</param> | |||||
/// <returns> | /// <returns> | ||||
/// The overwrite permissions for the requested role; otherwise <c>null</c>. | |||||
/// An overwrite object for the targeted role; <c>null</c> if none is set. | |||||
/// </returns> | /// </returns> | ||||
public OverwritePermissions? GetPermissionOverwrite(IRole role) | public OverwritePermissions? GetPermissionOverwrite(IRole role) | ||||
{ | { | ||||
@@ -107,42 +107,41 @@ namespace Discord.Rest | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Adds an overwrite permission for the specified <paramref name="user"/>. | |||||
/// Adds or updates the permission overwrite for the given user. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="user">The user you want the overwrite permission to apply to.</param> | |||||
/// <param name="perms">The overwrite permission you want to add.</param> | |||||
/// <param name="user">The user to add the overwrite to.</param> | |||||
/// <param name="permissions">The overwrite to add to the user.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task representing the asynchronous permission operation for adding the specified permissions to the channel. | |||||
/// </returns> | /// </returns> | ||||
public async Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions perms, RequestOptions options = null) | |||||
public async Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null) | |||||
{ | { | ||||
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, user, perms, options).ConfigureAwait(false); | |||||
_overwrites = _overwrites.Add(new Overwrite(user.Id, PermissionTarget.User, new OverwritePermissions(perms.AllowValue, perms.DenyValue))); | |||||
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, user, permissions, options).ConfigureAwait(false); | |||||
_overwrites = _overwrites.Add(new Overwrite(user.Id, PermissionTarget.User, new OverwritePermissions(permissions.AllowValue, permissions.DenyValue))); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Adds an overwrite permission for the specified <paramref name="role"/>. | |||||
/// Adds or updates the permission overwrite for the given role. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="role">The role you want the overwrite permission to apply to.</param> | |||||
/// <param name="perms">The overwrite permission you want to add.</param> | |||||
/// <param name="options">The options to be used when sending the request. </param> | |||||
/// <param name="role">The role to add the overwrite to.</param> | |||||
/// <param name="permissions">The overwrite to add to the role.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task representing the asynchronous permission operation for adding the specified permissions to the channel. | |||||
/// </returns> | /// </returns> | ||||
public async Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions perms, RequestOptions options = null) | |||||
public async Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null) | |||||
{ | { | ||||
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, role, perms, options).ConfigureAwait(false); | |||||
_overwrites = _overwrites.Add(new Overwrite(role.Id, PermissionTarget.Role, new OverwritePermissions(perms.AllowValue, perms.DenyValue))); | |||||
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, role, permissions, options).ConfigureAwait(false); | |||||
_overwrites = _overwrites.Add(new Overwrite(role.Id, PermissionTarget.Role, new OverwritePermissions(permissions.AllowValue, permissions.DenyValue))); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Removes an overwrite permission for the specified <paramref name="user"/>. | |||||
/// Removes the permission overwrite for the given user, if one exists. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="user">The user you want to remove the overwrite permission from.</param> | |||||
/// <param name="user">The user to remove the overwrite from.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task representing the asynchronous operation for removing the specified permissions from the channel. | |||||
/// </returns> | /// </returns> | ||||
public async Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null) | public async Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null) | ||||
{ | { | ||||
@@ -157,14 +156,13 @@ namespace Discord.Rest | |||||
} | } | ||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Removes an overwrite permission for the specified <paramref name="role"/>. | |||||
/// Removes the permission overwrite for the given role, if one exists. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="role">The role you want the overwrite permissions to be removed from.</param> | |||||
/// <param name="role">The role to remove the overwrite from.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task representing the asynchronous operation for removing the specified permissions from the channel. | |||||
/// </returns> | /// </returns> | ||||
public async Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null) | public async Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null) | ||||
{ | { | ||||
@@ -181,27 +179,27 @@ namespace Discord.Rest | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the invites for this channel. | |||||
/// Gets a collection of all invites to this channel. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing an <see cref="IReadOnlyCollection{RestInviteMetaData}"/>. | |||||
/// <see cref="RestInviteMetadata"/> contains information such as, the number of times the invite has | |||||
/// been used, who created the invite, and when the invite was created. | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection | |||||
/// of invite metadata that are created for this channel. | |||||
/// </returns> | /// </returns> | ||||
public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | ||||
=> await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); | => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); | ||||
/// <summary> | /// <summary> | ||||
/// Creates an invite for this channel. | |||||
/// Creates a new invite to this channel. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="maxAge">The number of seconds that you want the invite to be valid for.</param> | |||||
/// <param name="maxUses">The number of times this invite can be used before it expires.</param> | |||||
/// <param name="isTemporary">Whether or not the invite grants temporary membership.</param> | |||||
/// <param name="isUnique">Whether to try reuse a similar invite or not.</param> | |||||
/// <param name="maxAge">The time (in seconds) until the invite expires. Set to <c>null</c> to never expire.</param> | |||||
/// <param name="maxUses">The max amount of times this invite may be used. Set to <c>null</c> to have unlimited uses.</param> | |||||
/// <param name="isTemporary">If <c>true</c>, the user accepting this invite will be kicked from the guild after closing their client.</param> | |||||
/// <param name="isUnique">If <c>true</c>, don't try to reuse a similar invite (useful for creating many unique one time use invites).</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing a <see cref="RestInviteMetadata"/>. | |||||
/// A task that represents the asynchronous invite creation operation. The task result contains an invite | |||||
/// metadata object containing information for the created invite. | |||||
/// </returns> | /// </returns> | ||||
public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) | public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) | ||||
=> await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | ||||
@@ -34,6 +34,7 @@ namespace Discord.Rest | |||||
entity.Update(model); | entity.Update(model); | ||||
return entity; | return entity; | ||||
} | } | ||||
/// <inheritdoc /> | |||||
internal override void Update(Model model) | internal override void Update(Model model) | ||||
{ | { | ||||
base.Update(model); | base.Update(model); | ||||
@@ -50,23 +51,31 @@ namespace Discord.Rest | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Gets a user that is able to view this channel from the associate <paramref name="id"/>. | |||||
/// Gets a user in this channel. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="id">The snowflake identifier of the user you want to get.</param> | |||||
/// <param name="id">The snowflake identifier of the user.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <exception cref="InvalidOperationException"> | |||||
/// Resolving permissions requires the parent guild to be downloaded. | |||||
/// </exception> | |||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing a <see cref="RestGuildUser"/>. | |||||
/// A task representing the asynchronous get operation. The task result contains a guild user object that | |||||
/// represents the user; <c>null</c> if none is found. | |||||
/// </returns> | /// </returns> | ||||
public Task<RestGuildUser> GetUserAsync(ulong id, RequestOptions options = null) | public Task<RestGuildUser> GetUserAsync(ulong id, RequestOptions options = null) | ||||
=> ChannelHelper.GetUserAsync(this, Guild, Discord, id, options); | => ChannelHelper.GetUserAsync(this, Guild, Discord, id, options); | ||||
/// <summary> | /// <summary> | ||||
/// Gets the collection of users that can view this channel. | |||||
/// Gets a collection of users that are able to view the channel. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <exception cref="InvalidOperationException"> | |||||
/// Resolving permissions requires the parent guild to be downloaded. | |||||
/// </exception> | |||||
/// <returns> | /// <returns> | ||||
/// Paged collection of users. Flattening the paginated response into a collection of <see cref="RestGuildUser"/> | |||||
/// with <see cref="AsyncEnumerableExtensions.FlattenAsync{T}"/> is required if you wish to access the users. | |||||
/// A paged collection containing a collection of guild users that can access this channel. Flattening the | |||||
/// paginated response into a collection of users with | |||||
/// <see cref="AsyncEnumerableExtensions.FlattenAsync{T}"/> is required if you wish to access the users. | |||||
/// </returns> | /// </returns> | ||||
public IAsyncEnumerable<IReadOnlyCollection<RestGuildUser>> GetUsersAsync(RequestOptions options = null) | public IAsyncEnumerable<IReadOnlyCollection<RestGuildUser>> GetUsersAsync(RequestOptions options = null) | ||||
=> ChannelHelper.GetUsersAsync(this, Guild, Discord, null, null, options); | => ChannelHelper.GetUsersAsync(this, Guild, Discord, null, null, options); | ||||
@@ -147,27 +156,46 @@ namespace Discord.Rest | |||||
=> ChannelHelper.EnterTypingState(this, Discord, options); | => ChannelHelper.EnterTypingState(this, Discord, options); | ||||
/// <summary> | /// <summary> | ||||
/// Creates a webhook for this channel. | |||||
/// Creates a webhook in this text channel. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="name">The name you want to give the webhook.</param> | |||||
/// <param name="avatar">The avatar that you want the webook to have.</param> | |||||
/// <param name="name">The name of the webhook.</param> | |||||
/// <param name="avatar">The avatar of the webhook.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing a <see cref="RestWebhook"/>. | |||||
/// A task that represents the asynchronous creation operation. The task result contains the newly created | |||||
/// webhook. | |||||
/// </returns> | /// </returns> | ||||
public Task<RestWebhook> CreateWebhookAsync(string name, Stream avatar = null, RequestOptions options = null) | public Task<RestWebhook> CreateWebhookAsync(string name, Stream avatar = null, RequestOptions options = null) | ||||
=> ChannelHelper.CreateWebhookAsync(this, Discord, name, avatar, options); | => ChannelHelper.CreateWebhookAsync(this, Discord, name, avatar, options); | ||||
/// <summary> | |||||
/// Gets a webhook available in this text channel. | |||||
/// </summary> | |||||
/// <param name="id">The identifier of the webhook.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous get operation. The task result contains a webhook associated | |||||
/// with the identifier; <c>null</c> if the webhook is not found. | |||||
/// </returns> | |||||
public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null) | public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null) | ||||
=> ChannelHelper.GetWebhookAsync(this, Discord, id, options); | => ChannelHelper.GetWebhookAsync(this, Discord, id, options); | ||||
/// <summary> | |||||
/// Gets the webhooks available in this text channel. | |||||
/// </summary> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection | |||||
/// of webhooks that is available in this channel. | |||||
/// </returns> | |||||
public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null) | public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null) | ||||
=> ChannelHelper.GetWebhooksAsync(this, Discord, options); | => ChannelHelper.GetWebhooksAsync(this, Discord, options); | ||||
/// <summary> | /// <summary> | ||||
/// Gets the parent category of this channel. | |||||
/// Gets the parent (category) channel of this channel. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing an <see cref="ICategoryChannel"/>. | |||||
/// A task that represents the asynchronous get operation. The task result contains the category channel | |||||
/// representing the parent of this channel; <c>null</c> if none is set. | |||||
/// </returns> | /// </returns> | ||||
public Task<ICategoryChannel> GetCategoryAsync(RequestOptions options = null) | public Task<ICategoryChannel> GetCategoryAsync(RequestOptions options = null) | ||||
=> ChannelHelper.GetCategoryAsync(this, Discord, options); | => ChannelHelper.GetCategoryAsync(this, Discord, options); | ||||
@@ -48,11 +48,12 @@ namespace Discord.Rest | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the parent category of this channel. | |||||
/// Gets the parent (category) channel of this channel. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing an <see cref="ICategoryChannel"/>. | |||||
/// A task that represents the asynchronous get operation. The task result contains the category channel | |||||
/// representing the parent of this channel; <c>null</c> if none is set. | |||||
/// </returns> | /// </returns> | ||||
public Task<ICategoryChannel> GetCategoryAsync(RequestOptions options = null) | public Task<ICategoryChannel> GetCategoryAsync(RequestOptions options = null) | ||||
=> ChannelHelper.GetCategoryAsync(this, Discord, options); | => ChannelHelper.GetCategoryAsync(this, Discord, options); | ||||
@@ -16,33 +16,60 @@ namespace Discord.WebSocket | |||||
/// <summary> | /// <summary> | ||||
/// Gets the estimated round-trip latency, in milliseconds, to the gateway server. | /// Gets the estimated round-trip latency, in milliseconds, to the gateway server. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// An <see cref="int"/> that represents the round-trip latency to the WebSocket server. Please | |||||
/// note that this value does not represent a "true" latency for operations such as sending a message. | |||||
/// </returns> | |||||
public abstract int Latency { get; protected set; } | public abstract int Latency { get; protected set; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the status for the logged-in user. | /// Gets the status for the logged-in user. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// A status object that represents the user's online presence status. | |||||
/// </returns> | |||||
public abstract UserStatus Status { get; protected set; } | public abstract UserStatus Status { get; protected set; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the activity for the logged-in user. | /// Gets the activity for the logged-in user. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// An activity object that represents the user's current activity. | |||||
/// </returns> | |||||
public abstract IActivity Activity { get; protected set; } | public abstract IActivity Activity { get; protected set; } | ||||
internal new DiscordSocketApiClient ApiClient => base.ApiClient as DiscordSocketApiClient; | internal new DiscordSocketApiClient ApiClient => base.ApiClient as DiscordSocketApiClient; | ||||
/// <summary> | /// <summary> | ||||
/// Gets the current logged-in user. | |||||
/// Gets the current logged-in user. | |||||
/// </summary> | /// </summary> | ||||
public new SocketSelfUser CurrentUser { get => base.CurrentUser as SocketSelfUser; protected set => base.CurrentUser = value; } | public new SocketSelfUser CurrentUser { get => base.CurrentUser as SocketSelfUser; protected set => base.CurrentUser = value; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets a collection of guilds that the logged-in user is currently in. | |||||
/// Gets a collection of guilds that the user is currently in. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// A read-only collection of guilds that the current user is in. | |||||
/// </returns> | |||||
public abstract IReadOnlyCollection<SocketGuild> Guilds { get; } | public abstract IReadOnlyCollection<SocketGuild> Guilds { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets a collection of private channels that are currently open for the logged-in user. | |||||
/// Gets a collection of private channels opened in this session. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | |||||
/// This method will retrieve all private channels (including direct-message, group channel and such) that | |||||
/// are currently opened in this session. | |||||
/// <note type="warning"> | |||||
/// This method will not return previously opened private channels outside of the current session! If | |||||
/// you have just started the client, this may return an empty collection. | |||||
/// </note> | |||||
/// </remarks> | |||||
/// <returns> | |||||
/// A read-only collection of private channels that the user currently partakes in. | |||||
/// </returns> | |||||
public abstract IReadOnlyCollection<ISocketPrivateChannel> PrivateChannels { get; } | public abstract IReadOnlyCollection<ISocketPrivateChannel> PrivateChannels { get; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets a collection of available voice regions for the logged-in user. | |||||
/// Gets a collection of available voice regions. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// A read-only collection of voice regions that the user has access to. | |||||
/// </returns> | |||||
public abstract IReadOnlyCollection<RestVoiceRegion> VoiceRegions { get; } | public abstract IReadOnlyCollection<RestVoiceRegion> VoiceRegions { get; } | ||||
internal BaseSocketClient(DiscordSocketConfig config, DiscordRestApiClient client) | internal BaseSocketClient(DiscordSocketConfig config, DiscordRestApiClient client) | ||||
@@ -59,7 +86,8 @@ namespace Discord.WebSocket | |||||
/// </remarks> | /// </remarks> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing the application information. | |||||
/// A task that represents the asynchronous get operation. The task result contains the application | |||||
/// information. | |||||
/// </returns> | /// </returns> | ||||
public abstract Task<RestApplication> GetApplicationInfoAsync(RequestOptions options = null); | public abstract Task<RestApplication> GetApplicationInfoAsync(RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
@@ -107,7 +135,7 @@ namespace Discord.WebSocket | |||||
/// <summary> | /// <summary> | ||||
/// Gets a channel. | /// Gets a channel. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="id">The channel snowflake identifier.</param> | |||||
/// <param name="id">The snowflake identifier of the channel (e.g. `381889909113225237`).</param> | |||||
/// <returns> | /// <returns> | ||||
/// A generic WebSocket-based channel object (voice, text, category, etc.) associated with the identifier; | /// A generic WebSocket-based channel object (voice, text, category, etc.) associated with the identifier; | ||||
/// <c>null</c> when the channel cannot be found. | /// <c>null</c> when the channel cannot be found. | ||||
@@ -125,9 +153,10 @@ namespace Discord.WebSocket | |||||
/// <summary> | /// <summary> | ||||
/// Gets a voice region. | /// Gets a voice region. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="id">The unique identifier of the voice region.</param> | |||||
/// <param name="id">The identifier of the voice region (e.g. <c>eu-central</c> ).</param> | |||||
/// <returns> | /// <returns> | ||||
/// A REST-based voice region; <c>null</c> if none can be found. | |||||
/// A REST-based voice region associated with the identifier; <c>null</c> if the voice region is not | |||||
/// found. | |||||
/// </returns> | /// </returns> | ||||
public abstract RestVoiceRegion GetVoiceRegion(string id); | public abstract RestVoiceRegion GetVoiceRegion(string id); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -135,21 +164,21 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public abstract Task StopAsync(); | public abstract Task StopAsync(); | ||||
/// <summary> | /// <summary> | ||||
/// Sets the current status of the logged-in user (e.g. Online, Do not Disturb). | |||||
/// Sets the current status of the user (e.g. Online, Do not Disturb). | |||||
/// </summary> | /// </summary> | ||||
/// <param name="status">The new status to be set.</param> | /// <param name="status">The new status to be set.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task that represents the asynchronous set operation. | |||||
/// </returns> | /// </returns> | ||||
public abstract Task SetStatusAsync(UserStatus status); | public abstract Task SetStatusAsync(UserStatus status); | ||||
/// <summary> | /// <summary> | ||||
/// Sets the game of the logged-in user. | |||||
/// Sets the game of the user. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="name">The name of the game.</param> | /// <param name="name">The name of the game.</param> | ||||
/// <param name="streamUrl">If streaming, the URL of the stream. Must be a valid Twitch URL.</param> | /// <param name="streamUrl">If streaming, the URL of the stream. Must be a valid Twitch URL.</param> | ||||
/// <param name="type">The type of the game.</param> | /// <param name="type">The type of the game.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task that represents the asynchronous set operation. | |||||
/// </returns> | /// </returns> | ||||
public abstract Task SetGameAsync(string name, string streamUrl = null, ActivityType type = ActivityType.Playing); | public abstract Task SetGameAsync(string name, string streamUrl = null, ActivityType type = ActivityType.Playing); | ||||
/// <summary> | /// <summary> | ||||
@@ -167,7 +196,7 @@ namespace Discord.WebSocket | |||||
/// </remarks> | /// </remarks> | ||||
/// <param name="activity">The activty to be set.</param> | /// <param name="activity">The activty to be set.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task that represents the asynchronous set operation. | |||||
/// </returns> | /// </returns> | ||||
public abstract Task SetActivityAsync(IActivity activity); | public abstract Task SetActivityAsync(IActivity activity); | ||||
/// <summary> | /// <summary> | ||||
@@ -175,7 +204,7 @@ namespace Discord.WebSocket | |||||
/// </summary> | /// </summary> | ||||
/// <param name="guilds">The guilds to download the members from.</param> | /// <param name="guilds">The guilds to download the members from.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task that represents the asynchronous download operation. | |||||
/// </returns> | /// </returns> | ||||
public abstract Task DownloadUsersAsync(IEnumerable<IGuild> guilds); | public abstract Task DownloadUsersAsync(IEnumerable<IGuild> guilds); | ||||
@@ -193,26 +222,26 @@ namespace Discord.WebSocket | |||||
/// <param name="jpegIcon">The icon of the guild.</param> | /// <param name="jpegIcon">The icon of the guild.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing the newly created guild. | |||||
/// A task that represents the asynchronous creation operation. The task result contains the created guild. | |||||
/// </returns> | /// </returns> | ||||
public Task<RestGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null, RequestOptions options = null) | public Task<RestGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null, RequestOptions options = null) | ||||
=> ClientHelper.CreateGuildAsync(this, name, region, jpegIcon, options ?? RequestOptions.Default); | => ClientHelper.CreateGuildAsync(this, name, region, jpegIcon, options ?? RequestOptions.Default); | ||||
/// <summary> | /// <summary> | ||||
/// Gets the connections that the logged-in user has set up. | |||||
/// Gets the connections that the user has set up. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing a collection of connections. | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection of connections. | |||||
/// </returns> | /// </returns> | ||||
public Task<IReadOnlyCollection<RestConnection>> GetConnectionsAsync(RequestOptions options = null) | public Task<IReadOnlyCollection<RestConnection>> GetConnectionsAsync(RequestOptions options = null) | ||||
=> ClientHelper.GetConnectionsAsync(this, options ?? RequestOptions.Default); | => ClientHelper.GetConnectionsAsync(this, options ?? RequestOptions.Default); | ||||
/// <summary> | /// <summary> | ||||
/// Gets an invite with the provided invite identifier. | |||||
/// Gets an invite. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="inviteId">The invitation identifier.</param> | /// <param name="inviteId">The invitation identifier.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing the invite information. | |||||
/// A task that represents the asynchronous get operation. The task result contains the invite information. | |||||
/// </returns> | /// </returns> | ||||
public Task<RestInviteMetadata> GetInviteAsync(string inviteId, RequestOptions options = null) | public Task<RestInviteMetadata> GetInviteAsync(string inviteId, RequestOptions options = null) | ||||
=> ClientHelper.GetInviteAsync(this, inviteId, options ?? RequestOptions.Default); | => ClientHelper.GetInviteAsync(this, inviteId, options ?? RequestOptions.Default); | ||||
@@ -14,7 +14,7 @@ namespace Discord.WebSocket | |||||
/// Gets all messages in this channel's cache. | /// Gets all messages in this channel's cache. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// A collection of WebSocket-based messages. | |||||
/// A read-only collection of WebSocket-based messages. | |||||
/// </returns> | /// </returns> | ||||
IReadOnlyCollection<SocketMessage> CachedMessages { get; } | IReadOnlyCollection<SocketMessage> CachedMessages { get; } | ||||
@@ -22,46 +22,55 @@ namespace Discord.WebSocket | |||||
/// Sends a message to this message channel. | /// Sends a message to this message channel. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="text">The message to be sent.</param> | /// <param name="text">The message to be sent.</param> | ||||
/// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | |||||
/// <param name="embed">The <see cref="EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||||
/// <param name="isTTS">Determines whether the message should be read aloud by Discord or not.</param> | |||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable Task containing the message sent to the channel. | |||||
/// A task that represents an asynchronous send operation for delievering the message. The task result | |||||
/// contains the sent message. | |||||
/// </returns> | /// </returns> | ||||
new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | new Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Sends a file to this message channel, with an optional caption. | |||||
/// Sends a file to this message channel with an optional caption. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | |||||
/// This method sends a file as if you are uploading an attachment directly from your Discord client. | |||||
/// <note> | |||||
/// If you wish to upload an image and have it embedded in a <see cref="Discord.EmbedType.Rich"/>embed, | |||||
/// you may upload the file and refer to the file with "attachment://filename.ext" in the | |||||
/// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | |||||
/// </note> | |||||
/// </remarks> | |||||
/// <param name="filePath">The file path of the file.</param> | /// <param name="filePath">The file path of the file.</param> | ||||
/// <param name="text">The message to be sent.</param> | /// <param name="text">The message to be sent.</param> | ||||
/// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | /// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | ||||
/// <param name="embed">The <see cref="EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich" /> <see cref="Embed" /> to be sent.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <remarks> | |||||
/// If you wish to upload an image and have it embedded in a <see cref="EmbedType.Rich"/> embed, you may | |||||
/// upload the file and refer to the file with "attachment://filename.ext" in the | |||||
/// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | |||||
/// </remarks> | |||||
/// <returns> | /// <returns> | ||||
/// An awaitable Task containing the message sent to the channel. | |||||
/// A task that represents an asynchronous send operation for delievering the message. The task result | |||||
/// contains the sent message. | |||||
/// </returns> | /// </returns> | ||||
new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Sends a file to this message channel, with an optional caption. | |||||
/// Sends a file to this message channel with an optional caption. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="stream">The <see cref="Stream"/> of the file to be sent.</param> | |||||
/// <remarks> | |||||
/// This method sends a file as if you are uploading an attachment directly from your Discord client. | |||||
/// <note> | |||||
/// If you wish to upload an image and have it embedded in a <see cref="Discord.EmbedType.Rich"/>embed, | |||||
/// you may upload the file and refer to the file with "attachment://filename.ext" in the | |||||
/// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | |||||
/// </note> | |||||
/// </remarks> | |||||
/// <param name="stream">The <see cref="Stream" /> of the file to be sent.</param> | |||||
/// <param name="filename">The name of the attachment.</param> | /// <param name="filename">The name of the attachment.</param> | ||||
/// <param name="text">The message to be sent.</param> | /// <param name="text">The message to be sent.</param> | ||||
/// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | /// <param name="isTTS">Whether the message should be read aloud by Discord or not.</param> | ||||
/// <param name="embed">The <see cref="EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||||
/// <param name="embed">The <see cref="Discord.EmbedType.Rich"/> <see cref="Embed"/> to be sent.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <remarks> | |||||
/// If you wish to upload an image and have it embedded in a <see cref="EmbedType.Rich"/> embed, you may | |||||
/// upload the file and refer to the file with "attachment://filename.ext" in the | |||||
/// <see cref="Discord.EmbedBuilder.ImageUrl"/>. | |||||
/// </remarks> | |||||
/// <returns> | /// <returns> | ||||
/// An awaitable Task containing the message sent to the channel. | |||||
/// A task that represents an asynchronous send operation for delievering the message. The task result | |||||
/// contains the sent message. | |||||
/// </returns> | /// </returns> | ||||
new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
@@ -78,7 +87,7 @@ namespace Discord.WebSocket | |||||
/// </summary> | /// </summary> | ||||
/// <param name="limit">The number of messages to get.</param> | /// <param name="limit">The number of messages to get.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A collection of WebSocket-based messages. | |||||
/// A read-only collection of WebSocket-based messages. | |||||
/// </returns> | /// </returns> | ||||
IReadOnlyCollection<SocketMessage> GetCachedMessages(int limit = DiscordConfig.MaxMessagesPerBatch); | IReadOnlyCollection<SocketMessage> GetCachedMessages(int limit = DiscordConfig.MaxMessagesPerBatch); | ||||
@@ -89,7 +98,7 @@ namespace Discord.WebSocket | |||||
/// <param name="dir">The direction of which the message should be gotten from.</param> | /// <param name="dir">The direction of which the message should be gotten from.</param> | ||||
/// <param name="limit">The number of messages to get.</param> | /// <param name="limit">The number of messages to get.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A collection of WebSocket-based messages. | |||||
/// A read-only collection of WebSocket-based messages. | |||||
/// </returns> | /// </returns> | ||||
IReadOnlyCollection<SocketMessage> GetCachedMessages(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch); | IReadOnlyCollection<SocketMessage> GetCachedMessages(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch); | ||||
/// <summary> | /// <summary> | ||||
@@ -99,7 +108,7 @@ namespace Discord.WebSocket | |||||
/// <param name="dir">The direction of which the message should be gotten from.</param> | /// <param name="dir">The direction of which the message should be gotten from.</param> | ||||
/// <param name="limit">The number of messages to get.</param> | /// <param name="limit">The number of messages to get.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A collection of WebSocket-based messages. | |||||
/// A read-only collection of WebSocket-based messages. | |||||
/// </returns> | /// </returns> | ||||
IReadOnlyCollection<SocketMessage> GetCachedMessages(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch); | IReadOnlyCollection<SocketMessage> GetCachedMessages(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch); | ||||
/// <summary> | /// <summary> | ||||
@@ -107,7 +116,8 @@ namespace Discord.WebSocket | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A collection of messages. | |||||
/// A task that represents the asynchronous get operation for retrieving pinned messages in this channel. | |||||
/// The task result contains a collection of messages found in the pinned messages. | |||||
/// </returns> | /// </returns> | ||||
new Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null); | new Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null); | ||||
} | } | ||||
@@ -21,7 +21,7 @@ namespace Discord.WebSocket | |||||
/// Gets the guild associated with this channel. | /// Gets the guild associated with this channel. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// A guild that this channel belongs to. | |||||
/// A guild object that this channel belongs to. | |||||
/// </returns> | /// </returns> | ||||
public SocketGuild Guild { get; } | public SocketGuild Guild { get; } | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
@@ -35,7 +35,7 @@ namespace Discord.WebSocket | |||||
/// Gets a collection of users that are able to view the channel. | /// Gets a collection of users that are able to view the channel. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// A collection of users that can access the channel (i.e. the users seen in the user list). | |||||
/// A read-only collection of users that can access the channel (i.e. the users seen in the user list). | |||||
/// </returns> | /// </returns> | ||||
public new virtual IReadOnlyCollection<SocketGuildUser> Users => ImmutableArray.Create<SocketGuildUser>(); | public new virtual IReadOnlyCollection<SocketGuildUser> Users => ImmutableArray.Create<SocketGuildUser>(); | ||||
@@ -59,6 +59,7 @@ namespace Discord.WebSocket | |||||
return new SocketGuildChannel(guild.Discord, model.Id, guild); | return new SocketGuildChannel(guild.Discord, model.Id, guild); | ||||
} | } | ||||
} | } | ||||
/// <inheritdoc /> | |||||
internal override void Update(ClientState state, Model model) | internal override void Update(ClientState state, Model model) | ||||
{ | { | ||||
Name = model.Name.Value; | Name = model.Name.Value; | ||||
@@ -79,11 +80,11 @@ namespace Discord.WebSocket | |||||
=> ChannelHelper.DeleteAsync(this, Discord, options); | => ChannelHelper.DeleteAsync(this, Discord, options); | ||||
/// <summary> | /// <summary> | ||||
/// Gets the overwrite permissions of the specified <paramref name="user"/>. | |||||
/// Gets the permission overwrite for a specific user. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="user">The user that you want to get the overwrite permissions for.</param> | |||||
/// <param name="user">The user to get the overwrite from.</param> | |||||
/// <returns> | /// <returns> | ||||
/// The overwrite permissions for the requested user; otherwise <c>null</c>. | |||||
/// An overwrite object for the targeted user; <c>null</c> if none is set. | |||||
/// </returns> | /// </returns> | ||||
public OverwritePermissions? GetPermissionOverwrite(IUser user) | public OverwritePermissions? GetPermissionOverwrite(IUser user) | ||||
{ | { | ||||
@@ -94,13 +95,12 @@ namespace Discord.WebSocket | |||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the overwrite permissions of the specified <paramref name="role"/>. | |||||
/// Gets the permission overwrite for a specific role. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="role">The role that you want to get the overwrite permissions for.</param> | |||||
/// <param name="role">The role to get the overwrite from.</param> | |||||
/// <returns> | /// <returns> | ||||
/// The overwrite permissions for the requested role; otherwise <c>null</c>. | |||||
/// An overwrite object for the targeted role; <c>null</c> if none is set. | |||||
/// </returns> | /// </returns> | ||||
public OverwritePermissions? GetPermissionOverwrite(IRole role) | public OverwritePermissions? GetPermissionOverwrite(IRole role) | ||||
{ | { | ||||
@@ -113,41 +113,41 @@ namespace Discord.WebSocket | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Adds an overwrite permission for the specified <paramref name="user"/>. | |||||
/// Adds or updates the permission overwrite for the given user. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="user">The user you want the overwrite permission to apply to.</param> | |||||
/// <param name="perms">The overwrite permission you want to add.</param> | |||||
/// <param name="user">The user to add the overwrite to.</param> | |||||
/// <param name="permissions">The overwrite to add to the user.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task representing the asynchronous permission operation for adding the specified permissions to the channel. | |||||
/// </returns> | /// </returns> | ||||
public async Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions perms, RequestOptions options = null) | |||||
public async Task AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options = null) | |||||
{ | { | ||||
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, user, perms, options).ConfigureAwait(false); | |||||
_overwrites = _overwrites.Add(new Overwrite(user.Id, PermissionTarget.User, new OverwritePermissions(perms.AllowValue, perms.DenyValue))); | |||||
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, user, permissions, options).ConfigureAwait(false); | |||||
_overwrites = _overwrites.Add(new Overwrite(user.Id, PermissionTarget.User, new OverwritePermissions(permissions.AllowValue, permissions.DenyValue))); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Adds an overwrite permission for the specified <paramref name="role"/>. | |||||
/// Adds or updates the permission overwrite for the given role. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="role">The role you want the overwrite permission to apply to.</param> | |||||
/// <param name="perms">The overwrite permission you want to add.</param> | |||||
/// <param name="options">The options to be used when sending the request. </param> | |||||
/// <param name="role">The role to add the overwrite to.</param> | |||||
/// <param name="permissions">The overwrite to add to the role.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task representing the asynchronous permission operation for adding the specified permissions to the channel. | |||||
/// </returns> | /// </returns> | ||||
public async Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions perms, RequestOptions options = null) | |||||
public async Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null) | |||||
{ | { | ||||
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, role, perms, options).ConfigureAwait(false); | |||||
_overwrites = _overwrites.Add(new Overwrite(role.Id, PermissionTarget.Role, new OverwritePermissions(perms.AllowValue, perms.DenyValue))); | |||||
await ChannelHelper.AddPermissionOverwriteAsync(this, Discord, role, permissions, options).ConfigureAwait(false); | |||||
_overwrites = _overwrites.Add(new Overwrite(role.Id, PermissionTarget.Role, new OverwritePermissions(permissions.AllowValue, permissions.DenyValue))); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Removes an overwrite permission for the specified <paramref name="user"/>. | |||||
/// Removes the permission overwrite for the given user, if one exists. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="user">The user you want to remove the overwrite permission from.</param> | |||||
/// <param name="user">The user to remove the overwrite from.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task representing the asynchronous operation for removing the specified permissions from the channel. | |||||
/// </returns> | /// </returns> | ||||
public async Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null) | public async Task RemovePermissionOverwriteAsync(IUser user, RequestOptions options = null) | ||||
{ | { | ||||
@@ -163,12 +163,12 @@ namespace Discord.WebSocket | |||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Removes an overwrite permission for the specified <paramref name="role"/>. | |||||
/// Removes the permission overwrite for the given role, if one exists. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="role">The role you want the overwrite permissions to be removed from.</param> | |||||
/// <param name="role">The role to remove the overwrite from.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/>. | |||||
/// A task representing the asynchronous operation for removing the specified permissions from the channel. | |||||
/// </returns> | /// </returns> | ||||
public async Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null) | public async Task RemovePermissionOverwriteAsync(IRole role, RequestOptions options = null) | ||||
{ | { | ||||
@@ -185,26 +185,26 @@ namespace Discord.WebSocket | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the invites for this channel. | |||||
/// Returns a collection of all invites to this channel. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing an <see cref="IReadOnlyCollection{RestInviteMetaData}"/>. | |||||
/// <see cref="RestInviteMetadata"/> contains information such as, the number of times the invite has | |||||
/// been used, who created the invite, and when the invite was created. | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection | |||||
/// of invite metadata that are created for this channel. | |||||
/// </returns> | /// </returns> | ||||
public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | ||||
=> await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); | => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); | ||||
/// <summary> | /// <summary> | ||||
/// Creates an invite for this channel. | |||||
/// Creates a new invite to this channel. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="maxAge">The number of seconds that you want the invite to be valid for.</param> | |||||
/// <param name="maxUses">The number of times this invite can be used before it expires.</param> | |||||
/// <param name="isTemporary">Whether or not the invite grants temporary membership.</param> | |||||
/// <param name="isUnique">Whether to try reuse a similar invite or not.</param> | |||||
/// <param name="maxAge">The time (in seconds) until the invite expires. Set to <c>null</c> to never expire.</param> | |||||
/// <param name="maxUses">The max amount of times this invite may be used. Set to <c>null</c> to have unlimited uses.</param> | |||||
/// <param name="isTemporary">If <c>true</c>, the user accepting this invite will be kicked from the guild after closing their client.</param> | |||||
/// <param name="isUnique">If <c>true</c>, don't try to reuse a similar invite (useful for creating many unique one time use invites).</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing a <see cref="RestInviteMetadata"/>. | |||||
/// A task that represents the asynchronous invite creation operation. The task result contains an invite | |||||
/// metadata object containing information for the created invite. | |||||
/// </returns> | /// </returns> | ||||
public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) | public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) | ||||
=> await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | ||||
@@ -214,12 +214,18 @@ namespace Discord.WebSocket | |||||
/// <summary> | /// <summary> | ||||
/// Gets the name of the channel. | /// Gets the name of the channel. | ||||
/// </summary> | /// </summary> | ||||
/// <returns> | |||||
/// A string that resolves to <see cref="SocketGuildChannel.Name"/>. | |||||
/// </returns> | |||||
public override string ToString() => Name; | public override string ToString() => Name; | ||||
private string DebuggerDisplay => $"{Name} ({Id}, Guild)"; | private string DebuggerDisplay => $"{Name} ({Id}, Guild)"; | ||||
/// <inheritdoc /> | |||||
internal new SocketGuildChannel Clone() => MemberwiseClone() as SocketGuildChannel; | internal new SocketGuildChannel Clone() => MemberwiseClone() as SocketGuildChannel; | ||||
//SocketChannel | //SocketChannel | ||||
/// <inheritdoc /> | |||||
internal override IReadOnlyCollection<SocketUser> GetUsersInternal() => Users; | internal override IReadOnlyCollection<SocketUser> GetUsersInternal() => Users; | ||||
/// <inheritdoc /> | |||||
internal override SocketUser GetUserInternal(ulong id) => GetUser(id); | internal override SocketUser GetUserInternal(ulong id) => GetUser(id); | ||||
//IGuildChannel | //IGuildChannel | ||||
@@ -76,11 +76,11 @@ namespace Discord.WebSocket | |||||
/// <summary> | /// <summary> | ||||
/// Gets a message from this message channel. | /// Gets a message from this message channel. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="id">The ID of the message.</param> | |||||
/// <param name="id">The snowflake identifier of the message.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing the downloaded message; <c>null</c> if none is found or if | |||||
/// the message fails to be retrieved. | |||||
/// A task that represents an asynchrnous get operation for retrieving the message. The task result contains | |||||
/// the retrieved message; <c>null</c> if no message is found with the specified identifier. | |||||
/// </returns> | /// </returns> | ||||
public async Task<IMessage> GetMessageAsync(ulong id, RequestOptions options = null) | public async Task<IMessage> GetMessageAsync(ulong id, RequestOptions options = null) | ||||
{ | { | ||||
@@ -202,7 +202,8 @@ namespace Discord.WebSocket | |||||
/// <param name="avatar">The avatar of the webhook.</param> | /// <param name="avatar">The avatar of the webhook.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing the created webhook. | |||||
/// A task that represents the asynchronous creation operation. The task result contains the newly created | |||||
/// webhook. | |||||
/// </returns> | /// </returns> | ||||
public Task<RestWebhook> CreateWebhookAsync(string name, Stream avatar = null, RequestOptions options = null) | public Task<RestWebhook> CreateWebhookAsync(string name, Stream avatar = null, RequestOptions options = null) | ||||
=> ChannelHelper.CreateWebhookAsync(this, Discord, name, avatar, options); | => ChannelHelper.CreateWebhookAsync(this, Discord, name, avatar, options); | ||||
@@ -212,8 +213,8 @@ namespace Discord.WebSocket | |||||
/// <param name="id">The identifier of the webhook.</param> | /// <param name="id">The identifier of the webhook.</param> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing a webhook associated with the identifier; <c>null</c> if not | |||||
/// found. | |||||
/// A task that represents the asynchronous get operation. The task result contains a webhook associated | |||||
/// with the identifier; <c>null</c> if the webhook is not found. | |||||
/// </returns> | /// </returns> | ||||
public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null) | public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null) | ||||
=> ChannelHelper.GetWebhookAsync(this, Discord, id, options); | => ChannelHelper.GetWebhookAsync(this, Discord, id, options); | ||||
@@ -222,7 +223,8 @@ namespace Discord.WebSocket | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing a collection of found webhooks. | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection | |||||
/// of webhooks that is available in this channel. | |||||
/// </returns> | /// </returns> | ||||
public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null) | public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null) | ||||
=> ChannelHelper.GetWebhooksAsync(this, Discord, options); | => ChannelHelper.GetWebhooksAsync(this, Discord, options); | ||||
@@ -23,10 +23,10 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public ulong? CategoryId { get; private set; } | public ulong? CategoryId { get; private set; } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the parent (category) of this channel in the guild's channel list. | |||||
/// Gets the parent (category) channel of this channel. | |||||
/// </summary> | /// </summary> | ||||
/// <returns> | /// <returns> | ||||
/// An <see cref="ICategoryChannel"/> representing the parent of this channel; <c>null</c> if none is set. | |||||
/// A category channel representing the parent of this channel; <c>null</c> if none is set. | |||||
/// </returns> | /// </returns> | ||||
public ICategoryChannel Category | public ICategoryChannel Category | ||||
=> CategoryId.HasValue ? Guild.GetChannel(CategoryId.Value) as ICategoryChannel : null; | => CategoryId.HasValue ? Guild.GetChannel(CategoryId.Value) as ICategoryChannel : null; | ||||
@@ -45,6 +45,7 @@ namespace Discord.WebSocket | |||||
entity.Update(state, model); | entity.Update(state, model); | ||||
return entity; | return entity; | ||||
} | } | ||||
/// <inheritdoc /> | |||||
internal override void Update(ClientState state, Model model) | internal override void Update(ClientState state, Model model) | ||||
{ | { | ||||
base.Update(state, model); | base.Update(state, model); | ||||
@@ -63,12 +64,7 @@ namespace Discord.WebSocket | |||||
return await Guild.ConnectAudioAsync(Id, selfDeaf, selfMute, external).ConfigureAwait(false); | return await Guild.ConnectAudioAsync(Id, selfDeaf, selfMute, external).ConfigureAwait(false); | ||||
} | } | ||||
/// <summary> | |||||
/// Disconnects from this voice channel if the client is in an active voice connection. | |||||
/// </summary> | |||||
/// <returns> | |||||
/// An awaitable <see cref="Task" /> . | |||||
/// </returns> | |||||
/// <inheritdoc /> | |||||
public async Task DisconnectAsync() | public async Task DisconnectAsync() | ||||
=> await Guild.DisconnectAudioAsync(); | => await Guild.DisconnectAudioAsync(); | ||||
@@ -738,21 +738,23 @@ namespace Discord.WebSocket | |||||
//Webhooks | //Webhooks | ||||
/// <summary> | /// <summary> | ||||
/// Returns the webhook with the provided ID. | |||||
/// Gets a webhook found within this guild. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="id">The ID of the webhook.</param> | |||||
/// <param name="id">The identifier for the webhook.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing the webhook associated with the ID. | |||||
/// A task that represents the asynchronous get operation. The task result contains the webhook with the | |||||
/// specified <paramref name="id"/>; <c>null</c> if none is found. | |||||
/// </returns> | /// </returns> | ||||
public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null) | public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null) | ||||
=> GuildHelper.GetWebhookAsync(this, Discord, id, options); | => GuildHelper.GetWebhookAsync(this, Discord, id, options); | ||||
/// <summary> | /// <summary> | ||||
/// Gets a collection of webhooks that exist in the guild. | |||||
/// Gets a collection of all webhook from this guild. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// An awaitable <see cref="Task"/> containing a collection of webhooks. | |||||
/// A task that represents the asynchronous get operation. The task result contains a read-only collection | |||||
/// of webhooks found within the guild. | |||||
/// </returns> | /// </returns> | ||||
public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null) | public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null) | ||||
=> GuildHelper.GetWebhooksAsync(this, Discord, options); | => GuildHelper.GetWebhooksAsync(this, Discord, options); | ||||