mirror of
				https://gitlab.com/Kwoth/nadekobot.git
				synced 2025-11-04 08:34:27 -05:00 
			
		
		
		
	Reorganizing module and submodule folders
This commit is contained in:
		@@ -13,6 +13,9 @@ public class DownloadTracker : INService
 | 
			
		||||
    /// <returns>Task representing download state</returns>
 | 
			
		||||
    public async Task EnsureUsersDownloadedAsync(IGuild guild)
 | 
			
		||||
    {
 | 
			
		||||
#if GLOBAL_NADEKO
 | 
			
		||||
        return;
 | 
			
		||||
#endif
 | 
			
		||||
        await _downloadUsersSemaphore.WaitAsync();
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Modules.CustomReactions.Services;
 | 
			
		||||
using NadekoBot.Modules.CustomReactions;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Common.TypeReaders;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ public partial class Administration
 | 
			
		||||
    [Group]
 | 
			
		||||
    public partial class LocalizationCommands : NadekoSubmodule
 | 
			
		||||
    {
 | 
			
		||||
        private static readonly IReadOnlyDictionary<string, string> supportedLocales = new Dictionary<string, string>
 | 
			
		||||
        private static readonly IReadOnlyDictionary<string, string> _supportedLocales = new Dictionary<string, string>
 | 
			
		||||
        {
 | 
			
		||||
            { "ar", "العربية" },
 | 
			
		||||
            { "zh-TW", "繁體中文, 台灣" },
 | 
			
		||||
@@ -113,7 +113,7 @@ public partial class Administration
 | 
			
		||||
                                               .WithOkColor()
 | 
			
		||||
                                               .WithTitle(GetText(strs.lang_list))
 | 
			
		||||
                                               .WithDescription(string.Join("\n",
 | 
			
		||||
                                                   supportedLocales.Select(
 | 
			
		||||
                                                   _supportedLocales.Select(
 | 
			
		||||
                                                       x => $"{Format.Code(x.Key),-10} => {x.Value}"))));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Common.TypeReaders.Models;
 | 
			
		||||
using NadekoBot.Modules.Administration.Common;
 | 
			
		||||
using NadekoBot.Modules.Administration.Services;
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using NadekoBot.Db;
 | 
			
		||||
using NadekoBot.Modules.Administration.Common;
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
using System.Threading.Channels;
 | 
			
		||||
 | 
			
		||||
@@ -25,7 +24,7 @@ public class ProtectionService : INService
 | 
			
		||||
    private readonly DbService _db;
 | 
			
		||||
    private readonly UserPunishService _punishService;
 | 
			
		||||
 | 
			
		||||
    private readonly Channel<PunishQueueItem> PunishUserQueue =
 | 
			
		||||
    private readonly Channel<PunishQueueItem> _punishUserQueue =
 | 
			
		||||
        Channel.CreateUnbounded<PunishQueueItem>(new() { SingleReader = true, SingleWriter = false });
 | 
			
		||||
 | 
			
		||||
    public ProtectionService(
 | 
			
		||||
@@ -68,7 +67,7 @@ public class ProtectionService : INService
 | 
			
		||||
    {
 | 
			
		||||
        while (true)
 | 
			
		||||
        {
 | 
			
		||||
            var item = await PunishUserQueue.Reader.ReadAsync();
 | 
			
		||||
            var item = await _punishUserQueue.Reader.ReadAsync();
 | 
			
		||||
 | 
			
		||||
            var muteTime = item.MuteTime;
 | 
			
		||||
            var gu = item.User;
 | 
			
		||||
@@ -253,7 +252,7 @@ public class ProtectionService : INService
 | 
			
		||||
            gus[0].Guild.Name);
 | 
			
		||||
 | 
			
		||||
        foreach (var gu in gus)
 | 
			
		||||
            await PunishUserQueue.Writer.WriteAsync(new()
 | 
			
		||||
            await _punishUserQueue.Writer.WriteAsync(new()
 | 
			
		||||
            {
 | 
			
		||||
                Action = action,
 | 
			
		||||
                Type = pt,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Modules.Administration.Common;
 | 
			
		||||
namespace NadekoBot.Modules.Administration;
 | 
			
		||||
 | 
			
		||||
public enum ProtectionType
 | 
			
		||||
{
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Modules.Administration.Common;
 | 
			
		||||
namespace NadekoBot.Modules.Administration;
 | 
			
		||||
 | 
			
		||||
public class PunishQueueItem
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Modules.Administration.Common;
 | 
			
		||||
namespace NadekoBot.Modules.Administration;
 | 
			
		||||
 | 
			
		||||
public sealed class UserSpamStats : IDisposable
 | 
			
		||||
{
 | 
			
		||||
@@ -8,9 +8,9 @@ public sealed class UserSpamStats : IDisposable
 | 
			
		||||
 | 
			
		||||
    public string LastMessage { get; set; }
 | 
			
		||||
 | 
			
		||||
    private ConcurrentQueue<Timer> timers { get; }
 | 
			
		||||
    private ConcurrentQueue<Timer> timers;
 | 
			
		||||
 | 
			
		||||
    private readonly object applyLock = new();
 | 
			
		||||
    private readonly object _applyLock = new();
 | 
			
		||||
 | 
			
		||||
    public UserSpamStats(IUserMessage msg)
 | 
			
		||||
    {
 | 
			
		||||
@@ -22,7 +22,7 @@ public sealed class UserSpamStats : IDisposable
 | 
			
		||||
 | 
			
		||||
    public void ApplyNextMessage(IUserMessage message)
 | 
			
		||||
    {
 | 
			
		||||
        lock (applyLock)
 | 
			
		||||
        lock (_applyLock)
 | 
			
		||||
        {
 | 
			
		||||
            var upperMsg = message.Content.ToUpperInvariant();
 | 
			
		||||
            if (upperMsg != LastMessage || (string.IsNullOrWhiteSpace(upperMsg) && message.Attachments.Any()))
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using Microsoft.Extensions.Caching.Memory;
 | 
			
		||||
using NadekoBot.Db;
 | 
			
		||||
using NadekoBot.Modules.Administration.Common;
 | 
			
		||||
using NadekoBot.Modules.Administration.Services;
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
using System.Runtime.CompilerServices;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Modules.CustomReactions.Extensions;
 | 
			
		||||
namespace NadekoBot.Modules.CustomReactions;
 | 
			
		||||
 | 
			
		||||
public static class CustomReactionExtensions
 | 
			
		||||
{
 | 
			
		||||
@@ -1,5 +1,4 @@
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Modules.CustomReactions.Services;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Modules.CustomReactions;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,6 @@ using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using NadekoBot.Common.ModuleBehaviors;
 | 
			
		||||
using NadekoBot.Common.Yml;
 | 
			
		||||
using NadekoBot.Db;
 | 
			
		||||
using NadekoBot.Modules.CustomReactions.Extensions;
 | 
			
		||||
using NadekoBot.Modules.Permissions.Common;
 | 
			
		||||
using NadekoBot.Modules.Permissions.Services;
 | 
			
		||||
using NadekoBot.Services.Database.Models;
 | 
			
		||||
@@ -11,7 +10,7 @@ using System.Runtime.CompilerServices;
 | 
			
		||||
using YamlDotNet.Serialization;
 | 
			
		||||
using YamlDotNet.Serialization.NamingConventions;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Modules.CustomReactions.Services;
 | 
			
		||||
namespace NadekoBot.Modules.CustomReactions;
 | 
			
		||||
 | 
			
		||||
public sealed class CustomReactionsService : IEarlyBehavior, IReadyExecutor
 | 
			
		||||
{
 | 
			
		||||
@@ -1,8 +0,0 @@
 | 
			
		||||
#nullable disable
 | 
			
		||||
namespace NadekoBot.Modules.Gambling.Common;
 | 
			
		||||
 | 
			
		||||
public class Payout
 | 
			
		||||
{
 | 
			
		||||
    public string User { get; set; }
 | 
			
		||||
    public int Amount { get; set; }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +1,4 @@
 | 
			
		||||
#nullable disable
 | 
			
		||||
using NadekoBot.Modules.Administration.Services;
 | 
			
		||||
using NadekoBot.Modules.Gambling.Common;
 | 
			
		||||
using NadekoBot.Modules.Gambling.Services;
 | 
			
		||||
 | 
			
		||||
@@ -1,11 +0,0 @@
 | 
			
		||||
#nullable disable
 | 
			
		||||
using Discord.Interactions;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Modules.Gambling;
 | 
			
		||||
 | 
			
		||||
public class TestGamblingService : InteractionModuleBase
 | 
			
		||||
{
 | 
			
		||||
    [SlashCommand("test", "uwu")]
 | 
			
		||||
    public async Task Test(string input1, int input2)
 | 
			
		||||
        => await RespondAsync("Bravo " + input1 + input2);
 | 
			
		||||
}
 | 
			
		||||
@@ -117,9 +117,7 @@ public partial class Utility : NadekoModule
 | 
			
		||||
        await _tracker.EnsureUsersDownloadedAsync(ctx.Guild);
 | 
			
		||||
 | 
			
		||||
        var users = await ctx.Guild.GetUsersAsync(
 | 
			
		||||
#if GLOBAL_NADEKO
 | 
			
		||||
                    CacheMode.CacheOnly
 | 
			
		||||
#endif
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        var roleUsers = users.Where(u => role is null ? u.RoleIds.Count == 1 : u.RoleIds.Contains(role.Id))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user