feat(bot): lookup command messages

This commit is contained in:
alyssa 2025-06-08 19:52:37 +00:00
parent 301bf25d44
commit 539fc82342
6 changed files with 120 additions and 37 deletions

View file

@ -33,7 +33,10 @@ public class ApplicationCommandProxiedMessage
var messageId = ctx.Event.Data!.TargetId!.Value;
var msg = await ctx.Repository.GetFullMessage(messageId);
if (msg == null)
throw Errors.MessageNotFound(messageId);
{
await QueryCommandMessage(ctx);
return;
}
var showContent = true;
var channel = await _rest.GetChannelOrNull(msg.Message.Channel);
@ -58,6 +61,20 @@ public class ApplicationCommandProxiedMessage
await ctx.Reply(embeds: embeds.ToArray());
}
private async Task QueryCommandMessage(InteractionContext ctx)
{
var messageId = ctx.Event.Data!.TargetId!.Value;
var msg = await ctx.Repository.GetCommandMessage(messageId);
if (msg == null)
throw Errors.MessageNotFound(messageId);
var embeds = new List<Embed>();
embeds.Add(await _embeds.CreateCommandMessageInfoEmbed(msg, true));
await ctx.Reply(embeds: embeds.ToArray());
}
public async Task DeleteMessage(InteractionContext ctx)
{
var messageId = ctx.Event.Data!.TargetId!.Value;