re-added --start-time (-s) to .race, updated libraries, version upped to 2.6.0, added 'options' field to help if command has extra options (only .race atm)

This commit is contained in:
Master Kwoth
2017-11-29 13:53:16 +07:00
parent e266489076
commit 4ab2ac1f1d
17 changed files with 76 additions and 36 deletions

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NadekoBot.Common.Attributes
{
public class NadekoOptions : Attribute
{
public Type OptionType { get; set; }
public NadekoOptions(Type t)
{
this.OptionType = t;
}
}
}

View File

@ -7,7 +7,7 @@ namespace NadekoBot.Common.Attributes
{
public class OwnerOnlyAttribute : PreconditionAttribute
{
public override Task<PreconditionResult> CheckPermissions(ICommandContext context, CommandInfo executingCommand, IServiceProvider services)
public override Task<PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo executingCommand, IServiceProvider services)
{
var creds = (IBotCredentials)services.GetService(typeof(IBotCredentials));

View File

@ -6,7 +6,7 @@ namespace NadekoBot.Common
{
public class NoPublicBot : PreconditionAttribute
{
public override Task<PreconditionResult> CheckPermissions(ICommandContext context, CommandInfo command, IServiceProvider services)
public override Task<PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services)
{
#if GLOBAL_NADEKo
return Task.FromResult(PreconditionResult.FromError("Not available on the public bot"));

View File

@ -15,7 +15,7 @@ namespace NadekoBot.Common.TypeReaders
{
}
public override Task<TypeReaderResult> Read(ICommandContext context, string input, IServiceProvider services)
public override Task<TypeReaderResult> ReadAsync(ICommandContext context, string input, IServiceProvider services)
{
var _cmds = ((INServiceProvider)services).GetService<CommandService>();
var _cmdHandler = ((INServiceProvider)services).GetService<CommandHandler>();
@ -45,7 +45,7 @@ namespace NadekoBot.Common.TypeReaders
_cmds = cmds;
}
public override async Task<TypeReaderResult> Read(ICommandContext context, string input, IServiceProvider services)
public override async Task<TypeReaderResult> ReadAsync(ICommandContext context, string input, IServiceProvider services)
{
input = input.ToUpperInvariant();
@ -67,7 +67,7 @@ namespace NadekoBot.Common.TypeReaders
}
}
var cmd = await new CommandTypeReader(_client, _cmds).Read(context, input, services);
var cmd = await new CommandTypeReader(_client, _cmds).ReadAsync(context, input, services);
if (cmd.IsSuccess)
{
return TypeReaderResult.FromSuccess(new CommandOrCrInfo(((CommandInfo)cmd.Values.First().Value).Name));

View File

@ -13,7 +13,7 @@ namespace NadekoBot.Common.TypeReaders
{
}
public override Task<TypeReaderResult> Read(ICommandContext context, string input, IServiceProvider services)
public override Task<TypeReaderResult> ReadAsync(ICommandContext context, string input, IServiceProvider services)
{
var _gts = (GuildTimezoneService)services.GetService(typeof(GuildTimezoneService));
if (!DateTime.TryParse(input, out var dt))

View File

@ -17,7 +17,7 @@ namespace NadekoBot.Common.TypeReaders
_client = client;
}
public override Task<TypeReaderResult> Read(ICommandContext context, string input, IServiceProvider _)
public override Task<TypeReaderResult> ReadAsync(ICommandContext context, string input, IServiceProvider _)
{
input = input.Trim().ToLowerInvariant();
var guilds = _client.Guilds;

View File

@ -17,7 +17,7 @@ namespace NadekoBot.Common.TypeReaders
_cmds = cmds;
}
public override Task<TypeReaderResult> Read(ICommandContext context, string input, IServiceProvider _)
public override Task<TypeReaderResult> ReadAsync(ICommandContext context, string input, IServiceProvider _)
{
input = input.ToUpperInvariant();
var module = _cmds.Modules.GroupBy(m => m.GetTopLevelModule()).FirstOrDefault(m => m.Key.Name.ToUpperInvariant() == input)?.Key;
@ -37,7 +37,7 @@ namespace NadekoBot.Common.TypeReaders
_cmds = cmds;
}
public override Task<TypeReaderResult> Read(ICommandContext context, string input, IServiceProvider _)
public override Task<TypeReaderResult> ReadAsync(ICommandContext context, string input, IServiceProvider _)
{
input = input.ToLowerInvariant();
var module = _cmds.Modules.GroupBy(m => m.GetTopLevelModule()).FirstOrDefault(m => m.Key.Name.ToLowerInvariant() == input)?.Key;

View File

@ -16,7 +16,7 @@ namespace NadekoBot.Common.TypeReaders
{
}
public override Task<TypeReaderResult> Read(ICommandContext context, string input, IServiceProvider _)
public override Task<TypeReaderResult> ReadAsync(ICommandContext context, string input, IServiceProvider _)
{
input = input.ToUpperInvariant();
switch (input)