mirror of
https://github.com/PluralKit/PluralKit.git
synced 2025-12-19 14:06:48 +00:00
fix(bot): add interaction error for wrong account
This commit is contained in:
parent
c4679ccfb8
commit
f22ba3f0ea
3 changed files with 9 additions and 1 deletions
|
|
@ -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}>");
|
||||
}
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class YesNoPrompt: BaseInteractive
|
|||
{
|
||||
if (ctx.User.Id != User)
|
||||
{
|
||||
await Update(ctx);
|
||||
await Error(ctx, Errors.InteractionWrongAccount(User ?? 0));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue