mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-03 16:24:27 -05:00 
			
		
		
		
	fix: cleverbot:response should now be a valid module name
This commit is contained in:
		@@ -175,7 +175,7 @@ public sealed class SomethingOnlyChannelService : IExecOnMessage
 | 
				
			|||||||
        // ignore owner and admin
 | 
					        // ignore owner and admin
 | 
				
			||||||
        if (user.Id == tch.Guild.OwnerId || user.GuildPermissions.Administrator)
 | 
					        if (user.Id == tch.Guild.OwnerId || user.GuildPermissions.Administrator)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Log.Information("{Type}-Only Channel: Ignoring owner od admin ({ChannelId})", type, msg.Channel.Id);
 | 
					            Log.Information("{Type}-Only Channel: Ignoring owner or admin ({ChannelId})", type, msg.Channel.Id);
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,7 +67,7 @@ public class ChatterBotService : IExecOnMessage
 | 
				
			|||||||
                if (!string.IsNullOrWhiteSpace(_creds.CleverbotApiKey))
 | 
					                if (!string.IsNullOrWhiteSpace(_creds.CleverbotApiKey))
 | 
				
			||||||
                    return new OfficialCleverbotSession(_creds.CleverbotApiKey, _httpFactory);
 | 
					                    return new OfficialCleverbotSession(_creds.CleverbotApiKey, _httpFactory);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Log.Information("Cleverbot will not work as the api key is missing.");
 | 
					                Log.Information("Cleverbot will not work as the api key is missing");
 | 
				
			||||||
                return null;
 | 
					                return null;
 | 
				
			||||||
            case ChatBotImplementation.Gpt3:
 | 
					            case ChatBotImplementation.Gpt3:
 | 
				
			||||||
                if (!string.IsNullOrWhiteSpace(_creds.Gpt3ApiKey))
 | 
					                if (!string.IsNullOrWhiteSpace(_creds.Gpt3ApiKey))
 | 
				
			||||||
@@ -80,7 +80,7 @@ public class ChatterBotService : IExecOnMessage
 | 
				
			|||||||
                        _client.CurrentUser.Username,
 | 
					                        _client.CurrentUser.Username,
 | 
				
			||||||
                        _httpFactory);
 | 
					                        _httpFactory);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Log.Information("Gpt3 will not work as the api key is missing.");
 | 
					                Log.Information("Gpt3 will not work as the api key is missing");
 | 
				
			||||||
                return null;
 | 
					                return null;
 | 
				
			||||||
            default:
 | 
					            default:
 | 
				
			||||||
                return null;
 | 
					                return null;
 | 
				
			||||||
@@ -128,7 +128,7 @@ public class ChatterBotService : IExecOnMessage
 | 
				
			|||||||
            var res = await _perms.CheckPermsAsync(sg,
 | 
					            var res = await _perms.CheckPermsAsync(sg,
 | 
				
			||||||
                usrMsg.Channel,
 | 
					                usrMsg.Channel,
 | 
				
			||||||
                usrMsg.Author,
 | 
					                usrMsg.Author,
 | 
				
			||||||
                "games",
 | 
					                CleverBotResponseStr.CLEVERBOT_RESPONSE,
 | 
				
			||||||
                CleverBotResponseStr.CLEVERBOT_RESPONSE);
 | 
					                CleverBotResponseStr.CLEVERBOT_RESPONSE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!res.IsAllowed)
 | 
					            if (!res.IsAllowed)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -87,6 +87,7 @@ public sealed class Help : NadekoModule<HelpService>
 | 
				
			|||||||
        await Response()
 | 
					        await Response()
 | 
				
			||||||
              .Paginated()
 | 
					              .Paginated()
 | 
				
			||||||
              .Items(topLevelModules)
 | 
					              .Items(topLevelModules)
 | 
				
			||||||
 | 
					              .PageSize(12)
 | 
				
			||||||
              .CurrentPage(page)
 | 
					              .CurrentPage(page)
 | 
				
			||||||
              .AddFooter(false)
 | 
					              .AddFooter(false)
 | 
				
			||||||
              .Page((items, _) =>
 | 
					              .Page((items, _) =>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@
 | 
				
			|||||||
namespace NadekoBot.Modules;
 | 
					namespace NadekoBot.Modules;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[OwnerOnly]
 | 
					[OwnerOnly]
 | 
				
			||||||
 | 
					[NoPublicBot]
 | 
				
			||||||
public partial class Medusa : NadekoModule<IMedusaLoaderService>
 | 
					public partial class Medusa : NadekoModule<IMedusaLoaderService>
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    private readonly IMedusaeRepositoryService _repo;
 | 
					    private readonly IMedusaeRepositoryService _repo;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,6 @@
 | 
				
			|||||||
#nullable disable
 | 
					#nullable disable
 | 
				
			||||||
 | 
					using NadekoBot.Modules.Permissions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace NadekoBot.Common.TypeReaders;
 | 
					namespace NadekoBot.Common.TypeReaders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public sealed class ModuleTypeReader : NadekoTypeReader<ModuleInfo>
 | 
					public sealed class ModuleTypeReader : NadekoTypeReader<ModuleInfo>
 | 
				
			||||||
@@ -34,7 +36,7 @@ public sealed class ModuleOrExprTypeReader : NadekoTypeReader<ModuleOrExpr>
 | 
				
			|||||||
        var module = _cmds.Modules.GroupBy(m => m.GetTopLevelModule())
 | 
					        var module = _cmds.Modules.GroupBy(m => m.GetTopLevelModule())
 | 
				
			||||||
                          .FirstOrDefault(m => m.Key.Name.ToUpperInvariant() == input)
 | 
					                          .FirstOrDefault(m => m.Key.Name.ToUpperInvariant() == input)
 | 
				
			||||||
                          ?.Key;
 | 
					                          ?.Key;
 | 
				
			||||||
        if (module is null && input != "ACTUALEXPRESSIONS")
 | 
					        if (module is null && input != "ACTUALEXPRESSIONS" && input != CleverBotResponseStr.CLEVERBOT_RESPONSE)
 | 
				
			||||||
            return new(TypeReaderResult.FromError<ModuleOrExpr>(CommandError.ParseFailed, "No such module found."));
 | 
					            return new(TypeReaderResult.FromError<ModuleOrExpr>(CommandError.ParseFailed, "No such module found."));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return new(TypeReaderResult.FromSuccess(new ModuleOrExpr
 | 
					        return new(TypeReaderResult.FromSuccess(new ModuleOrExpr
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user