From 4a19d91a4ff3161def36241cb07eb7e54e9367b8 Mon Sep 17 00:00:00 2001
From: Toastie <toastie@toastiet0ast.com>
Date: Sun, 30 Mar 2025 19:07:09 +1300
Subject: [PATCH] fixed and improved .nc commands

---
 CHANGELOG.md                                  |  2 ++
 .../Administration/Notify/NotifyService.cs    | 10 ++++++-
 .../Modules/Games/NCanvas/NCanvasCommands.cs  | 28 +++++++++++++++++--
 3 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 465e1dc..cbca9df 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
 
diff --git a/src/EllieBot/Modules/Administration/Notify/NotifyService.cs b/src/EllieBot/Modules/Administration/Notify/NotifyService.cs
index 7ab9218..79c8097 100644
--- a/src/EllieBot/Modules/Administration/Notify/NotifyService.cs
+++ b/src/EllieBot/Modules/Administration/Notify/NotifyService.cs
@@ -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);
diff --git a/src/EllieBot/Modules/Games/NCanvas/NCanvasCommands.cs b/src/EllieBot/Modules/Games/NCanvas/NCanvasCommands.cs
index 85b849a..6e5c787 100644
--- a/src/EllieBot/Modules/Games/NCanvas/NCanvasCommands.cs
+++ b/src/EllieBot/Modules/Games/NCanvas/NCanvasCommands.cs
@@ -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();
         }