mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-03 16:24:27 -05:00 
			
		
		
		
	Renamed some of the classes which still had 'Cr' instead of 'Expr' in them
This commit is contained in:
		@@ -31,38 +31,38 @@ public sealed class CommandTypeReader : NadekoTypeReader<CommandInfo>
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public sealed class CommandOrCrTypeReader : NadekoTypeReader<CommandOrCrInfo>
 | 
					public sealed class CommandOrExprTypeReader : NadekoTypeReader<CommandOrExprInfo>
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    private readonly CommandService _cmds;
 | 
					    private readonly CommandService _cmds;
 | 
				
			||||||
    private readonly CommandHandler _commandHandler;
 | 
					    private readonly CommandHandler _commandHandler;
 | 
				
			||||||
    private readonly NadekoExpressionsService _exprs;
 | 
					    private readonly NadekoExpressionsService _exprs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public CommandOrCrTypeReader(CommandService cmds, NadekoExpressionsService exprs, CommandHandler commandHandler)
 | 
					    public CommandOrExprTypeReader(CommandService cmds, NadekoExpressionsService exprs, CommandHandler commandHandler)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        _cmds = cmds;
 | 
					        _cmds = cmds;
 | 
				
			||||||
        _exprs = exprs;
 | 
					        _exprs = exprs;
 | 
				
			||||||
        _commandHandler = commandHandler;
 | 
					        _commandHandler = commandHandler;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public override async ValueTask<TypeReaderResult<CommandOrCrInfo>> ReadAsync(ICommandContext ctx, string input)
 | 
					    public override async ValueTask<TypeReaderResult<CommandOrExprInfo>> ReadAsync(ICommandContext ctx, string input)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        input = input.ToUpperInvariant();
 | 
					        input = input.ToUpperInvariant();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (_exprs.ExpressionExists(ctx.Guild?.Id, input) || _exprs.ExpressionExists(null, input))
 | 
					        if (_exprs.ExpressionExists(ctx.Guild?.Id, input) || _exprs.ExpressionExists(null, input))
 | 
				
			||||||
            return TypeReaderResult.FromSuccess(new CommandOrCrInfo(input, CommandOrCrInfo.Type.Custom));
 | 
					            return TypeReaderResult.FromSuccess(new CommandOrExprInfo(input, CommandOrExprInfo.Type.Custom));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var cmd = await new CommandTypeReader(_commandHandler, _cmds).ReadAsync(ctx, input);
 | 
					        var cmd = await new CommandTypeReader(_commandHandler, _cmds).ReadAsync(ctx, input);
 | 
				
			||||||
        if (cmd.IsSuccess)
 | 
					        if (cmd.IsSuccess)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return TypeReaderResult.FromSuccess(new CommandOrCrInfo(((CommandInfo)cmd.Values.First().Value).Name,
 | 
					            return TypeReaderResult.FromSuccess(new CommandOrExprInfo(((CommandInfo)cmd.Values.First().Value).Name,
 | 
				
			||||||
                CommandOrCrInfo.Type.Normal));
 | 
					                CommandOrExprInfo.Type.Normal));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return TypeReaderResult.FromError<CommandOrCrInfo>(CommandError.ParseFailed, "No such command or cr found.");
 | 
					        return TypeReaderResult.FromError<CommandOrExprInfo>(CommandError.ParseFailed, "No such command or expression found.");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class CommandOrCrInfo
 | 
					public class CommandOrExprInfo
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public enum Type
 | 
					    public enum Type
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -76,7 +76,7 @@ public class CommandOrCrInfo
 | 
				
			|||||||
    public bool IsCustom
 | 
					    public bool IsCustom
 | 
				
			||||||
        => CmdType == Type.Custom;
 | 
					        => CmdType == Type.Custom;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public CommandOrCrInfo(string input, Type type)
 | 
					    public CommandOrExprInfo(string input, Type type)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Name = input;
 | 
					        Name = input;
 | 
				
			||||||
        CmdType = type;
 | 
					        CmdType = type;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,7 @@ public partial class Administration
 | 
				
			|||||||
        [Cmd]
 | 
					        [Cmd]
 | 
				
			||||||
        [RequireContext(ContextType.Guild)]
 | 
					        [RequireContext(ContextType.Guild)]
 | 
				
			||||||
        [UserPerm(GuildPerm.Administrator)]
 | 
					        [UserPerm(GuildPerm.Administrator)]
 | 
				
			||||||
        public async partial Task DiscordPermOverride(CommandOrCrInfo cmd, params GuildPerm[] perms)
 | 
					        public async partial Task DiscordPermOverride(CommandOrExprInfo cmd, params GuildPerm[] perms)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (perms is null || perms.Length == 0)
 | 
					            if (perms is null || perms.Length == 0)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -189,7 +189,7 @@ public sealed class NadekoExpressionsService : IExecOnMessage, IReadyExecutor
 | 
				
			|||||||
                    continue;
 | 
					                    continue;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // if CA is disabled, and CR has AllowTarget, then the
 | 
					                // if CA is disabled, and expr has AllowTarget, then the
 | 
				
			||||||
                // content has to start with the trigger followed by a space
 | 
					                // content has to start with the trigger followed by a space
 | 
				
			||||||
                if (expr.AllowTarget
 | 
					                if (expr.AllowTarget
 | 
				
			||||||
                    && content.StartsWith(trigger, StringComparison.OrdinalIgnoreCase)
 | 
					                    && content.StartsWith(trigger, StringComparison.OrdinalIgnoreCase)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -145,7 +145,7 @@ public partial class Help : NadekoModule<HelpService>
 | 
				
			|||||||
                return "❓";
 | 
					                return "❓";
 | 
				
			||||||
            case "administration":
 | 
					            case "administration":
 | 
				
			||||||
                return "🛠️";
 | 
					                return "🛠️";
 | 
				
			||||||
            case "customreactions":
 | 
					            case "expressions":
 | 
				
			||||||
                return "🗣️";
 | 
					                return "🗣️";
 | 
				
			||||||
            case "searches":
 | 
					            case "searches":
 | 
				
			||||||
                return "🔍";
 | 
					                return "🔍";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -79,7 +79,7 @@ public partial class Permissions
 | 
				
			|||||||
        [Cmd]
 | 
					        [Cmd]
 | 
				
			||||||
        [RequireContext(ContextType.Guild)]
 | 
					        [RequireContext(ContextType.Guild)]
 | 
				
			||||||
        [Priority(1)]
 | 
					        [Priority(1)]
 | 
				
			||||||
        public partial Task CmdCooldown(CommandOrCrInfo command, int secs)
 | 
					        public partial Task CmdCooldown(CommandOrExprInfo command, int secs)
 | 
				
			||||||
            => CmdCooldownInternal(command.Name, secs);
 | 
					            => CmdCooldownInternal(command.Name, secs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Cmd]
 | 
					        [Cmd]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -60,7 +60,7 @@ public partial class Permissions
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        [Cmd]
 | 
					        [Cmd]
 | 
				
			||||||
        [OwnerOnly]
 | 
					        [OwnerOnly]
 | 
				
			||||||
        public async partial Task GlobalCommand(CommandOrCrInfo cmd)
 | 
					        public async partial Task GlobalCommand(CommandOrExprInfo cmd)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var commandName = cmd.Name.ToLowerInvariant();
 | 
					            var commandName = cmd.Name.ToLowerInvariant();
 | 
				
			||||||
            var added = _service.ToggleCommand(commandName);
 | 
					            var added = _service.ToggleCommand(commandName);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -204,7 +204,7 @@ public partial class Permissions : NadekoModule<PermissionService>
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    [Cmd]
 | 
					    [Cmd]
 | 
				
			||||||
    [RequireContext(ContextType.Guild)]
 | 
					    [RequireContext(ContextType.Guild)]
 | 
				
			||||||
    public async partial Task SrvrCmd(CommandOrCrInfo command, PermissionAction action)
 | 
					    public async partial Task SrvrCmd(CommandOrExprInfo command, PermissionAction action)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        await _service.AddPermissions(ctx.Guild.Id,
 | 
					        await _service.AddPermissions(ctx.Guild.Id,
 | 
				
			||||||
            new Permissionv2
 | 
					            new Permissionv2
 | 
				
			||||||
@@ -245,7 +245,7 @@ public partial class Permissions : NadekoModule<PermissionService>
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    [Cmd]
 | 
					    [Cmd]
 | 
				
			||||||
    [RequireContext(ContextType.Guild)]
 | 
					    [RequireContext(ContextType.Guild)]
 | 
				
			||||||
    public async partial Task UsrCmd(CommandOrCrInfo command, PermissionAction action, [Leftover] IGuildUser user)
 | 
					    public async partial Task UsrCmd(CommandOrExprInfo command, PermissionAction action, [Leftover] IGuildUser user)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        await _service.AddPermissions(ctx.Guild.Id,
 | 
					        await _service.AddPermissions(ctx.Guild.Id,
 | 
				
			||||||
            new Permissionv2
 | 
					            new Permissionv2
 | 
				
			||||||
@@ -302,7 +302,7 @@ public partial class Permissions : NadekoModule<PermissionService>
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    [Cmd]
 | 
					    [Cmd]
 | 
				
			||||||
    [RequireContext(ContextType.Guild)]
 | 
					    [RequireContext(ContextType.Guild)]
 | 
				
			||||||
    public async partial Task RoleCmd(CommandOrCrInfo command, PermissionAction action, [Leftover] IRole role)
 | 
					    public async partial Task RoleCmd(CommandOrExprInfo command, PermissionAction action, [Leftover] IRole role)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (role == role.Guild.EveryoneRole)
 | 
					        if (role == role.Guild.EveryoneRole)
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
@@ -366,7 +366,7 @@ public partial class Permissions : NadekoModule<PermissionService>
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    [Cmd]
 | 
					    [Cmd]
 | 
				
			||||||
    [RequireContext(ContextType.Guild)]
 | 
					    [RequireContext(ContextType.Guild)]
 | 
				
			||||||
    public async partial Task ChnlCmd(CommandOrCrInfo command, PermissionAction action, [Leftover] ITextChannel chnl)
 | 
					    public async partial Task ChnlCmd(CommandOrExprInfo command, PermissionAction action, [Leftover] ITextChannel chnl)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        await _service.AddPermissions(ctx.Guild.Id,
 | 
					        await _service.AddPermissions(ctx.Guild.Id,
 | 
				
			||||||
            new Permissionv2
 | 
					            new Permissionv2
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user