| @@ -1,12 +1,10 @@ | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
| namespace Discord.Commands | namespace Discord.Commands | ||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// This attribute requires that the bot has a speicifed permission in the channel a command is invoked in. | |||||
| /// This attribute requires that the bot has a specified permission in the channel a command is invoked in. | |||||
| /// </summary> | /// </summary> | ||||
| [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] | ||||
| public class RequireBotPermissionAttribute : PreconditionAttribute | public class RequireBotPermissionAttribute : PreconditionAttribute | ||||
| @@ -18,7 +16,7 @@ namespace Discord.Commands | |||||
| /// Require that the bot account has a specified GuildPermission | /// Require that the bot account has a specified GuildPermission | ||||
| /// </summary> | /// </summary> | ||||
| /// <remarks>This precondition will always fail if the command is being invoked in a private channel.</remarks> | /// <remarks>This precondition will always fail if the command is being invoked in a private channel.</remarks> | ||||
| /// <param name="permission">The GuildPermission that the bot must have. Multiple permissions can be specified by ORing or ANDing the permissions together.</param> | |||||
| /// <param name="permission">The GuildPermission that the bot must have. Multiple permissions can be specified by ORing the permissions together.</param> | |||||
| public RequireBotPermissionAttribute(GuildPermission permission) | public RequireBotPermissionAttribute(GuildPermission permission) | ||||
| { | { | ||||
| GuildPermission = permission; | GuildPermission = permission; | ||||
| @@ -27,7 +25,7 @@ namespace Discord.Commands | |||||
| /// <summary> | /// <summary> | ||||
| /// Require that the bot account has a specified ChannelPermission. | /// Require that the bot account has a specified ChannelPermission. | ||||
| /// </summary> | /// </summary> | ||||
| /// <param name="permission">The ChannelPermission that the bot must have. Multiple permissions can be specified by ORing or ANDing the permissions together.</param> | |||||
| /// <param name="permission">The ChannelPermission that the bot must have. Multiple permissions can be specified by ORing the permissions together.</param> | |||||
| /// <example> | /// <example> | ||||
| /// <code language="c#"> | /// <code language="c#"> | ||||
| /// [Command("permission")] | /// [Command("permission")] | ||||
| @@ -22,7 +22,7 @@ namespace Discord.Commands | |||||
| /// <summary> | /// <summary> | ||||
| /// Require that the command be invoked in a specified context. | /// Require that the command be invoked in a specified context. | ||||
| /// </summary> | /// </summary> | ||||
| /// <param name="contexts">The type of context the command can be invoked in. Multiple contexts can be speicifed by ORing the contexts together.</param> | |||||
| /// <param name="contexts">The type of context the command can be invoked in. Multiple contexts can be specified by ORing the contexts together.</param> | |||||
| /// <example> | /// <example> | ||||
| /// <code language="c#"> | /// <code language="c#"> | ||||
| /// [Command("private_only")] | /// [Command("private_only")] | ||||
| @@ -1,8 +1,5 @@ | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
| using Discord; | |||||
| namespace Discord.Commands | namespace Discord.Commands | ||||
| { | { | ||||
| @@ -16,7 +16,7 @@ namespace Discord.Commands | |||||
| /// Require that the user invoking the command has a specified GuildPermission | /// Require that the user invoking the command has a specified GuildPermission | ||||
| /// </summary> | /// </summary> | ||||
| /// <remarks>This precondition will always fail if the command is being invoked in a private channel.</remarks> | /// <remarks>This precondition will always fail if the command is being invoked in a private channel.</remarks> | ||||
| /// <param name="permission">The GuildPermission that the user must have. Multiple permissions can be specified by ORing or ANDing the permissions together.</param> | |||||
| /// <param name="permission">The GuildPermission that the user must have. Multiple permissions can be specified by ORing the permissions together.</param> | |||||
| public RequireUserPermissionAttribute(GuildPermission permission) | public RequireUserPermissionAttribute(GuildPermission permission) | ||||
| { | { | ||||
| GuildPermission = permission; | GuildPermission = permission; | ||||
| @@ -25,11 +25,11 @@ namespace Discord.Commands | |||||
| /// <summary> | /// <summary> | ||||
| /// Require that the user invoking the command has a specified ChannelPermission. | /// Require that the user invoking the command has a specified ChannelPermission. | ||||
| /// </summary> | /// </summary> | ||||
| /// <param name="permission">The ChannelPermission that the user must have. Multiple permissions can be specified by ORing or ANDing the permissions together.</param> | |||||
| /// <param name="permission">The ChannelPermission that the user must have. Multiple permissions can be specified by ORing the permissions together.</param> | |||||
| /// <example> | /// <example> | ||||
| /// <code language="c#"> | /// <code language="c#"> | ||||
| /// [Command("permission")] | /// [Command("permission")] | ||||
| /// [RequireUserPermission(ChannelPermission.ReadMessageHistory & ChannelPermission.ReadMessages)] | |||||
| /// [RequireUserPermission(ChannelPermission.ReadMessageHistory | ChannelPermission.ReadMessages)] | |||||
| /// public async Task HasPermission() | /// public async Task HasPermission() | ||||
| /// { | /// { | ||||
| /// await ReplyAsync("You can read messages and the message history!"); | /// await ReplyAsync("You can read messages and the message history!"); | ||||