Add support for parsing multiple types of quotation marks in commands, Fix #942 (#943)

* 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
This commit is contained in:
Chris Johnston
2018-05-24 17:07:37 -07:00
committed by Christopher F
parent b52af7ae7c
commit cee71ef35a
5 changed files with 134 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
namespace Discord.Commands
{
@@ -18,6 +19,10 @@ namespace Discord.Commands
/// <summary> Determines whether RunMode.Sync commands should push exceptions up to the caller. </summary>
public bool ThrowOnError { get; set; } = true;
/// <summary> Collection of aliases that can wrap strings for command parsing.
/// represents the opening quotation mark and the value is the corresponding closing mark.</summary>
public Dictionary<char, char> QuotationMarkAliasMap { get; set; } = QuotationAliasUtils.GetDefaultAliasMap;
/// <summary> Determines whether extra parameters should be ignored. </summary>
public bool IgnoreExtraArgs { get; set; } = false;
}