[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
+1
View File
@@ -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
+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);
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
using Kruzya.TelegramBot.Core;
namespace StickerTools;
namespace West.TelegramBot.StickerTools;
public class StickerTools : Module
{
+18 -12
View File
@@ -1,17 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>TelegramBot.StickerTools</AssemblyName>
<RootNamespace>West.TelegramBot.StickerTools</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\Core.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\Core.csproj" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Delete Files="$(OutDir)\TelegramBot.dll" />
</Target>
</Project>