mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[debug-tools] Module init.
This commit is contained in:
+2
-1
@@ -15,7 +15,8 @@ COPY ./modules/Entertainment/*.csproj ./modules/Entertainment/
|
||||
COPY ./modules/UserGroupTag/*.csproj ./modules/UserGroupTag/
|
||||
COPY ./modules/ChatQuotes/*.csproj ./modules/ChatQuotes/
|
||||
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
|
||||
|
||||
# Copy all project files
|
||||
|
||||
@@ -27,7 +27,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChatQuotes", "modules\ChatQ
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reputation", "modules\Reputation\Reputation.csproj", "{03F3C7D5-6FEF-4A83-9191-501091BFC1AC}"
|
||||
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
|
||||
Global
|
||||
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}.Release|Any CPU.ActiveCfg = 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
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -98,6 +104,7 @@ Global
|
||||
{04F16325-8F44-4250-9B2E-0F77E8F65CBF} = {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}
|
||||
{B95C9180-4893-4A33-BF43-AB2EE998650C} = {C7821F15-DEDD-474F-A575-A296D4B58F10}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {5BA73C3B-D5FC-4942-9091-504325CDC308}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
using Kruzya.TelegramBot.Core;
|
||||
|
||||
namespace West.TelegramBot.DebugTools;
|
||||
|
||||
public class DebugTools : Module
|
||||
{
|
||||
public DebugTools(Core core) : base(core)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user