using BotFramework; using BotFramework.Attributes; using BotFramework.Enums; using Telegram.Bot; using Telegram.Bot.Types; namespace West.TelegramBot.ChatQuotes.Handler; public class Quote : BotEventHandler { private readonly QuoteGeneratorService _quoteGenerator; public Quote(QuoteGeneratorService quoteGenerator) { _quoteGenerator = quoteGenerator; } [InChat(InChat.Public)] [Command("q", CommandParseMode.Both)] public async Task HandleQuote() { var msg = RawUpdate.Message; var replyToMessage = msg?.ReplyToMessage; if (msg == null || replyToMessage == null) { return; } var quoteImage = await _quoteGenerator.GenerateQuoteImage(replyToMessage); if (quoteImage == null) { return; } await Bot.SendStickerAsync(Chat.Id, new InputFile(quoteImage), replyToMessageId: msg.MessageId); } }