mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[sticker-tools] add to dockerfile, adjust project configuration
Co-authored-by: voed <voed@i.ua>
This commit is contained in:
@@ -18,6 +18,7 @@ COPY ./modules/Reputation/*.csproj ./modules/Reputation/
|
|||||||
COPY ./modules/ContentStore/*.csproj ./modules/ContentStore/
|
COPY ./modules/ContentStore/*.csproj ./modules/ContentStore/
|
||||||
COPY ./modules/DebugTools/*.csproj ./modules/DebugTools/
|
COPY ./modules/DebugTools/*.csproj ./modules/DebugTools/
|
||||||
COPY ./modules/CodeWatcher/*.csproj ./modules/CodeWatcher/
|
COPY ./modules/CodeWatcher/*.csproj ./modules/CodeWatcher/
|
||||||
|
COPY ./modules/StickerTools/*.csproj ./modules/StickerTools/
|
||||||
RUN dotnet restore Kruzya.TelegramBot.sln
|
RUN dotnet restore Kruzya.TelegramBot.sln
|
||||||
|
|
||||||
# Copy all project files
|
# Copy all project files
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
using BotFramework.Attributes;
|
using BotFramework.Attributes;
|
||||||
using BotFramework.Enums;
|
using BotFramework.Enums;
|
||||||
using SixLabors.ImageSharp;
|
using SixLabors.ImageSharp;
|
||||||
using Telegram.Bot.Types.Enums;
|
|
||||||
using Telegram.Bot;
|
using Telegram.Bot;
|
||||||
using Telegram.Bot.Types;
|
using Telegram.Bot.Types;
|
||||||
|
using Telegram.Bot.Types.Enums;
|
||||||
|
|
||||||
namespace StickerTools;
|
namespace West.TelegramBot.StickerTools;
|
||||||
|
|
||||||
public class Handler : BotEventHandler
|
public class Handler : BotEventHandler
|
||||||
{
|
{
|
||||||
@@ -18,19 +18,19 @@ public class Handler : BotEventHandler
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await Bot.SendChatActionAsync(Chat.Id, ChatAction.UploadDocument);
|
await Bot.SendChatActionAsync(Chat.Id, ChatAction.UploadDocument);
|
||||||
using var file = new MemoryStream();
|
using var file = new MemoryStream();
|
||||||
await Bot.GetInfoAndDownloadFileAsync(sticker.FileId, file);
|
await Bot.GetInfoAndDownloadFileAsync(sticker.FileId, file);
|
||||||
file.Position = 0;
|
file.Position = 0;
|
||||||
|
|
||||||
using var img = await Image.LoadAsync(file);
|
using var img = await Image.LoadAsync(file);
|
||||||
await file.DisposeAsync();
|
await file.DisposeAsync();
|
||||||
|
|
||||||
using var outfile = new MemoryStream();
|
using var outfile = new MemoryStream();
|
||||||
await img.SaveAsPngAsync(outfile);
|
await img.SaveAsPngAsync(outfile);
|
||||||
outfile.Position = 0;
|
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,6 +1,6 @@
|
|||||||
using Kruzya.TelegramBot.Core;
|
using Kruzya.TelegramBot.Core;
|
||||||
|
|
||||||
namespace StickerTools;
|
namespace West.TelegramBot.StickerTools;
|
||||||
|
|
||||||
public class StickerTools : Module
|
public class StickerTools : Module
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
<AssemblyName>TelegramBot.StickerTools</AssemblyName>
|
||||||
|
<RootNamespace>West.TelegramBot.StickerTools</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
|
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Core\Core.csproj" />
|
<ProjectReference Include="..\..\Core\Core.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
<Delete Files="$(OutDir)\TelegramBot.dll" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user