Updated some namespaces, finished some todos. v5 should be cancelled probably as the code is too intertwined to make it modular

This commit is contained in:
Kwoth
2023-11-11 05:22:52 +00:00
parent a28be0d343
commit bc77783820
224 changed files with 308 additions and 317 deletions

View File

@@ -2,7 +2,7 @@
using LinqToDB.Common;
using LinqToDB.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using NadekoBot.Services.Database;
namespace NadekoBot.Services;

View File

@@ -1,8 +1,6 @@
using Microsoft.EntityFrameworkCore;
using NadekoBot.Db;
using NadekoBot.Db.Models;
// todo fix these namespaces. It should only be Nadeko.Bot.Db
using NadekoBot.Services.Database;
namespace NadekoBot.Extensions;

View File

@@ -12,7 +12,7 @@ global using Nadeko.Common; // new project
global using NadekoBot.Common; // old + nadekobot specific things
global using NadekoBot.Common.Attributes;
global using NadekoBot.Extensions;
// global using Nadeko.Snake;
// global using Nadeko.Medusa;
// discord
global using Discord;

View File

@@ -1,5 +1,5 @@
#nullable disable
using NadekoBot.Services.Database.Models;
using Nadeko.Bot.Db.Models;
namespace NadekoBot;

View File

@@ -1,4 +1,4 @@
using NadekoBot.Services.Database.Models;
using Nadeko.Bot.Db.Models;
namespace NadekoBot.Common;

View File

