mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
- Generator will now also add [NadekoDescription] attribute to commands
- CustomReactions module (and customreactions db table) renamed to Expressions. This was done to remove confusion about how it relates to discord Reactions (it doesn't, it was created and named before discord reactions existed) - Permissionv2 db table renamed to Permissions - Expression command now start with ex/expr and end with the name of the action or setting. For example .exd is expression delete - CommandStrings will now use methodname as the key, and not the command name (first entry in aliases.yml). In other words aliases.yml and commands.en-US.yml will use the same keys (once again).
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace NadekoBot.Common.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
@@ -7,4 +9,22 @@ internal sealed class NadekoModuleAttribute : GroupAttribute
|
||||
: base(moduleName)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
internal sealed class NadekoDescriptionAttribute : SummaryAttribute
|
||||
{
|
||||
public NadekoDescriptionAttribute([CallerMemberName] string name = "")
|
||||
: base(name)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
internal sealed class NadekoUsageAttribute : RemarksAttribute
|
||||
{
|
||||
public NadekoUsageAttribute([CallerMemberName] string name = "")
|
||||
: base(name)
|
||||
{
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.CustomReactions;
|
||||
using NadekoBot.Modules.NadekoExpressions;
|
||||
|
||||
namespace NadekoBot.Common.TypeReaders;
|
||||
|
||||
@@ -35,12 +35,12 @@ public sealed class CommandOrCrTypeReader : NadekoTypeReader<CommandOrCrInfo>
|
||||
{
|
||||
private readonly CommandService _cmds;
|
||||
private readonly CommandHandler _commandHandler;
|
||||
private readonly CustomReactionsService _crs;
|
||||
private readonly NadekoExpressionsService _exprs;
|
||||
|
||||
public CommandOrCrTypeReader(CommandService cmds, CustomReactionsService crs, CommandHandler commandHandler)
|
||||
public CommandOrCrTypeReader(CommandService cmds, NadekoExpressionsService exprs, CommandHandler commandHandler)
|
||||
{
|
||||
_cmds = cmds;
|
||||
_crs = crs;
|
||||
_exprs = exprs;
|
||||
_commandHandler = commandHandler;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public sealed class CommandOrCrTypeReader : NadekoTypeReader<CommandOrCrInfo>
|
||||
{
|
||||
input = input.ToUpperInvariant();
|
||||
|
||||
if (_crs.ReactionExists(context.Guild?.Id, input))
|
||||
if (_exprs.ExpressionExists(context.Guild?.Id, input))
|
||||
return TypeReaderResult.FromSuccess(new CommandOrCrInfo(input, CommandOrCrInfo.Type.Custom));
|
||||
|
||||
var cmd = await new CommandTypeReader(_commandHandler, _cmds).ReadAsync(context, input);
|
||||
|
@@ -34,7 +34,7 @@ public sealed class ModuleOrCrTypeReader : NadekoTypeReader<ModuleOrCrInfo>
|
||||
var module = _cmds.Modules.GroupBy(m => m.GetTopLevelModule())
|
||||
.FirstOrDefault(m => m.Key.Name.ToUpperInvariant() == input)
|
||||
?.Key;
|
||||
if (module is null && input != "ACTUALCUSTOMREACTIONS")
|
||||
if (module is null && input != "ACTUALEXPRESSIONS")
|
||||
return Task.FromResult(TypeReaderResult.FromError(CommandError.ParseFailed, "No such module found."));
|
||||
|
||||
return Task.FromResult(TypeReaderResult.FromSuccess(new ModuleOrCrInfo { Name = input }));
|
||||
|
Reference in New Issue
Block a user