discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.36k stars 3.97k forks source link

you can't pin a message sent by webhook #4830

Closed Majoramari closed 3 years ago

Majoramari commented 4 years ago

Please describe the problem you are having in as much detail as possible: you can't pin a message sent by webhook

Include a reproducible code sample here, if possible:

const webmessage = await webhookClient.send('', {
            username: `${message.guild.name}'s music service`,
            avatarURL: `${icon}`,
            embeds: [embed],
        });
webmessage.pin();

Further details:

Relevant client options:

almostSouji commented 4 years ago

Webhook#send returns a discord.js Message instance, which has the pin message WebhookClient#send does not and instead returns the raw API message data

For now you can work around this by fetching a Webhook instance from Guild/TextChannel#fetchWebhooks instead

We can reproduce this in our resource webhook project as well. https://github.com/discordjs/resource-webhooks/blob/main/src/index.ts#L73-L77

This is neither reflected in typings nor documented, typings show a Message instance, documentation suggests implementation of Webhook#send which also documents Message

almostSouji commented 4 years ago

Please keep this issue open, the typings are wrong and what the inheritance suggests documentation wise isn't intuitive either. If you don't want to be notified you can set that in the right pane of the issue view.

Starbors commented 4 years ago

no you cant Webhooks can get pinned(by a bot)

SpaceEEC commented 3 years ago

This seems to have been resolved, typings-wise with #5223, and documentation-wise with #5712. 🎉