From f1c437561390b446d38434c22f65e71b058330d6 Mon Sep 17 00:00:00 2001 From: Andriy <30056636+West14@users.noreply.github.com> Date: Fri, 13 Jan 2023 01:28:34 +0200 Subject: [PATCH] [sticker-tools] add to dockerfile, adjust project configuration Co-authored-by: voed --- Dockerfile | 1 + modules/StickerTools/Handler.cs | 14 +++++------ modules/StickerTools/StickerTools.cs | 2 +- modules/StickerTools/StickerTools.csproj | 30 ++++++++++++++---------- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 66f18ff..9e9a18e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,7 @@ COPY ./modules/Reputation/*.csproj ./modules/Reputation/ COPY ./modules/ContentStore/*.csproj ./modules/ContentStore/ COPY ./modules/DebugTools/*.csproj ./modules/DebugTools/ COPY ./modules/CodeWatcher/*.csproj ./modules/CodeWatcher/ +COPY ./modules/StickerTools/*.csproj ./modules/StickerTools/ RUN dotnet restore Kruzya.TelegramBot.sln # Copy all project files diff --git a/modules/StickerTools/Handler.cs b/modules/StickerTools/Handler.cs index 03537f1..8f7710a 100644 --- a/modules/StickerTools/Handler.cs +++ b/modules/StickerTools/Handler.cs @@ -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); } } \ No newline at end of file diff --git a/modules/StickerTools/StickerTools.cs b/modules/StickerTools/StickerTools.cs index 7b0a427..f49f171 100644 --- a/modules/StickerTools/StickerTools.cs +++ b/modules/StickerTools/StickerTools.cs @@ -1,6 +1,6 @@ using Kruzya.TelegramBot.Core; -namespace StickerTools; +namespace West.TelegramBot.StickerTools; public class StickerTools : Module { diff --git a/modules/StickerTools/StickerTools.csproj b/modules/StickerTools/StickerTools.csproj index 63a32c1..85f4c55 100644 --- a/modules/StickerTools/StickerTools.csproj +++ b/modules/StickerTools/StickerTools.csproj @@ -1,17 +1,23 @@ - + - - net6.0 - enable - enable - + + net6.0 + enable + enable + TelegramBot.StickerTools + West.TelegramBot.StickerTools + - - - + + + - - - + + + + + + +