20 lines
763 B
C#
20 lines
763 B
C#
using System.Text;
|
|
using Telegram.Bot;
|
|
using Telegram.Bot.Types;
|
|
using Telegram.Bot.Types.Enums;
|
|
|
|
namespace TelegramBot.Commands.CommandMessages;
|
|
|
|
public class ChangelogCommandMessage : CommandMessage
|
|
{
|
|
public const string CommandName = "/changelog";
|
|
public override async Task InvokeFromMessage(ITelegramBotClient botClient, Update update, CancellationToken cancellationToken)
|
|
{
|
|
var text = new StringBuilder();
|
|
foreach (var log in Program.Config.Changelog)
|
|
{
|
|
text.Append($"Нововведения от <b>{log.Date}</b>:\n\n{log.Caption}\n\n");
|
|
}
|
|
await botClient.SendTextMessageAsync(update.Message?.Chat!, text.ToString(), cancellationToken: cancellationToken, parseMode: ParseMode.Html);
|
|
}
|
|
} |