Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Majoramari opened this issue Sep 19, 2020 · 4 comments
Closed

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

Majoramari opened this issue Sep 19, 2020 · 4 comments

Comments

@Majoramari
Copy link

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:
@almostSouji
Copy link
Member

almostSouji commented Sep 19, 2020

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
Copy link
Member

almostSouji commented Sep 20, 2020

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

This comment has been minimized.

@SpaceEEC
Copy link
Member

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants