Discord.js: you can't pin a message sent by webhook

Created on 19 Sep 2020  Â·  3Comments  Â·  Source: discordjs/discord.js

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:

  • discord.js version: 12.3.1
  • Node.js version: 14.8.0
  • Operating system: windows 10 home, also linux debian 10
  • Priority this issue should have – please be realistic and elaborate if possible: Not very important

Relevant client options:

  • partials: CHANNEL, GUILD_MEMBER, MESSAGE, REACTION, USER
  • gateway intents: none
  • other: none
  • [ x] I have also tested the issue on latest master, commit hash:
documentation typings bug

All 3 comments

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

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  Â·  3Comments

LLamaFTL picture LLamaFTL  Â·  3Comments

Brawaru picture Brawaru  Â·  3Comments

tom-barnes picture tom-barnes  Â·  3Comments

Lombra picture Lombra  Â·  3Comments