@@ -1,6 +1,6 @@
using System.Globalization;
namespace Nadeko.Medusa;
namespace Nadeko.Common.Medusa;
public interface IMedusaLoaderService
{

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Medusa;
namespace Nadeko.Common.Medusa;
public enum MedusaLoadResult
{

View File

@@ -1,4 +1,4 @@
namespace Nadeko.Medusa;
namespace Nadeko.Common.Medusa;
public enum MedusaUnloadResult
{

View File

@@ -34,6 +34,8 @@
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="..\NadekoBot\data\strings\responses\responses.en-US.json" />
<AdditionalFiles Include="..\NadekoBot\data\strings\responses\responses.en-US.json">
<Link>responses.en-US.json</Link>
</AdditionalFiles>
</ItemGroup>
</Project>

View File

@@ -79,9 +79,10 @@ public abstract class NadekoModule : ModuleBase
public async Task<bool> PromptUserConfirmAsync(IEmbedBuilder embed)
{
embed.WithPendingColor().WithFooter("yes/no");
embed.WithPendingColor()
.WithFooter("yes/no");
var msg = await ctx.Channel.EmbedAsync(embed);
var msg = await MessageChannelExtensions.EmbedAsync(ctx.Channel, embed);
try
{
var input = await GetUserInputAsync(ctx.User.Id, ctx.Channel.Id);

View File

@@ -43,8 +43,8 @@ public class CommandHandler : INService, IReadyExecutor, ICommandHandler
// InteractionService interactions,
IServiceProvider services)
{
_client = client;
_commandService = commandService;
_client = client;
_commandService = commandService;
_bss = bss;
_bot = bot;
_behaviorHandler = behaviorHandler;

View File

@@ -1,7 +1,7 @@
using LinqToDB;
using LinqToDB.EntityFrameworkCore;
using NadekoBot.Db.Models;
using NadekoBot.Services.Database.Models;
using Nadeko.Bot.Db.Models;
namespace NadekoBot.Services.Currency;

View File

@@ -2,7 +2,7 @@ using LinqToDB;
using LinqToDB.EntityFrameworkCore;
using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Services.Currency;
using NadekoBot.Services.Database.Models;
using Nadeko.Bot.Db.Models;
namespace NadekoBot.Services;

View File

@@ -1,5 +1,5 @@
#nullable disable
using NadekoBot.Services.Database.Models;
using Nadeko.Bot.Db.Models;
namespace NadekoBot.Modules.Utility.Services;

View File

@@ -5,7 +5,7 @@ using LinqToDB.EntityFrameworkCore;
using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Db;
using NadekoBot.Db.Models;
using NadekoBot.Services.Database.Models;
using Nadeko.Bot.Db.Models;
namespace NadekoBot.Modules.Permissions.Services;

View File

@@ -1,4 +1,5 @@
using CommandLine;
using Nadeko.Common.Medusa;
namespace NadekoBot.Common;
@@ -9,7 +10,7 @@ public sealed class CommandsUtilityService : ICommandsUtilityService, INService
private readonly DiscordPermOverrideService _dpos;
private readonly IEmbedBuilderService _eb;
private readonly ILocalization _loc;
private readonly Nadeko.Medusa.IMedusaLoaderService _medusae;
private readonly IMedusaLoaderService _medusae;
public CommandsUtilityService(
CommandHandler ch,
@@ -17,7 +18,7 @@ public sealed class CommandsUtilityService : ICommandsUtilityService, INService
DiscordPermOverrideService dpos,
IEmbedBuilderService eb,
ILocalization loc,
Nadeko.Medusa.IMedusaLoaderService medusae)
IMedusaLoaderService medusae)
{
_ch = ch;
_strings = strings;
@@ -46,10 +47,9 @@ public sealed class CommandsUtilityService : ICommandsUtilityService, INService
if (reqs.Any())
em.AddField(GetText(strs.requires, guild), string.Join("\n", reqs));
em.AddField(_strings.GetText(strs.usage),
string.Join("\n", com.RealRemarksArr(_strings, _medusae, culture, prefix).Map(arg => Format.Code(arg))))
.WithFooter(GetText(strs.module(com.Module.GetTopLevelModule().Name), guild))
.WithOkColor();
Extensions.Extensions.WithOkColor(em.AddField(_strings.GetText(strs.usage),
string.Join("\n", com.RealRemarksArr(_strings, _medusae, culture, prefix).Map(arg => Format.Code(arg))))
.WithFooter(GetText(strs.module(com.Module.GetTopLevelModule().Name), guild)));
var opt = GetNadekoOptionType(com.Attributes);
if (opt is not null)

View File

@@ -1,7 +1,7 @@
#nullable disable
using Microsoft.EntityFrameworkCore;
using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Services.Database.Models;
using Nadeko.Bot.Db.Models;
namespace NadekoBot.Services;

View File

@@ -3,7 +3,7 @@ using System.Diagnostics;
using System.Globalization;
using System.Text.Json;
using System.Text.RegularExpressions;
using Nadeko.Medusa;
using Nadeko.Common.Medusa;
namespace NadekoBot.Extensions;

View File

@@ -1,3 +1,4 @@
namespace NadekoBot.Extensions;
public static class MessageChannelExtensions
@@ -91,10 +92,6 @@ public static class MessageChannelExtensions
return ch.EmbedAsync(builder, inter: inter);
}
// regular send overloads
public static Task<IUserMessage> SendErrorAsync(this IMessageChannel ch, IEmbedBuilderService eb, string text)
=> ch.SendAsync(eb, text, MsgType.Error);
public static Task<IUserMessage> SendConfirmAsync(this IMessageChannel ch, IEmbedBuilderService eb, string text)
=> ch.SendAsync(eb, text, MsgType.Ok);
@@ -147,6 +144,10 @@ public static class MessageChannelExtensions
string? url = null,
string? footer = null)
=> ch.SendAsync(eb, MsgType.Error, title, text, url, footer);
// regular send overloads
public static Task<IUserMessage> SendErrorAsync(this IMessageChannel ch, IEmbedBuilderService eb, string text)
=> ch.SendAsync(eb, text, MsgType.Error);
public static Task SendPaginatedConfirmAsync(
this ICommandContext ctx,

View File

@@ -1,4 +1,5 @@
namespace NadekoBot.Extensions;

namespace NadekoBot.Extensions;
public static class SocketMessageComponentExtensions
{