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

Unable to delete webhook when instantiated with WebhookClient #9785

Closed
GodderE2D opened this issue Aug 20, 2023 · 0 comments · Fixed by #9786
Closed

Unable to delete webhook when instantiated with WebhookClient #9785

GodderE2D opened this issue Aug 20, 2023 · 0 comments · Fixed by #9786

Comments

@GodderE2D
Copy link
Contributor

Which package is this bug report for?

discord.js

Issue description

When using new WebhookClient() and calling .delete() on it, it will error with this:

TypeError: this.client.deleteWebhook is not a function
    at WebhookClient.delete (/home/ubuntu/.../.../node_modules/discord.js/src/structures/Webhook.js:371:24)

This issue happens in 14.13.0 but not in 14.12.1, likely caused by d90ba8d.

A workaround is to use Client.deleteWebhook() however this requires a client and bot user to work.

Code sample

const webhookClient = new WebhookClient({ url: 'https://discord.com/api/webhooks/<channel>/<token>' });

await webhookClient.delete();

Versions

  • discord.js 14.13.0
  • Node.js 18.16.0
  • macOS 13.3

Issue priority

Medium (should be fixed soon)

Which partials do you have configured?

No Partials

Which gateway intents are you subscribing to?

Guilds

I have tested this issue on a development release

8eb978d

kyranet added a commit to kyranet/discord.js that referenced this issue Aug 20, 2023
Partially reverts discordjs#9777 which caused a regression (discordjs#9785) when using `WebhookClient`
@SpaceEEC SpaceEEC linked a pull request Aug 20, 2023 that will close this issue
@kodiakhq kodiakhq bot closed this as completed in #9786 Nov 5, 2023
kodiakhq bot added a commit that referenced this issue Nov 5, 2023
* fix(Webhook): do not call `client.deleteWebhook` in `delete`

Partially reverts #9777 which caused a regression (#9785) when using `WebhookClient`

* chore: add comment

Co-Authored-By: Souji <timoqueezle@gmail.com>

* fix: move `deleteWebhook` from `Client` to `BaseClient`

---------

Co-authored-by: Souji <timoqueezle@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants