mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 14:27:54 +00:00
feat: add -clear-attachments flag to pk;edit
This commit is contained in:
parent
10d45d3a1a
commit
11390a4fc7
4 changed files with 13 additions and 5 deletions
|
|
@ -19,7 +19,6 @@ using Newtonsoft.Json.Linq;
|
|||
|
||||
using Serilog;
|
||||
|
||||
using PluralKit.Core;
|
||||
using Myriad.Utils;
|
||||
|
||||
namespace PluralKit.Bot;
|
||||
|
|
@ -87,7 +86,8 @@ public class WebhookExecutorService
|
|||
return webhookMessage;
|
||||
}
|
||||
|
||||
public async Task<Message> EditWebhookMessage(ulong guildId, ulong channelId, ulong messageId, string newContent, bool clearEmbeds = false)
|
||||
public async Task<Message> EditWebhookMessage(ulong guildId, ulong channelId, ulong messageId, string newContent,
|
||||
bool clearEmbeds = false, bool clearAttachments = false)
|
||||
{
|
||||
var allowedMentions = newContent.ParseMentions() with
|
||||
{
|
||||
|
|
@ -108,7 +108,10 @@ public class WebhookExecutorService
|
|||
{
|
||||
Content = newContent,
|
||||
AllowedMentions = allowedMentions,
|
||||
Embeds = (clearEmbeds == true ? Optional<Embed[]>.Some(new Embed[] { }) : Optional<Embed[]>.None()),
|
||||
Embeds = (clearEmbeds ? Optional<Embed[]>.Some(new Embed[] { }) : Optional<Embed[]>.None()),
|
||||
Attachments = (clearAttachments
|
||||
? Optional<Message.Attachment[]>.Some(new Message.Attachment[] { })
|
||||
: Optional<Message.Attachment[]>.None())
|
||||
};
|
||||
|
||||
return await _rest.EditWebhookMessage(webhook.Id, webhook.Token, messageId, editReq, threadId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue