From 2e178a2f2dc399ed8d0a2030e01b876491582e82 Mon Sep 17 00:00:00 2001 From: Noikoio Date: Mon, 4 Jun 2018 19:23:00 -0700 Subject: [PATCH] Reorganized solution projects Clear separation between what features will be available in the public instance and additional features available for a self-hosted instance. --- Kerobot.sln | 16 +++++++---- .../Modules-PublicInstance.csproj | 22 ++++++--------- Modules-PublicInstance/TestMod.cs | 27 ++++++++++++++++++ Modules-SelfHosted/Modules-SelfHosted.csproj | 20 +++++++++++++ Modules-SelfHosted/TestMod2.cs | 28 +++++++++++++++++++ 5 files changed, 94 insertions(+), 19 deletions(-) rename Kerobot-Modules/Kerobot-Modules.csproj => Modules-PublicInstance/Modules-PublicInstance.csproj (62%) create mode 100644 Modules-PublicInstance/TestMod.cs create mode 100644 Modules-SelfHosted/Modules-SelfHosted.csproj create mode 100644 Modules-SelfHosted/TestMod2.cs diff --git a/Kerobot.sln b/Kerobot.sln index 2ee30c8..f5921b6 100644 --- a/Kerobot.sln +++ b/Kerobot.sln @@ -5,7 +5,9 @@ VisualStudioVersion = 15.0.27428.2005 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kerobot", "Kerobot\Kerobot.csproj", "{6FA3A92F-F1FC-4BA8-8018-1A05CB4C7FA3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kerobot-Modules", "Kerobot-Modules\Kerobot-Modules.csproj", "{B33E57B4-2918-4552-8489-E0DB8BCE3126}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Modules-PublicInstance", "Modules-PublicInstance\Modules-PublicInstance.csproj", "{E06B76BE-E6F5-4803-BA02-DA8AF2A9705E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Modules-SelfHosted", "Modules-SelfHosted\Modules-SelfHosted.csproj", "{84390AD6-6906-4BD9-A948-578C21037D6C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -17,10 +19,14 @@ Global {6FA3A92F-F1FC-4BA8-8018-1A05CB4C7FA3}.Debug|Any CPU.Build.0 = Debug|Any CPU {6FA3A92F-F1FC-4BA8-8018-1A05CB4C7FA3}.Release|Any CPU.ActiveCfg = Release|Any CPU {6FA3A92F-F1FC-4BA8-8018-1A05CB4C7FA3}.Release|Any CPU.Build.0 = Release|Any CPU - {B33E57B4-2918-4552-8489-E0DB8BCE3126}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B33E57B4-2918-4552-8489-E0DB8BCE3126}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B33E57B4-2918-4552-8489-E0DB8BCE3126}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B33E57B4-2918-4552-8489-E0DB8BCE3126}.Release|Any CPU.Build.0 = Release|Any CPU + {E06B76BE-E6F5-4803-BA02-DA8AF2A9705E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E06B76BE-E6F5-4803-BA02-DA8AF2A9705E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E06B76BE-E6F5-4803-BA02-DA8AF2A9705E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E06B76BE-E6F5-4803-BA02-DA8AF2A9705E}.Release|Any CPU.Build.0 = Release|Any CPU + {84390AD6-6906-4BD9-A948-578C21037D6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {84390AD6-6906-4BD9-A948-578C21037D6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {84390AD6-6906-4BD9-A948-578C21037D6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {84390AD6-6906-4BD9-A948-578C21037D6C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Kerobot-Modules/Kerobot-Modules.csproj b/Modules-PublicInstance/Modules-PublicInstance.csproj similarity index 62% rename from Kerobot-Modules/Kerobot-Modules.csproj rename to Modules-PublicInstance/Modules-PublicInstance.csproj index bba6f61..1022834 100644 --- a/Kerobot-Modules/Kerobot-Modules.csproj +++ b/Modules-PublicInstance/Modules-PublicInstance.csproj @@ -2,26 +2,20 @@ netcoreapp2.0 - Kerobot - Noikoio - 0.0.1 - User-facing portions of Kerobot - 0.0.1 + Noikoio + Kerobot 0.0.1 + Essential functions for Kerobot which are available in the public bot instance. + Kerobot.Modules - - - - - - - - - + + + + diff --git a/Modules-PublicInstance/TestMod.cs b/Modules-PublicInstance/TestMod.cs new file mode 100644 index 0000000..5df12e0 --- /dev/null +++ b/Modules-PublicInstance/TestMod.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Discord.WebSocket; +using Newtonsoft.Json.Linq; +using System.Threading.Tasks; + +namespace Kerobot.Modules +{ + [KerobotModule] + class TestMod : ModuleBase + { + public TestMod(Kerobot kb) : base(kb) + { + kb.DiscordClient.MessageReceived += DiscordClient_MessageReceived; + } + + private async Task DiscordClient_MessageReceived(SocketMessage arg) + { + if (arg.Content.ToLower() == ".test") + { + await arg.Channel.SendMessageAsync("I respond to your test."); + } + } + + public override Task CreateGuildStateAsync(JToken config) + => Task.FromResult(new Dictionary()); + } +} diff --git a/Modules-SelfHosted/Modules-SelfHosted.csproj b/Modules-SelfHosted/Modules-SelfHosted.csproj new file mode 100644 index 0000000..d4b4ea8 --- /dev/null +++ b/Modules-SelfHosted/Modules-SelfHosted.csproj @@ -0,0 +1,20 @@ + + + + netcoreapp2.0 + Noikoio + Kerobot + 0.0.1 + Kerobot modules with more specific purposes that may not work well in a public instance, but are manageable in self-hosted bot instances. + Kerobot.Modules + + + + + + + + + + + diff --git a/Modules-SelfHosted/TestMod2.cs b/Modules-SelfHosted/TestMod2.cs new file mode 100644 index 0000000..09df684 --- /dev/null +++ b/Modules-SelfHosted/TestMod2.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using Discord.WebSocket; +using Newtonsoft.Json.Linq; +using System.Threading.Tasks; + +namespace Kerobot.Modules +{ + [KerobotModule] + class TestMod2 : ModuleBase + { + public TestMod2(Kerobot kb) : base(kb) + { + kb.DiscordClient.MessageReceived += DiscordClient_MessageReceived; + } + + private async Task DiscordClient_MessageReceived(SocketMessage arg) + { + if (arg.Content.ToLower() == ".test2") + { + await arg.Channel.SendMessageAsync("I respond to your test too."); + } + } + + public override Task CreateGuildStateAsync(JToken config) + => Task.FromResult(new Dictionary()); + + } +}