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:
@@ -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