Ejemplo n.º 1
0
    public async Task <Message> EditWebhookMessage(ulong channelId, ulong messageId, string newContent)
    {
        var allowedMentions = newContent.ParseMentions() with
        {
            Roles = Array.Empty <ulong>(),
            Parse = Array.Empty <AllowedMentions.ParseType>()
        };

        ulong?threadId = null;
        var   root     = await _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 },
                                              threadId));
    }