* Add ability to support different types of quotation marks
* Added normal quotation mark to list of aliases, removed single quote mark
* clean up leftover changes from testing
* change quotation mark parsing to use a map of matching pairs
* remove commented out code
* Fix conventions of the command parser utility functions
* change storage type of alias dictionary to be IReadOnlyDictionary
* revert type of CommandServiceConfig QuotationMarkAliasMap to Dictionary
* minor formatting changes to CommandParser
* remove unnecessary whitespace
* Move aliases outside of CommandInfo class
* copy IReadOnlyDictionary to ImmutableDictionary
* minor syntax changes in CommandServiceConfig
* add newline before namespace for consistency
* newline formatting tweak
* simplification of GetMatch method for CommandParser
* add more quote unicode punctuation pairs
* add check for null value when building ImmutableDictionary
* Move default alias map into a separate source file
* Ensure that the collection passed into command service is not null
* Allow setting IgnoreExtraArgs on an individual basis
* Remove passing in the flag as a separate parameter
* VS plz
* Push the RunMode setting out to its own attribute, because fox wants consistency.
Bonus: Removes the need for that godawful 'RunMode.Default'.
* Revert previous commit
* Fox doesn't like module-wide switches 😒
* Allow commands to return a Task<RuntimeResult>
This allows bot developers to centralize command result logic by
using result data whether the command as successful or not.
Example usage:
```csharp
var _result = await Commands.ExecuteAsync(context, argPos);
if (_result is RuntimeResult result)
{
await message.Channel.SendMessageAsync(result.Reason);
}
else if (!_result.IsSuccess)
{
// Previous error handling
}
```
The RuntimeResult class can be subclassed too, for example:
```csharp
var _result = await Commands.ExecuteAsync(context, argPos);
if (_result is MySubclassedResult result)
{
var builder = new EmbedBuilder();
for (var pair in result.Data)
{
builder.AddField(pair.Key, pair.Value, true);
}
await message.Channel.SendMessageAsync("", embed: builder);
}
else if (_result is RuntimeResult result)
{
await message.Channel.SendMessageAsync(result.Reason);
}
else if (!_result.IsSuccess)
{
// Previous error handling
}
```
* Make RuntimeResult's ctor protected
* Make RuntimeResult abstract
It never really made sense to have it instantiable in the first place,
frankly.
* Allow arbitrary attributes to be added to commands
I still don't approve adding type info back into commands, so
I decided to use this solution for allowing arbitrary attributes to be
added to commands.
Add attributes property to ParameterBuilder
Add Attributes properties to info types
* Why on earth git
* Add using for system so that Attribute can be used
* C#7 features in commands, CommandInfo in ModuleBase
* Update TypeReaders with C#7 features and IServiceProvider
* Add best-choice command selection to CommandService
* Normalize type reader scores correctly
* Fix logic error and rebase onto dev
* Change GetMethod for SetMethod in ReflectionUtils
Should be checking against setters, not getters
* Ensure args/params scores do not overwhelm Priority
* Remove possibility of NaNs
* 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.
* Improve parameter precondition type safety
Also removes some terrible code which was left over when I first
implemented parameter preconditions. I don't know why that was there.
With this commit, parameter preconditions should be much safer as they
use generic methods instead of janky casting of objects.
* Remove generic CheckPreconditions method
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)