From 1e90d7f7bb8f13a50e47dbdc359003c0a20ae6b9 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Sun, 27 Jun 2021 17:11:23 +0200 Subject: [PATCH] Small cleanup - fixed some namespaces and moved files --- .../Properties/launchSettings.json | 2 +- src/NadekoBot.Tests/BotStringsTests.cs | 2 +- src/NadekoBot.Tests/GroupGreetTests.cs | 2 +- src/NadekoBot.Tests/IndexedCollectionTests.cs | 2 +- src/NadekoBot.Tests/KwumTests.cs | 2 +- src/NadekoBot.Tests/PubSubTests.cs | 2 +- src/NadekoBot.Tests/Random.cs | 2 +- src/NadekoBot/Bot.cs | 2 ++ src/NadekoBot/Common/Attributes/OwnerOnlyAttribute.cs | 2 +- src/NadekoBot/Common/Creds.cs | 2 +- .../Common/Extensions/IBotCredentialsExtensions.cs | 11 +++++++++++ src/NadekoBot/{Services => Common}/IBotCredentials.cs | 11 ++--------- src/NadekoBot/Db/NadekoContext.cs | 2 +- src/NadekoBot/Services/Impl/BotCredsProvider.cs | 2 +- 14 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 src/NadekoBot/Common/Extensions/IBotCredentialsExtensions.cs rename src/NadekoBot/{Services => Common}/IBotCredentials.cs (79%) diff --git a/src/NadekoBot.Coordinator/Properties/launchSettings.json b/src/NadekoBot.Coordinator/Properties/launchSettings.json index 66fd09226..5a7ffe4f4 100644 --- a/src/NadekoBot.Coordinator/Properties/launchSettings.json +++ b/src/NadekoBot.Coordinator/Properties/launchSettings.json @@ -1,6 +1,6 @@ { "profiles": { - "Nadeko.Coordinator": { + "NadekoBot.Coordinator": { "commandName": "Project", "dotnetRunMessages": "true", "launchBrowser": false, diff --git a/src/NadekoBot.Tests/BotStringsTests.cs b/src/NadekoBot.Tests/BotStringsTests.cs index 7fb635af4..5428ded64 100644 --- a/src/NadekoBot.Tests/BotStringsTests.cs +++ b/src/NadekoBot.Tests/BotStringsTests.cs @@ -9,7 +9,7 @@ using NadekoBot.Services; using NadekoBot.Modules; using YamlDotNet.Serialization; -namespace Nadeko.Tests +namespace NadekoBot.Tests { public class CommandStringsTests { diff --git a/src/NadekoBot.Tests/GroupGreetTests.cs b/src/NadekoBot.Tests/GroupGreetTests.cs index c2475aa3b..84fd35b39 100644 --- a/src/NadekoBot.Tests/GroupGreetTests.cs +++ b/src/NadekoBot.Tests/GroupGreetTests.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using NadekoBot.Services; using NUnit.Framework; -namespace Nadeko.Tests +namespace NadekoBot.Tests { public class GroupGreetTests { diff --git a/src/NadekoBot.Tests/IndexedCollectionTests.cs b/src/NadekoBot.Tests/IndexedCollectionTests.cs index a320676af..eabe60332 100644 --- a/src/NadekoBot.Tests/IndexedCollectionTests.cs +++ b/src/NadekoBot.Tests/IndexedCollectionTests.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; -namespace Nadeko.Tests +namespace NadekoBot.Tests { public class IndexedCollectionTests { diff --git a/src/NadekoBot.Tests/KwumTests.cs b/src/NadekoBot.Tests/KwumTests.cs index f2efe6049..2ffbf874d 100644 --- a/src/NadekoBot.Tests/KwumTests.cs +++ b/src/NadekoBot.Tests/KwumTests.cs @@ -2,7 +2,7 @@ using NadekoBot.Common; using NUnit.Framework; -namespace Nadeko.Tests +namespace NadekoBot.Tests { public class KwumTests { diff --git a/src/NadekoBot.Tests/PubSubTests.cs b/src/NadekoBot.Tests/PubSubTests.cs index 12769c47b..8dcd83c95 100644 --- a/src/NadekoBot.Tests/PubSubTests.cs +++ b/src/NadekoBot.Tests/PubSubTests.cs @@ -3,7 +3,7 @@ using NadekoBot.Common; using NUnit.Framework; using NUnit.Framework.Internal; -namespace Nadeko.Tests +namespace NadekoBot.Tests { public class PubSubTests { diff --git a/src/NadekoBot.Tests/Random.cs b/src/NadekoBot.Tests/Random.cs index 37dd30527..91238910d 100644 --- a/src/NadekoBot.Tests/Random.cs +++ b/src/NadekoBot.Tests/Random.cs @@ -3,7 +3,7 @@ using System.Text; using NadekoBot.Common.Yml; using NUnit.Framework; -namespace Nadeko.Tests +namespace NadekoBot.Tests { public class RandomTests { diff --git a/src/NadekoBot/Bot.cs b/src/NadekoBot/Bot.cs index 14420cd64..44dcabe8e 100644 --- a/src/NadekoBot/Bot.cs +++ b/src/NadekoBot/Bot.cs @@ -28,6 +28,8 @@ using Serilog; namespace NadekoBot { + // todo remove all migration code from + // todo read prev commit public class Bot { private readonly IBotCredentials _creds; diff --git a/src/NadekoBot/Common/Attributes/OwnerOnlyAttribute.cs b/src/NadekoBot/Common/Attributes/OwnerOnlyAttribute.cs index 86b1e4852..dc6c9f147 100644 --- a/src/NadekoBot/Common/Attributes/OwnerOnlyAttribute.cs +++ b/src/NadekoBot/Common/Attributes/OwnerOnlyAttribute.cs @@ -1,8 +1,8 @@ using System; using System.Threading.Tasks; using Discord.Commands; -using NadekoBot.Services; using Microsoft.Extensions.DependencyInjection; +using NadekoBot.Extensions; namespace NadekoBot.Common.Attributes { diff --git a/src/NadekoBot/Common/Creds.cs b/src/NadekoBot/Common/Creds.cs index 88f4bd3cb..ba15537f1 100644 --- a/src/NadekoBot/Common/Creds.cs +++ b/src/NadekoBot/Common/Creds.cs @@ -3,7 +3,7 @@ using NadekoBot.Common.Yml; using NadekoBot.Services; using YamlDotNet.Serialization; -namespace Nadeko.Common +namespace NadekoBot.Common { public sealed class Creds : IBotCredentials { diff --git a/src/NadekoBot/Common/Extensions/IBotCredentialsExtensions.cs b/src/NadekoBot/Common/Extensions/IBotCredentialsExtensions.cs new file mode 100644 index 000000000..a09b621a4 --- /dev/null +++ b/src/NadekoBot/Common/Extensions/IBotCredentialsExtensions.cs @@ -0,0 +1,11 @@ +using Discord; +using NadekoBot.Common; + +namespace NadekoBot.Extensions +{ + public static class BotCredentialsExtensions + { + public static bool IsOwner(this IBotCredentials creds, IUser user) + => creds.OwnerIds.Contains(user.Id); + } +} \ No newline at end of file diff --git a/src/NadekoBot/Services/IBotCredentials.cs b/src/NadekoBot/Common/IBotCredentials.cs similarity index 79% rename from src/NadekoBot/Services/IBotCredentials.cs rename to src/NadekoBot/Common/IBotCredentials.cs index 73f3b6eea..485326121 100644 --- a/src/NadekoBot/Services/IBotCredentials.cs +++ b/src/NadekoBot/Common/IBotCredentials.cs @@ -2,9 +2,9 @@ using Discord; using System.Collections.Immutable; using System.Linq; -using Nadeko.Common; +using NadekoBot.Common; -namespace NadekoBot.Services +namespace NadekoBot { public interface IBotCredentials { @@ -30,13 +30,6 @@ namespace NadekoBot.Services string CoordinatorUrl { get; set; } } - // todo move somewhere else - public static class IBotCredentialsExtensions - { - public static bool IsOwner(this IBotCredentials creds, IUser user) - => creds.OwnerIds.Contains(user.Id); - } - public class RestartConfig { public string Cmd { get; set; } diff --git a/src/NadekoBot/Db/NadekoContext.cs b/src/NadekoBot/Db/NadekoContext.cs index dc943cf9c..b9984c8ed 100644 --- a/src/NadekoBot/Db/NadekoContext.cs +++ b/src/NadekoBot/Db/NadekoContext.cs @@ -6,7 +6,7 @@ using NadekoBot.Services; using System; using System.IO; using Microsoft.Extensions.Logging; -using Nadeko.Common; +using NadekoBot.Common; using NadekoBot.Db.Models; namespace NadekoBot.Services.Database diff --git a/src/NadekoBot/Services/Impl/BotCredsProvider.cs b/src/NadekoBot/Services/Impl/BotCredsProvider.cs index 49f1203eb..24bd7091d 100644 --- a/src/NadekoBot/Services/Impl/BotCredsProvider.cs +++ b/src/NadekoBot/Services/Impl/BotCredsProvider.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.Configuration; using System.IO; using Microsoft.Extensions.Primitives; -using Nadeko.Common; +using NadekoBot.Common; using NadekoBot.Common; using NadekoBot.Common.Yml; using Serilog;