button for timely

This commit is contained in:
Toastie 2024-11-03 23:59:58 +13:00
parent d1bc423b99
commit 7f9a939285
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
2 changed files with 75 additions and 39 deletions
src/EllieBot/Modules/Gambling/PlantPick

View file

@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
using EllieBot.Common.ModuleBehaviors;
using EllieBot.Db.Models;
using SixLabors.Fonts;
using SixLabors.Fonts.Unicode;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.PixelFormats;
@ -163,8 +164,26 @@ public class PlantPickService : IEService, IExecNoCommand
new PointF(size.Width + 5, size.Height + 10),
new PointF(0, size.Height + 10));
var strikeoutRun = new RichTextRun
{
Start = 0,
End = pass.GetGraphemeCount(),
Font = font,
StrikeoutPen = new SolidPen(Color.White, 5),
TextDecorations = TextDecorations.Strikeout
};
// draw the password over the background
x.DrawText(pass, font, Color.White, new(0, 0));
x.DrawText(new RichTextOptions(font)
{
Origin = new(0, 0),
TextRuns =
[
strikeoutRun
]
},
pass,
new SolidBrush(Color.White));
});
// return image as a stream for easy sending
var format = img.Metadata.DecodedImageFormat;