fixed and improved .nc commands
This commit is contained in:
parent
53af8f940d
commit
4a19d91a4f
3 changed files with 37 additions and 3 deletions
CHANGELOG.md
src/EllieBot/Modules
|
@ -33,11 +33,13 @@
|
|||
- `.say` will no longer reply
|
||||
- `.vote` and `.timely` will now show active bonuses
|
||||
- `.lcha` (live channel) limit increased to 5
|
||||
- `.nc` will now show instructions
|
||||
|
||||
### Fixed
|
||||
- Fixed `.antispamignore` restart persistence
|
||||
- Fixed `.notify` events. Only levelup used to work
|
||||
- Fixed `.hangman` misalignment
|
||||
- Fixed bank quest
|
||||
|
||||
## [6.0.13] - 23.03.2025
|
||||
|
||||
|
|
|
@ -158,7 +158,15 @@ public sealed class NotifyService : IReadyExecutor, INotifySubscriber, IEService
|
|||
IUser? user = null;
|
||||
if (model.TryGetUserId(out var userId))
|
||||
{
|
||||
user = guild.GetUser(userId) ?? _client.GetUser(userId);
|
||||
try
|
||||
{
|
||||
user = guild.GetUser(userId)
|
||||
?? await _client.GetUserAsync(userId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
user = null;
|
||||
}
|
||||
}
|
||||
|
||||
var rctx = new ReplacementContext(guild: guild, channel: channel, user: user);
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace EllieBot.Modules.Games;
|
|||
|
||||
public partial class Games
|
||||
{
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public sealed class NCanvasCommands : EllieModule
|
||||
{
|
||||
private readonly INCanvasService _service;
|
||||
|
@ -31,6 +32,10 @@ public partial class Games
|
|||
_gcs = gcs;
|
||||
}
|
||||
|
||||
[Cmd]
|
||||
public async Task NCanvas(kwum x)
|
||||
=> await NcPixel(x);
|
||||
|
||||
[Cmd]
|
||||
public async Task NCanvas()
|
||||
{
|
||||
|
@ -57,8 +62,17 @@ public partial class Games
|
|||
await using var stream = await image.ToStreamAsync();
|
||||
|
||||
var hint = GetText(strs.nc_hint(prefix, _service.GetWidth(), _service.GetHeight()));
|
||||
|
||||
var rng = new EllieRandom();
|
||||
var inter = _inter.Create(ctx.User.Id,
|
||||
new ButtonBuilder("Zoom to a Random Spot",
|
||||
Guid.NewGuid().ToString(),
|
||||
ButtonStyle.Secondary),
|
||||
(_) => NCzoom(rng.Next(0, w), rng.Next(0, h)));
|
||||
|
||||
await Response()
|
||||
.File(stream, "ncanvas.png")
|
||||
.Interaction(inter)
|
||||
.Embed(CreateEmbed()
|
||||
.WithDescription("""
|
||||
Draw pixels on the canvas!
|
||||
|
@ -96,10 +110,15 @@ public partial class Games
|
|||
var eb = CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithImageUrl($"attachment://zoom_{position}.png")
|
||||
.WithFooter($"`.ncs code color` to set. (.ncs abc green)");
|
||||
.WithFooter($"`.ncs code color` to set | ex: `.ncs {position} pink`");
|
||||
|
||||
await Response()
|
||||
.Embed(eb)
|
||||
.Interaction(_inter.Create(ctx.User.Id,
|
||||
new ButtonBuilder("See Canvas",
|
||||
Guid.NewGuid().ToString(),
|
||||
ButtonStyle.Secondary),
|
||||
async (smc) => await NCanvas()))
|
||||
.File(stream, $"zoom_{position}.png")
|
||||
.SendAsync();
|
||||
}
|
||||
|
@ -117,7 +136,7 @@ public partial class Games
|
|||
const float fontSize = 30;
|
||||
|
||||
var posFont = _fonts.NotoSans.CreateFont(fontSize, FontStyle.Bold);
|
||||
var priceFont = _fonts.Symbola.CreateFont(25, FontStyle.Bold);
|
||||
var priceFont = _fonts.Symbola.CreateFont(35, FontStyle.Regular);
|
||||
|
||||
var size = TextMeasurer.MeasureSize("wwww", new TextOptions(posFont));
|
||||
var scale = 100f / size.Width;
|
||||
|
@ -222,6 +241,11 @@ public partial class Games
|
|||
.WithOkColor()
|
||||
.WithDescription(GetText(strs.nc_pixel_set(Format.Code(position.ToString()))))
|
||||
.WithImageUrl($"attachment://zoom_{position}.png"))
|
||||
.Interaction(_inter.Create(ctx.User.Id,
|
||||
new ButtonBuilder("See Canvas",
|
||||
Guid.NewGuid().ToString(),
|
||||
ButtonStyle.Secondary),
|
||||
async (smc) => await NCanvas()))
|
||||
.File(stream, $"zoom_{position}.png")
|
||||
.SendAsync();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue