zaida04 / guilded.js

A library for creating bots with the guilded.gg bot API.
https://guilded.js.org
MIT License
69 stars 15 forks source link

Allow for user-supplied webhook body #173

Closed williamhorning closed 2 years ago

williamhorning commented 2 years ago

Is your feature request related to a problem? Please describe. This isn't related to a problem. I'd like to be able supply a webhook body directly to the WebhookClient.send function in guilded.js

Describe the solution you'd like I'd like it if the WebhookClient.send function would accept both a webhook body while still allowing for the current system with multiple arguments to be used

Describe alternatives you've considered I've considered creating my own function to destruct an object and pass it to the WebhookClient.send function.

Additional context This would be pretty useful for my bot, which uses Webhooks to bridge different chat apps.

zaida04 commented 2 years ago

Could you elaborate on what you mean by webhook body, or the desired usage? The signature for WebhookClient#send is send(content: string, embeds?: Embed).

williamhorning commented 2 years ago

Hey there @zaida04, by webhook body I'm referring to what you would send as the body of a POST request when sending to a webhook. I want to be able to provide that directly to guilded.js in a similar way to discord.js's WebhookClient:

let hook = new WebhookClient({id: "123", token: "abc"});

await hook.send({
    content: "hello webhook",
    embeds: [
        {
            description: "webhook embed",
        },
    ],
});