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

WebhookClient throws error if masquerade isn't provided. #182

Closed
williamhorning opened this issue Oct 2, 2022 · 2 comments
Closed

WebhookClient throws error if masquerade isn't provided. #182

williamhorning opened this issue Oct 2, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@williamhorning
Copy link

Describe the bug
When creating an instance of WebhookClient without providing a masquerade, an error is thrown.

To Reproduce
Steps to reproduce the behavior:

  1. Run the following code on the latest version of guilded.js
import { Client as GuildedClient, WebhookClient } from "guilded.js";
let hook = new WebhookClient({id: "abc", token: "123"})
await hook.send({content: "hello"})
  1. See the following error thrown:
C:\Users\william\Projects\bolt\node_modules\@guildedjs\webhook-client\dist\WebhookClient.js:7
    constructor(webhookConnection, { username, avatarURL }) {
                                     ^

TypeError: Cannot destructure property 'username' of 'undefined' as it is undefined.
    at new WebhookClient (C:\Users\william\Projects\bolt\node_modules\@guildedjs\webhook-client\dist\WebhookClient.js:7:38)
    at guildedClient.bridgeSend (file:///C:/Users/william/Projects/bolt/platforms/guilded.js:123:14)
    at client.bridgeSend (file:///C:/Users/william/Projects/bolt/class.js:252:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.7.0

Expected behavior
This should not be thrown, as providing a masquerade in the constructor should be optional.

Please complete the following information

  • Node.js version: 18.7.0
  • npm version: 8.15.0
  • Package version: 0.13.16

Additional context
I can't repro this on 0.13.8

@williamhorning williamhorning added the bug Something isn't working label Oct 2, 2022
@zaida04
Copy link
Owner

zaida04 commented Oct 2, 2022

Thanks for the report! We'll have a fix for this out later.

@zaida04
Copy link
Owner

zaida04 commented Oct 2, 2022

Turns out, this is actually already tackled in #181. Upon release of that PR, this issue should be fixed.

@zaida04 zaida04 closed this as completed Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants