2022-03-17 17:39:57 +02:00
|
|
|
using BotFramework;
|
|
|
|
|
using BotFramework.Attributes;
|
|
|
|
|
using BotFramework.Enums;
|
2022-03-17 18:54:07 +02:00
|
|
|
using Kruzya.TelegramBot.Core.Extensions;
|
2022-03-17 17:39:57 +02:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-29 01:50:28 +03:00
|
|
|
[Command("dump", CommandParseMode.Both)]
|
2022-03-17 17:39:57 +02:00
|
|
|
public async Task HandleDump()
|
|
|
|
|
{
|
2022-03-17 18:54:07 +02:00
|
|
|
if (!_userService.IsUserSuper(From) && !await Bot.IsUserAdminAsync(Chat, From))
|
2022-03-17 17:39:57 +02:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var message = RawUpdate.Message!;
|
|
|
|
|
await Bot.SendTextMessageAsync(Chat.Id,
|
|
|
|
|
$"<code>{JsonConvert.SerializeObject(message.ReplyToMessage, Formatting.Indented)}</code>",
|
|
|
|
|
replyToMessageId: message.MessageId, parseMode: ParseMode.Html);
|
|
|
|
|
}
|
|
|
|
|
}
|