[quote] Crappy chat quote implementation.

This commit is contained in:
West14
2022-01-21 00:10:27 +02:00
parent d9d5221280
commit 7cd1a295bb
10 changed files with 331 additions and 10 deletions
+31
View File
@@ -0,0 +1,31 @@
using BotFramework;
using BotFramework.Attributes;
using BotFramework.Enums;
using Telegram.Bot;
using Telegram.Bot.Types.InputFiles;
namespace West.TelegramBot.ChatQuotes.Handler;
public class Quote : BotEventHandler
{
private readonly QuoteGeneratorService _quoteGenerator;
public Quote(QuoteGeneratorService quoteGenerator)
{
_quoteGenerator = quoteGenerator;
}
[Command(InChat.Public, "q", CommandParseMode.Both)]
public async Task HandleQuote()
{
var msg = RawUpdate.Message;
var replyToMessage = msg?.ReplyToMessage;
if (msg == null || replyToMessage == null)
{
return;
}
var file = new InputOnlineFile(await _quoteGenerator.GenerateQuoteImage(replyToMessage));
await Bot.SendStickerAsync(Chat.Id, file, replyToMessageId: msg.MessageId);
}
}