[sticker-tools] add to dockerfile, adjust project configuration

Co-authored-by: voed <voed@i.ua>
This commit is contained in:
Andriy
2023-01-13 01:28:34 +02:00
parent 7598f77637
commit f1c4375613
4 changed files with 27 additions and 20 deletions
+7 -7
View File
@@ -2,11 +2,11 @@
using BotFramework.Attributes;
using BotFramework.Enums;
using SixLabors.ImageSharp;
using Telegram.Bot.Types.Enums;
using Telegram.Bot;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
namespace StickerTools;
namespace West.TelegramBot.StickerTools;
public class Handler : BotEventHandler
{
@@ -18,19 +18,19 @@ public class Handler : BotEventHandler
{
return;
}
await Bot.SendChatActionAsync(Chat.Id, ChatAction.UploadDocument);
using var file = new MemoryStream();
await Bot.GetInfoAndDownloadFileAsync(sticker.FileId, file);
file.Position = 0;
using var img = await Image.LoadAsync(file);
await file.DisposeAsync();
using var outfile = new MemoryStream();
await img.SaveAsPngAsync(outfile);
outfile.Position = 0;
await Bot.SendDocumentAsync(Chat.Id, new InputFile(outfile, "sticker.png"), replyToMessageId: RawUpdate?.Message?.MessageId);
await Bot.SendDocumentAsync(Chat.Id, new InputFile(outfile, "sticker.png"),
replyToMessageId: RawUpdate?.Message?.MessageId);
}
}