chore: init commit from GitHub
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
12
TelegramBot/Commands/CommandMessages/CommandMessage.cs
Normal file
12
TelegramBot/Commands/CommandMessages/CommandMessage.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace TelegramBot.Commands.CommandMessages;
|
||||
|
||||
public abstract class CommandMessage : IMessage
|
||||
{
|
||||
public abstract Task InvokeFromMessage(ITelegramBotClient botClient, Update update,
|
||||
CancellationToken cancellationToken);
|
||||
}
|
||||
20
TelegramBot/Commands/CommandMessages/StartCommandMessage.cs
Normal file
20
TelegramBot/Commands/CommandMessages/StartCommandMessage.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace TelegramBot.Commands.CommandMessages;
|
||||
|
||||
public class StartCommandMessage : CommandMessage
|
||||
{
|
||||
public const string CommandName = "/start";
|
||||
public override async Task InvokeFromMessage(ITelegramBotClient botClient,
|
||||
Update update,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var text = Program.Config.StartMessage;
|
||||
text += $"\nBuild assembly version: {FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion}";
|
||||
text += $"\n\nНововведения по комманде /changelog";
|
||||
await botClient.SendTextMessageAsync(update.Message?.Chat!, text, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user