forked from discord-net/Discord.Net
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into docs/faq-n-patches-offline
- Loading branch information
Showing
65 changed files
with
484 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="../../Discord.Net.targets" /> | ||
<PropertyGroup> | ||
<AssemblyName>Discord.Net.Commands</AssemblyName> | ||
<RootNamespace>Discord.Commands</RootNamespace> | ||
<Description>A Discord.Net extension adding support for bot commands.</Description> | ||
<TargetFrameworks>netstandard1.1;netstandard1.3</TargetFrameworks> | ||
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net46;netstandard1.3;netstandard2.0</TargetFrameworks> | ||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.3;netstandard2.0</TargetFrameworks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' "> | ||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0" /> | ||
</ItemGroup> | ||
<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' "> | ||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.1" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Threading.Tasks; | ||
|
||
namespace Discord.Commands | ||
{ | ||
internal class TimeSpanTypeReader : TypeReader | ||
{ | ||
private static readonly string[] _formats = new[] | ||
{ | ||
"%d'd'%h'h'%m'm'%s's'", //4d3h2m1s | ||
"%d'd'%h'h'%m'm'", //4d3h2m | ||
"%d'd'%h'h'%s's'", //4d3h 1s | ||
"%d'd'%h'h'", //4d3h | ||
"%d'd'%m'm'%s's'", //4d 2m1s | ||
"%d'd'%m'm'", //4d 2m | ||
"%d'd'%s's'", //4d 1s | ||
"%d'd'", //4d | ||
"%h'h'%m'm'%s's'", // 3h2m1s | ||
"%h'h'%m'm'", // 3h2m | ||
"%h'h'%s's'", // 3h 1s | ||
"%h'h'", // 3h | ||
"%m'm'%s's'", // 2m1s | ||
"%m'm'", // 2m | ||
"%s's'", // 1s | ||
}; | ||
|
||
public override Task<TypeReaderResult> ReadAsync(ICommandContext context, string input, IServiceProvider services) | ||
{ | ||
return (TimeSpan.TryParseExact(input.ToLowerInvariant(), _formats, CultureInfo.InvariantCulture, out var timeSpan)) | ||
? Task.FromResult(TypeReaderResult.FromSuccess(timeSpan)) | ||
: Task.FromResult(TypeReaderResult.FromError(CommandError.ParseFailed, "Failed to parse TimeSpan")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Globalization; | ||
|
||
namespace Discord.Commands | ||
{ | ||
/// <summary> | ||
/// Utility methods for generating matching pairs of unicode quotation marks for CommandServiceConfig | ||
/// </summary> | ||
internal static class QuotationAliasUtils | ||
{ | ||
/// <summary> | ||
/// Generates an IEnumerable of characters representing open-close pairs of | ||
/// quotation punctuation. | ||
/// </summary> | ||
internal static Dictionary<char, char> GetDefaultAliasMap | ||
{ | ||
get | ||
{ | ||
// Output of a gist provided by https://gist.github.com/ufcpp | ||
// https://gist.github.com/ufcpp/5b2cf9a9bf7d0b8743714a0b88f7edc5 | ||
// This was not used for the implementation because of incompatibility with netstandard1.1 | ||
return new Dictionary<char, char> { | ||
{'\"', '\"' }, | ||
{'«', '»' }, | ||
{'‘', '’' }, | ||
{'“', '”' }, | ||
{'„', '‟' }, | ||
{'‹', '›' }, | ||
{'‚', '‛' }, | ||
{'《', '》' }, | ||
{'〈', '〉' }, | ||
{'「', '」' }, | ||
{'『', '』' }, | ||
{'〝', '〞' }, | ||
{'﹁', '﹂' }, | ||
{'﹃', '﹄' }, | ||
{'"', '"' }, | ||
{''', ''' }, | ||
{'「', '」' }, | ||
{'(', ')' }, | ||
{'༺', '༻' }, | ||
{'༼', '༽' }, | ||
{'᚛', '᚜' }, | ||
{'⁅', '⁆' }, | ||
{'⌈', '⌉' }, | ||
{'⌊', '⌋' }, | ||
{'❨', '❩' }, | ||
{'❪', '❫' }, | ||
{'❬', '❭' }, | ||
{'❮', '❯' }, | ||
{'❰', '❱' }, | ||
{'❲', '❳' }, | ||
{'❴', '❵' }, | ||
{'⟅', '⟆' }, | ||
{'⟦', '⟧' }, | ||
{'⟨', '⟩' }, | ||
{'⟪', '⟫' }, | ||
{'⟬', '⟭' }, | ||
{'⟮', '⟯' }, | ||
{'⦃', '⦄' }, | ||
{'⦅', '⦆' }, | ||
{'⦇', '⦈' }, | ||
{'⦉', '⦊' }, | ||
{'⦋', '⦌' }, | ||
{'⦍', '⦎' }, | ||
{'⦏', '⦐' }, | ||
{'⦑', '⦒' }, | ||
{'⦓', '⦔' }, | ||
{'⦕', '⦖' }, | ||
{'⦗', '⦘' }, | ||
{'⧘', '⧙' }, | ||
{'⧚', '⧛' }, | ||
{'⧼', '⧽' }, | ||
{'⸂', '⸃' }, | ||
{'⸄', '⸅' }, | ||
{'⸉', '⸊' }, | ||
{'⸌', '⸍' }, | ||
{'⸜', '⸝' }, | ||
{'⸠', '⸡' }, | ||
{'⸢', '⸣' }, | ||
{'⸤', '⸥' }, | ||
{'⸦', '⸧' }, | ||
{'⸨', '⸩' }, | ||
{'【', '】'}, | ||
{'〔', '〕' }, | ||
{'〖', '〗' }, | ||
{'〘', '〙' }, | ||
{'〚', '〛' } | ||
}; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="../../Discord.Net.targets" /> | ||
<PropertyGroup> | ||
<AssemblyName>Discord.Net.Core</AssemblyName> | ||
<RootNamespace>Discord</RootNamespace> | ||
<Description>The core components for the Discord.Net library.</Description> | ||
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net45;netstandard1.1;netstandard1.3</TargetFrameworks> | ||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.1;netstandard1.3</TargetFrameworks> | ||
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net46;netstandard1.3;netstandard2.0</TargetFrameworks> | ||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.3;netstandard2.0</TargetFrameworks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" /> | ||
<PackageReference Include="System.Collections.Immutable" Version="1.3.1" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> | ||
<PackageReference Include="System.Collections.Immutable" Version="1.4.0" /> | ||
<PackageReference Include="System.Interactive.Async" Version="3.1.1" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.