mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat: edit messages in threads
This commit is contained in:
parent
c472a7f6df
commit
db5fae0fb4
3 changed files with 17 additions and 8 deletions
|
|
@ -81,15 +81,22 @@ namespace PluralKit.Bot
|
|||
|
||||
public async Task<Message> EditWebhookMessage(ulong channelId, ulong messageId, string newContent)
|
||||
{
|
||||
var webhook = await _webhookCache.GetWebhook(channelId);
|
||||
var allowedMentions = newContent.ParseMentions() with
|
||||
{
|
||||
Roles = Array.Empty<ulong>(),
|
||||
Parse = Array.Empty<AllowedMentions.ParseType>()
|
||||
};
|
||||
|
||||
ulong? threadId = null;
|
||||
var root = _cache.GetRootChannel(channelId);
|
||||
if (root.Id != channelId)
|
||||
threadId = channelId;
|
||||
|
||||
var webhook = await _webhookCache.GetWebhook(root.Id);
|
||||
|
||||
return await _rest.EditWebhookMessage(webhook.Id, webhook.Token, messageId,
|
||||
new WebhookMessageEditRequest { Content = newContent, AllowedMentions = allowedMentions });
|
||||
new WebhookMessageEditRequest { Content = newContent, AllowedMentions = allowedMentions },
|
||||
threadId);
|
||||
}
|
||||
|
||||
private async Task<Message> ExecuteWebhookInner(Webhook webhook, ProxyRequest req, bool hasRetried = false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue