Commit Graph

60 Commits

Author SHA1 Message Date
Joe4evr
4a9c8168a9 Add grouping of preconditions to allow for flexible precondition logic. (#672)
* Add grouping of preconditions to allow for flexible precondition logic.

* Fix checking Module Preconditions twice (and none of the command's own)

* Fix command preconditions group 0 looping over every other precondition anyway #whoopsies

* Use custom message when a non-zero Precondition Group fails.

* Fix doc comment rendering.

* Refactor loops into local function

* Considering a new result type

* Switch to IReadOnlyCollection<T> and fix compiler errors

* Revert PreconditionResult -> IResult in return types - Change PreconditionResult to a class that PreconditionGroupResult inherits.

* Feedback on property name.

* Change grouping type int -> string

* Explicitly use an ordinal StringComparer

* Full stops on error messages

* Remove some sillyness.

* Remove unneeded using.
2017-06-23 11:28:22 -03:00
FiniteReality
0550006d56 Change wording of permission preconditions
Also fix an issue where RequireBotPermission may throw if used in a
non-guild channel which required guild permissions.
2017-06-17 15:10:35 +01:00
RogueException
870dc50a68 Fixed RequireNsfwAttribute definition 2017-05-04 13:15:51 -03:00
RogueException
ba1982a3f9 Replaced DependencyMap with ServiceCollection and IServiceProvider (#625) 2017-05-04 12:52:26 -03:00
Christopher F
7f1fc286cf Add IChannel.Nsfw, RequireNsfw precondition (#633)
* Add IChannel.Nsfw, RequireNsfw precondition

* Refactored IChannel.Nsfw to IsNsfw, removed NsfwUtils

Per pull-request feedback

* proper nsfw channel check
2017-05-04 12:49:32 -03:00
RogueException
683541ba24 Added RequireOwner support for User tokens 2017-03-18 08:38:24 -03:00
james7132
f1df412341 Change whitelist injection into blacklist injection 2017-02-10 22:02:18 +00:00
james7132
f0b4c24e82 Add InjectAttribute for annotating injectable properties 2017-02-10 21:52:33 +00:00
RogueException
2c075e186a Added support for custom ModuleBase command contexts. Added SocketCommandContext/RpcCommandContext. 2016-12-23 16:57:30 -04:00
AntiTcb
5118ed876b Can target classes now. 2016-12-19 17:54:06 -05:00
FiniteReality
d2d7b4dce7 Make _typeReaderTypeInfo static
Seems I missed this originally, whoops.
2016-12-03 23:49:05 +00:00
FiniteReality
156483bf71 Rename overridenType to overridenTypeReader
The previous name was causing some confusion
2016-12-03 23:49:05 +00:00
FiniteReality
f11f416024 Add IDependencyMap to parameter preconditions 2016-12-03 23:49:05 +00:00
FiniteReality
b7a5ee6542 Parameter preconditions and typereader overriding 2016-12-03 23:49:05 +00:00
RogueException
08ae9e4e86 Fixed logic in precondition attribute docstrings 2016-11-27 01:13:29 -04:00
RogueException
2a33bb0c12 Escaped amp in XML example. 2016-11-27 01:07:19 -04:00
RogueException
a0c9ba92db Merge branch 'dev' into feature/more-preconditions 2016-11-26 23:41:45 -04:00
Christopher F
fb99b019a0 Fix issues with DefaultRunMode
For a command to use the DefaultRunMode, it must now have it's RunMode set to RunMode.Default (this is the default value on CommandAttribute now).
2016-11-26 22:04:02 -05:00
Christopher F
1ed4f703bf Cache the current application on DiscordSocketClient 2016-11-26 14:59:20 -05:00
Christopher F
f9c5e229d0 Add CommandServiceConfig, DefaultRunMode
This adds an (optional) CommandServiceConfig, as well as a DefaultRunMode for commands.

This resolves #368 (for commands where a RunMode is not explicitly specified, a custom default value should be used)
2016-11-25 18:49:35 -05:00
Christopher F
defc8f1c4e Add docstrings to preconditions. 2016-11-25 18:09:18 -05:00
Christopher F
ea148db08b Add RequireBotPermission, rename RequirePermission
This is a breaking change.

Adds a precondition that requires the bot has a specified permission (Resolves #211).

Renames RequirePermission to RequireUserPermission.
2016-11-25 17:48:08 -05:00
Christopher F
fdecfe6bd4 Add RequireOwner Precondition
This precondition will require that the invoker of the command is the owner of the bot.
2016-11-25 17:44:37 -05:00
RogueException
c7ac85455f Added a configurable run mode for commands 2016-10-10 21:16:34 -03:00
RogueException
635819b89f Reduced command module lifetime to a single command execution. Removed ModuleAttribute. 2016-10-10 20:27:16 -03:00
RogueException
708f9fe514 Added CommandContext, fixed commands compile errors 2016-10-04 09:54:44 -03:00
FiniteReality
accb3e27b8 Add PriorityAttribute and sortby priority in Search 2016-09-15 18:43:06 +01:00
Khionu Terabite
b6c634b8b5 Renamed Description/Summary Attributes to Summary/Remarks, as per discussion in #239 2016-09-06 16:19:43 -04:00
RogueException
23a0316252 Split IMessage into IUserMessage and ISystemMessage 2016-08-27 19:07:22 -03:00
FiniteReality
95cf63243d Implement Command Aliases
This implementation could probably be more efficient, but I
opted for clarity and simplicity where possible.
2016-08-26 22:28:35 +01:00
RogueException
9951112908 Readded AutoLoad setter 2016-08-18 20:21:36 -03:00
RogueException
06e81cbcca Merge pull request #206 from FiniteReality/issue/203
Add NameAttribute for overriding Name in commands/modules
2016-08-18 11:30:13 -03:00
RogueException
6d766d5f98 Cleaned up command attributes 2016-08-18 11:28:12 -03:00
FiniteReality
252d89000d Fix comment copy+paste fail 2016-08-18 14:09:47 +01:00
FiniteReality
8b864d4b9e Fix #203 by adding a NameAttribute to override Name 2016-08-18 13:50:02 +01:00
RogueException
ac49f4b8b0 Rename RequirePermission -> RequirePermissionAttribute 2016-08-16 00:42:59 -03:00
RogueException
63d3b93975 Removed Discord.Commands.Attributes.Preconditions namespace 2016-08-09 23:44:10 -03:00
RogueException
dcb603acd7 Cleaned up permission checks, added Permissions.Has(enum) methods 2016-08-09 18:18:50 -03:00
RogueException
0b9f9b16a9 Merge pull request #178 from DigiTechs/command_tweaks
Command tweaks
2016-08-09 17:31:10 -03:00
Finite Reality
f2d80de343 Fix error with RequirePermission precondition 2016-08-07 17:23:26 +01:00
Finite Reality
c77c84bec7 Remove ContextType.Invalid 2016-08-06 00:43:11 +01:00
Finite Reality
6db3f52ac1 eplace DM/Guild preconditions with context
The new RequireContextAttribute works just like RequireDM/RequireGuild,
but is more powerful as developers can specify multiple 'contexts' for
their command to require using the ContextType flags.
2016-08-06 00:15:11 +01:00
Finite Reality
86092f9253 Rename Synopsis to Summary to improve clarity 2016-08-05 00:17:29 +01:00
Finite Reality
11f1163ec2 Add Command and module instance parameters to CheckPermissions
After a small discussion with Joe4evr on discord, a way of retrieving the
state of a module appeared to be needed. The new override should provide
enough context to a bot dev to allow them to do what they want.
2016-08-04 23:31:21 +01:00
Finite Reality
046d56cab5 Add module-level preconditions and precondition for individual permissions 2016-08-04 19:36:14 +01:00
Finite Reality
0e920da21f Complete Preconditions implementation 2016-08-03 17:21:38 +01:00
Finite Reality
a5393dc937 Rename Permission to Precondition 2016-08-03 16:50:51 +01:00
Finite Reality
47089448dd Fix Synopsis/Description mix-up 2016-08-03 16:33:26 +01:00
Finite Reality
757c36ccd1 Rename and move things about 2016-08-03 16:09:58 +01:00
Finite Reality
8c0d4b6123 Improve command documentation features 2016-08-02 23:08:33 +01:00