From fd35d3a83689fa3649a7716edbb85e7af9a7fcc0 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Sun, 4 Jul 2021 23:48:17 +0200 Subject: [PATCH] - Cleaned up completed todos - Config Data won't be copied every time it's accessed now, but YamlDotNet doesnt' support records, so data is dangerously mutable, needs solution --- src/NadekoBot.Coordinator/Services/CoordinatorRunner.cs | 1 - src/NadekoBot/Bot.cs | 2 -- src/NadekoBot/Common/TypeReaders/ShmartNumberTypeReader.cs | 1 - src/NadekoBot/Services/CommandHandler.cs | 1 - src/NadekoBot/Services/Settings/ConfigServiceBase.cs | 4 +++- 5 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/NadekoBot.Coordinator/Services/CoordinatorRunner.cs b/src/NadekoBot.Coordinator/Services/CoordinatorRunner.cs index 00c3215de..503ab9b59 100644 --- a/src/NadekoBot.Coordinator/Services/CoordinatorRunner.cs +++ b/src/NadekoBot.Coordinator/Services/CoordinatorRunner.cs @@ -13,7 +13,6 @@ using YamlDotNet.Serialization; namespace NadekoBot.Coordinator { - // todo future: test graceful and update bot to not wait for coord exit public sealed class CoordinatorRunner : BackgroundService { private const string CONFIG_PATH = "coord.yml"; diff --git a/src/NadekoBot/Bot.cs b/src/NadekoBot/Bot.cs index f7a43e1c6..55e36689b 100644 --- a/src/NadekoBot/Bot.cs +++ b/src/NadekoBot/Bot.cs @@ -34,7 +34,6 @@ namespace NadekoBot public DiscordSocketClient Client { get; } public ImmutableArray AllGuildConfigs { get; private set; } - // todo change configs to records // todo remove colors from here public static Color OkColor { get; set; } public static Color ErrorColor { get; set; } @@ -177,7 +176,6 @@ namespace NadekoBot } } - // todo di typereaders private IEnumerable LoadTypeReaders(Assembly assembly) { Type[] allTypes; diff --git a/src/NadekoBot/Common/TypeReaders/ShmartNumberTypeReader.cs b/src/NadekoBot/Common/TypeReaders/ShmartNumberTypeReader.cs index 3a497f346..7c8333bad 100644 --- a/src/NadekoBot/Common/TypeReaders/ShmartNumberTypeReader.cs +++ b/src/NadekoBot/Common/TypeReaders/ShmartNumberTypeReader.cs @@ -8,7 +8,6 @@ using NadekoBot.Services; namespace NadekoBot.Common.TypeReaders { - // todo test max/half/all public sealed class ShmartNumberTypeReader : NadekoTypeReader { private readonly DbService _db; diff --git a/src/NadekoBot/Services/CommandHandler.cs b/src/NadekoBot/Services/CommandHandler.cs index e84f7851b..3b001a9bc 100644 --- a/src/NadekoBot/Services/CommandHandler.cs +++ b/src/NadekoBot/Services/CommandHandler.cs @@ -40,7 +40,6 @@ namespace NadekoBot.Services public ConcurrentHashSet UsersOnShortCooldown { get; } = new ConcurrentHashSet(); private readonly Timer _clearUsersOnShortCooldown; - // todo move behaviours to a separate service public CommandHandler( DiscordSocketClient client, DbService db, diff --git a/src/NadekoBot/Services/Settings/ConfigServiceBase.cs b/src/NadekoBot/Services/Settings/ConfigServiceBase.cs index 9f64354ff..aed66a719 100644 --- a/src/NadekoBot/Services/Settings/ConfigServiceBase.cs +++ b/src/NadekoBot/Services/Settings/ConfigServiceBase.cs @@ -28,7 +28,9 @@ namespace NadekoBot.Services private readonly TypedKey _changeKey; protected TSettings _data; - public TSettings Data => CreateCopy(); + + // todo this has to be protected from mutation + public TSettings Data => _data; public abstract string Name { get; }