fix(bot): add interaction error for wrong account
Some checks failed
Build and push Docker image / .net docker build (push) Has been cancelled
.net checks / run .net tests (push) Has been cancelled
.net checks / dotnet-format (push) Has been cancelled

This commit is contained in:
asleepyskye 2025-12-10 13:04:55 -05:00
parent c4679ccfb8
commit f22ba3f0ea
3 changed files with 9 additions and 1 deletions

View file

@ -183,4 +183,6 @@ public static class Errors
public static PKError ChannelNotFound(string channelString) =>
new($"Channel \"{channelString}\" not found or is not in this server.");
public static PKError InteractionWrongAccount(ulong user) => new($"This prompt is only available for <@{user}>");
}

View file

@ -5,6 +5,7 @@ using Myriad.Rest.Types.Requests;
using Myriad.Types;
using NodaTime;
using PluralKit.Core;
namespace PluralKit.Bot.Interactive;
@ -47,6 +48,11 @@ public abstract class BaseInteractive
new InteractionApplicationCommandCallbackData { Components = GetComponents() });
}
protected async Task Error(InteractionContext ctx, PKError error)
{
await ctx.Reply(content: $"{Emojis.Error} {error.Message}");
}
protected async Task Finish(InteractionContext? ctx = null)
{
foreach (var button in _buttons)

View file

@ -43,7 +43,7 @@ public class YesNoPrompt: BaseInteractive
{
if (ctx.User.Id != User)
{
await Update(ctx);
await Error(ctx, Errors.InteractionWrongAccount(User ?? 0));
return;
}