From 45b05d301ba884c2135a6087996b7c1f6ddbc54d Mon Sep 17 00:00:00 2001 From: Florian Zevedei Date: Thu, 25 Jan 2024 14:56:18 +0100 Subject: [PATCH] Moving experiment files to external class library for use in production systems --- .../ExternalActionManager/DemoBot/DemoBot.csproj | 1 + .../ExternalActionManager/DemoBot/Program.cs | 11 +++++------ .../ActionManager/Actions/EndsWithAction.cs | 2 +- .../ActionManager/Actions/GuidAction.cs | 2 +- .../ActionManager/Actions/StartWithAction.cs | 2 +- .../ActionManager/ExternalActionManager.cs | 2 +- .../ActionManager/IExternalAction.cs | 2 +- .../ActionManager/Navigation/EndsWithNavigation.cs | 2 +- .../ActionManager/Navigation/GuidNavigation.cs | 2 +- .../ActionManager/Navigation/StartWithNavigation.cs | 2 +- .../CustomFormBaseMessageLoop.cs | 3 +-- .../StaticExtensions.cs | 5 ++--- .../TelegramBotBase.Experiments.csproj | 13 +++++++++++++ TelegramBotFramework.sln | 12 +++++++++++- 14 files changed, 41 insertions(+), 20 deletions(-) rename Experiments/ExternalActionManager/{DemoBot => TelegramBotBase.Experiments}/ActionManager/Actions/EndsWithAction.cs (94%) rename Experiments/ExternalActionManager/{DemoBot => TelegramBotBase.Experiments}/ActionManager/Actions/GuidAction.cs (97%) rename Experiments/ExternalActionManager/{DemoBot => TelegramBotBase.Experiments}/ActionManager/Actions/StartWithAction.cs (94%) rename Experiments/ExternalActionManager/{DemoBot => TelegramBotBase.Experiments}/ActionManager/ExternalActionManager.cs (95%) rename Experiments/ExternalActionManager/{DemoBot => TelegramBotBase.Experiments}/ActionManager/IExternalAction.cs (78%) rename Experiments/ExternalActionManager/{DemoBot => TelegramBotBase.Experiments}/ActionManager/Navigation/EndsWithNavigation.cs (98%) rename Experiments/ExternalActionManager/{DemoBot => TelegramBotBase.Experiments}/ActionManager/Navigation/GuidNavigation.cs (98%) rename Experiments/ExternalActionManager/{DemoBot => TelegramBotBase.Experiments}/ActionManager/Navigation/StartWithNavigation.cs (98%) rename Experiments/ExternalActionManager/{DemoBot => TelegramBotBase.Experiments}/CustomFormBaseMessageLoop.cs (98%) rename Experiments/ExternalActionManager/{DemoBot => TelegramBotBase.Experiments}/StaticExtensions.cs (88%) create mode 100644 Experiments/ExternalActionManager/TelegramBotBase.Experiments/TelegramBotBase.Experiments.csproj diff --git a/Experiments/ExternalActionManager/DemoBot/DemoBot.csproj b/Experiments/ExternalActionManager/DemoBot/DemoBot.csproj index d09a345..200f29f 100644 --- a/Experiments/ExternalActionManager/DemoBot/DemoBot.csproj +++ b/Experiments/ExternalActionManager/DemoBot/DemoBot.csproj @@ -9,6 +9,7 @@ + diff --git a/Experiments/ExternalActionManager/DemoBot/Program.cs b/Experiments/ExternalActionManager/DemoBot/Program.cs index f37ff6a..a4f406a 100644 --- a/Experiments/ExternalActionManager/DemoBot/Program.cs +++ b/Experiments/ExternalActionManager/DemoBot/Program.cs @@ -1,14 +1,13 @@ -using DemoBot.ActionManager; -using DemoBot.Extensions; -using DemoBot.Forms; +using DemoBot.Forms; using Telegram.Bot; using Telegram.Bot.Types.ReplyMarkups; using TelegramBotBase.Builder; using TelegramBotBase.Commands; using TelegramBotBase.Form; -using DemoBot.ActionManager.Navigation; -using DemoBot.ActionManager.Actions; using TelegramBotBase.Base; +using TelegramBotBase.Experiments.ActionManager; +using TelegramBotBase.Experiments.ActionManager.Actions; +using TelegramBotBase.Experiments.ActionManager.Navigation; namespace DemoBot { @@ -142,7 +141,7 @@ namespace DemoBot var bb = BotBaseBuilder.Create() .WithAPIKey(Token) - .ActionMessageLoop(eam2) //.CustomMessageLoop(cfb) + .ActionMessageLoop(eam2) .WithStartForm() .NoProxy() .CustomCommands(a => diff --git a/Experiments/ExternalActionManager/DemoBot/ActionManager/Actions/EndsWithAction.cs b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Actions/EndsWithAction.cs similarity index 94% rename from Experiments/ExternalActionManager/DemoBot/ActionManager/Actions/EndsWithAction.cs rename to Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Actions/EndsWithAction.cs index d466955..1494c7e 100644 --- a/Experiments/ExternalActionManager/DemoBot/ActionManager/Actions/EndsWithAction.cs +++ b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Actions/EndsWithAction.cs @@ -1,7 +1,7 @@ using TelegramBotBase.Base; using TelegramBotBase.Form; -namespace DemoBot.ActionManager.Actions +namespace TelegramBotBase.Experiments.ActionManager.Actions { public class EndsWithAction : IExternalAction diff --git a/Experiments/ExternalActionManager/DemoBot/ActionManager/Actions/GuidAction.cs b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Actions/GuidAction.cs similarity index 97% rename from Experiments/ExternalActionManager/DemoBot/ActionManager/Actions/GuidAction.cs rename to Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Actions/GuidAction.cs index 28519c2..cd24c21 100644 --- a/Experiments/ExternalActionManager/DemoBot/ActionManager/Actions/GuidAction.cs +++ b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Actions/GuidAction.cs @@ -1,7 +1,7 @@ using TelegramBotBase.Base; using TelegramBotBase.Form; -namespace DemoBot.ActionManager.Actions +namespace TelegramBotBase.Experiments.ActionManager.Actions { public class GuidAction : IExternalAction { diff --git a/Experiments/ExternalActionManager/DemoBot/ActionManager/Actions/StartWithAction.cs b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Actions/StartWithAction.cs similarity index 94% rename from Experiments/ExternalActionManager/DemoBot/ActionManager/Actions/StartWithAction.cs rename to Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Actions/StartWithAction.cs index 7f482c8..6b7415e 100644 --- a/Experiments/ExternalActionManager/DemoBot/ActionManager/Actions/StartWithAction.cs +++ b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Actions/StartWithAction.cs @@ -1,7 +1,7 @@ using TelegramBotBase.Base; using TelegramBotBase.Form; -namespace DemoBot.ActionManager.Actions +namespace TelegramBotBase.Experiments.ActionManager.Actions { public class StartWithAction : IExternalAction diff --git a/Experiments/ExternalActionManager/DemoBot/ActionManager/ExternalActionManager.cs b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/ExternalActionManager.cs similarity index 95% rename from Experiments/ExternalActionManager/DemoBot/ActionManager/ExternalActionManager.cs rename to Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/ExternalActionManager.cs index 36f5fbe..6a642d4 100644 --- a/Experiments/ExternalActionManager/DemoBot/ActionManager/ExternalActionManager.cs +++ b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/ExternalActionManager.cs @@ -1,6 +1,6 @@ using TelegramBotBase.Base; -namespace DemoBot.ActionManager +namespace TelegramBotBase.Experiments.ActionManager { public partial class ExternalActionManager { diff --git a/Experiments/ExternalActionManager/DemoBot/ActionManager/IExternalAction.cs b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/IExternalAction.cs similarity index 78% rename from Experiments/ExternalActionManager/DemoBot/ActionManager/IExternalAction.cs rename to Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/IExternalAction.cs index 389f82a..5b13da8 100644 --- a/Experiments/ExternalActionManager/DemoBot/ActionManager/IExternalAction.cs +++ b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/IExternalAction.cs @@ -1,6 +1,6 @@ using TelegramBotBase.Base; -namespace DemoBot.ActionManager +namespace TelegramBotBase.Experiments.ActionManager { public interface IExternalAction diff --git a/Experiments/ExternalActionManager/DemoBot/ActionManager/Navigation/EndsWithNavigation.cs b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Navigation/EndsWithNavigation.cs similarity index 98% rename from Experiments/ExternalActionManager/DemoBot/ActionManager/Navigation/EndsWithNavigation.cs rename to Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Navigation/EndsWithNavigation.cs index bb0d2ec..486dd98 100644 --- a/Experiments/ExternalActionManager/DemoBot/ActionManager/Navigation/EndsWithNavigation.cs +++ b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Navigation/EndsWithNavigation.cs @@ -2,7 +2,7 @@ using TelegramBotBase.Base; using TelegramBotBase.Form; -namespace DemoBot.ActionManager.Navigation +namespace TelegramBotBase.Experiments.ActionManager.Navigation { public class EndsWithNavigation : IExternalAction { diff --git a/Experiments/ExternalActionManager/DemoBot/ActionManager/Navigation/GuidNavigation.cs b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Navigation/GuidNavigation.cs similarity index 98% rename from Experiments/ExternalActionManager/DemoBot/ActionManager/Navigation/GuidNavigation.cs rename to Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Navigation/GuidNavigation.cs index 7eca919..230c719 100644 --- a/Experiments/ExternalActionManager/DemoBot/ActionManager/Navigation/GuidNavigation.cs +++ b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Navigation/GuidNavigation.cs @@ -2,7 +2,7 @@ using TelegramBotBase.Base; using TelegramBotBase.Form; -namespace DemoBot.ActionManager.Navigation +namespace TelegramBotBase.Experiments.ActionManager.Navigation { public class GuidNavigation : IExternalAction { diff --git a/Experiments/ExternalActionManager/DemoBot/ActionManager/Navigation/StartWithNavigation.cs b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Navigation/StartWithNavigation.cs similarity index 98% rename from Experiments/ExternalActionManager/DemoBot/ActionManager/Navigation/StartWithNavigation.cs rename to Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Navigation/StartWithNavigation.cs index 6576ad3..da73619 100644 --- a/Experiments/ExternalActionManager/DemoBot/ActionManager/Navigation/StartWithNavigation.cs +++ b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/ActionManager/Navigation/StartWithNavigation.cs @@ -2,7 +2,7 @@ using TelegramBotBase.Base; using TelegramBotBase.Form; -namespace DemoBot.ActionManager.Navigation +namespace TelegramBotBase.Experiments.ActionManager.Navigation { public class StartWithNavigation : IExternalAction { diff --git a/Experiments/ExternalActionManager/DemoBot/CustomFormBaseMessageLoop.cs b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/CustomFormBaseMessageLoop.cs similarity index 98% rename from Experiments/ExternalActionManager/DemoBot/CustomFormBaseMessageLoop.cs rename to Experiments/ExternalActionManager/TelegramBotBase.Experiments/CustomFormBaseMessageLoop.cs index d3f9835..271704f 100644 --- a/Experiments/ExternalActionManager/DemoBot/CustomFormBaseMessageLoop.cs +++ b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/CustomFormBaseMessageLoop.cs @@ -1,5 +1,4 @@ using System.ComponentModel; -using DemoBot.ActionManager; using Telegram.Bot.Types.Enums; using TelegramBotBase; using TelegramBotBase.Args; @@ -7,7 +6,7 @@ using TelegramBotBase.Base; using TelegramBotBase.Interfaces; using TelegramBotBase.Sessions; -namespace DemoBot +namespace TelegramBotBase.Experiments.ActionManager { public class CustomFormBaseMessageLoop : IMessageLoopFactory { diff --git a/Experiments/ExternalActionManager/DemoBot/StaticExtensions.cs b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/StaticExtensions.cs similarity index 88% rename from Experiments/ExternalActionManager/DemoBot/StaticExtensions.cs rename to Experiments/ExternalActionManager/TelegramBotBase.Experiments/StaticExtensions.cs index 08d041c..edeca46 100644 --- a/Experiments/ExternalActionManager/DemoBot/StaticExtensions.cs +++ b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/StaticExtensions.cs @@ -1,5 +1,4 @@ -using DemoBot.ActionManager; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -7,7 +6,7 @@ using System.Threading.Tasks; using TelegramBotBase.Builder.Interfaces; using TelegramBotBase.Interfaces; -namespace DemoBot.Extensions +namespace TelegramBotBase.Experiments.ActionManager { public static class StaticExtensions { diff --git a/Experiments/ExternalActionManager/TelegramBotBase.Experiments/TelegramBotBase.Experiments.csproj b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/TelegramBotBase.Experiments.csproj new file mode 100644 index 0000000..8f16324 --- /dev/null +++ b/Experiments/ExternalActionManager/TelegramBotBase.Experiments/TelegramBotBase.Experiments.csproj @@ -0,0 +1,13 @@ + + + + net7.0 + enable + enable + + + + + + + diff --git a/TelegramBotFramework.sln b/TelegramBotFramework.sln index 5a3ec1c..4e6e997 100644 --- a/TelegramBotFramework.sln +++ b/TelegramBotFramework.sln @@ -40,6 +40,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Experiments", "Experiments" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DemoBot", "Experiments\ExternalActionManager\DemoBot\DemoBot.csproj", "{5184D3F8-8526-413D-8EB0-23636EA7A4EF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TelegramBotBase.Experiments", "Experiments\ExternalActionManager\TelegramBotBase.Experiments\TelegramBotBase.Experiments.csproj", "{625F84FE-6809-4CA4-9C58-3453382D1C65}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExternalActionManager", "ExternalActionManager", "{359F7D60-362C-4F42-9606-A138FB1293E9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -98,6 +102,10 @@ Global {5184D3F8-8526-413D-8EB0-23636EA7A4EF}.Debug|Any CPU.Build.0 = Debug|Any CPU {5184D3F8-8526-413D-8EB0-23636EA7A4EF}.Release|Any CPU.ActiveCfg = Release|Any CPU {5184D3F8-8526-413D-8EB0-23636EA7A4EF}.Release|Any CPU.Build.0 = Release|Any CPU + {625F84FE-6809-4CA4-9C58-3453382D1C65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {625F84FE-6809-4CA4-9C58-3453382D1C65}.Debug|Any CPU.Build.0 = Debug|Any CPU + {625F84FE-6809-4CA4-9C58-3453382D1C65}.Release|Any CPU.ActiveCfg = Release|Any CPU + {625F84FE-6809-4CA4-9C58-3453382D1C65}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -113,7 +121,9 @@ Global {067E8EBE-F90A-4AFF-A0FF-20578216486E} = {BFA71E3F-31C0-4FC1-A320-4DCF704768C5} {689B16BC-200E-4C68-BB2E-8B209070849B} = {BFA71E3F-31C0-4FC1-A320-4DCF704768C5} {DC521A4C-7446-46F7-845B-AAF10EDCF8C6} = {E3193182-6FDA-4FA3-AD26-A487291E7681} - {5184D3F8-8526-413D-8EB0-23636EA7A4EF} = {2E1FF127-4DC2-40A1-849C-ED1432204E8A} + {5184D3F8-8526-413D-8EB0-23636EA7A4EF} = {359F7D60-362C-4F42-9606-A138FB1293E9} + {625F84FE-6809-4CA4-9C58-3453382D1C65} = {359F7D60-362C-4F42-9606-A138FB1293E9} + {359F7D60-362C-4F42-9606-A138FB1293E9} = {2E1FF127-4DC2-40A1-849C-ED1432204E8A} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {59CB40E1-9FA7-4867-A56F-4F418286F057}