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:
18
NadekoBot.Core/Common/Attributes/NadekoOptions.cs
Normal file
18
NadekoBot.Core/Common/Attributes/NadekoOptions.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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));
|
||||
|
||||
|
@ -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"));
|
||||
|
@ -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));
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user