feat(bot): allow clearing embeds from proxied messages
This commit is contained in:
@@ -18,6 +18,7 @@ using Newtonsoft.Json.Linq;
|
||||
using Serilog;
|
||||
|
||||
using PluralKit.Core;
|
||||
using Myriad.Utils;
|
||||
|
||||
namespace PluralKit.Bot;
|
||||
|
||||
@@ -80,7 +81,7 @@ public class WebhookExecutorService
|
||||
return webhookMessage;
|
||||
}
|
||||
|
||||
public async Task<Message> EditWebhookMessage(ulong channelId, ulong messageId, string newContent)
|
||||
public async Task<Message> EditWebhookMessage(ulong channelId, ulong messageId, string newContent, bool clearEmbeds = false)
|
||||
{
|
||||
var allowedMentions = newContent.ParseMentions() with
|
||||
{
|
||||
@@ -97,10 +98,14 @@ public class WebhookExecutorService
|
||||
}
|
||||
|
||||
var webhook = await _webhookCache.GetWebhook(channelId);
|
||||
var editReq = new WebhookMessageEditRequest
|
||||
{
|
||||
Content = newContent,
|
||||
AllowedMentions = allowedMentions,
|
||||
Embeds = (clearEmbeds == true ? Optional<Embed[]>.Some(new Embed[] { }) : Optional<Embed[]>.None()),
|
||||
};
|
||||
|
||||
return await _rest.EditWebhookMessage(webhook.Id, webhook.Token, messageId,
|
||||
new WebhookMessageEditRequest { Content = newContent, AllowedMentions = allowedMentions },
|
||||
threadId);
|
||||
return await _rest.EditWebhookMessage(webhook.Id, webhook.Token, messageId, editReq, threadId);
|
||||
}
|
||||
|
||||
private async Task<Message> ExecuteWebhookInner(Webhook webhook, ProxyRequest req, bool hasRetried = false)
|
||||
|
Reference in New Issue
Block a user