[debug-tools] Module init. (#9)

This commit is contained in:
Andriy
2022-03-17 17:39:57 +02:00
committed by GitHub
parent c1008e1040
commit 6ddea8ed1a
5 changed files with 71 additions and 2 deletions
+1
View File
@@ -16,6 +16,7 @@ COPY ./modules/UserGroupTag/*.csproj ./modules/UserGroupTag/
COPY ./modules/ChatQuotes/*.csproj ./modules/ChatQuotes/ COPY ./modules/ChatQuotes/*.csproj ./modules/ChatQuotes/
COPY ./modules/Reputation/*.csproj ./modules/Reputation/ COPY ./modules/Reputation/*.csproj ./modules/Reputation/
COPY ./modules/ContentStore/*.csproj ./modules/ContentStore/ COPY ./modules/ContentStore/*.csproj ./modules/ContentStore/
COPY ./modules/DebugTools/*.csproj ./modules/DebugTools/
RUN dotnet restore Kruzya.TelegramBot.sln RUN dotnet restore Kruzya.TelegramBot.sln
# Copy all project files # Copy all project files
+8 -1
View File
@@ -27,7 +27,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChatQuotes", "modules\ChatQ
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reputation", "modules\Reputation\Reputation.csproj", "{03F3C7D5-6FEF-4A83-9191-501091BFC1AC}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reputation", "modules\Reputation\Reputation.csproj", "{03F3C7D5-6FEF-4A83-9191-501091BFC1AC}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ContentStore", "modules\ContentStore\ContentStore.csproj", "{4F1E8FE8-640F-4671-87FC-0FFCCB6EDF5E}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ContentStore", "modules\ContentStore\ContentStore.csproj", "{4F1E8FE8-640F-4671-87FC-0FFCCB6EDF5E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DebugTools", "modules\DebugTools\DebugTools.csproj", "{B95C9180-4893-4A33-BF43-AB2EE998650C}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -83,6 +85,10 @@ Global
{4F1E8FE8-640F-4671-87FC-0FFCCB6EDF5E}.Debug|Any CPU.Build.0 = Debug|Any CPU {4F1E8FE8-640F-4671-87FC-0FFCCB6EDF5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F1E8FE8-640F-4671-87FC-0FFCCB6EDF5E}.Release|Any CPU.ActiveCfg = Release|Any CPU {4F1E8FE8-640F-4671-87FC-0FFCCB6EDF5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F1E8FE8-640F-4671-87FC-0FFCCB6EDF5E}.Release|Any CPU.Build.0 = Release|Any CPU {4F1E8FE8-640F-4671-87FC-0FFCCB6EDF5E}.Release|Any CPU.Build.0 = Release|Any CPU
{B95C9180-4893-4A33-BF43-AB2EE998650C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B95C9180-4893-4A33-BF43-AB2EE998650C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B95C9180-4893-4A33-BF43-AB2EE998650C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B95C9180-4893-4A33-BF43-AB2EE998650C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@@ -98,6 +104,7 @@ Global
{04F16325-8F44-4250-9B2E-0F77E8F65CBF} = {C7821F15-DEDD-474F-A575-A296D4B58F10} {04F16325-8F44-4250-9B2E-0F77E8F65CBF} = {C7821F15-DEDD-474F-A575-A296D4B58F10}
{03F3C7D5-6FEF-4A83-9191-501091BFC1AC} = {C7821F15-DEDD-474F-A575-A296D4B58F10} {03F3C7D5-6FEF-4A83-9191-501091BFC1AC} = {C7821F15-DEDD-474F-A575-A296D4B58F10}
{4F1E8FE8-640F-4671-87FC-0FFCCB6EDF5E} = {C7821F15-DEDD-474F-A575-A296D4B58F10} {4F1E8FE8-640F-4671-87FC-0FFCCB6EDF5E} = {C7821F15-DEDD-474F-A575-A296D4B58F10}
{B95C9180-4893-4A33-BF43-AB2EE998650C} = {C7821F15-DEDD-474F-A575-A296D4B58F10}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5BA73C3B-D5FC-4942-9091-504325CDC308} SolutionGuid = {5BA73C3B-D5FC-4942-9091-504325CDC308}
+10
View File
@@ -0,0 +1,10 @@
using Kruzya.TelegramBot.Core;
namespace West.TelegramBot.DebugTools;
public class DebugTools : Module
{
public DebugTools(Core core) : base(core)
{
}
}
+18
View File
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>TelegramBot.DebugTools</AssemblyName>
<RootNamespace>West.TelegramBot.DebugTools</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\Core.csproj" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Delete Files="$(OutDir)\TelegramBot.dll" />
</Target>
</Project>
+33
View File
@@ -0,0 +1,33 @@
using BotFramework;
using BotFramework.Attributes;
using BotFramework.Enums;
using Kruzya.TelegramBot.Core.Service;
using Newtonsoft.Json;
using Telegram.Bot;
using Telegram.Bot.Types.Enums;
namespace West.TelegramBot.DebugTools;
public class Handler : BotEventHandler
{
private readonly UserService _userService;
public Handler(UserService userService)
{
_userService = userService;
}
[Command(InChat.All, "dump", CommandParseMode.Both)]
public async Task HandleDump()
{
if (!_userService.IsUserSuper(From))
{
return;
}
var message = RawUpdate.Message!;
await Bot.SendTextMessageAsync(Chat.Id,
$"<code>{JsonConvert.SerializeObject(message.ReplyToMessage, Formatting.Indented)}</code>",
replyToMessageId: message.MessageId, parseMode: ParseMode.Html);
}
}