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