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

TypeError: Cannot read properties of undefined (reading 'intents') #14

Closed
Superredstone opened this issue Sep 18, 2022 · 2 comments · Fixed by #17
Closed

TypeError: Cannot read properties of undefined (reading 'intents') #14

Superredstone opened this issue Sep 18, 2022 · 2 comments · Fixed by #17
Assignees
Labels
bug Something isn't working

Comments

@Superredstone
Copy link

The application crashes with the following error:

C:\Users\Patrick\Documents\Programming\JS\mastery-bot\node_modules\discord.js-slasher\build\src\api\wrapped-client.js:139
if (!options.intents) {
^

TypeError: Cannot read properties of undefined (reading 'intents')
at filterOptions (C:\Users\Patrick\Documents\Programming\JS\mastery-bot\node_modules\discord.js-slasher\build\src\api\wrapped-client.js:139:18)
at new SlasherClient (C:\Users\Patrick\Documents\Programming\JS\mastery-bot\node_modules\discord.js-slasher\build\src\api\wrapped-client.js:17:15)
at Object. (C:\Users\Patrick\Documents\Programming\JS\mastery-bot\index.js:3:16)
at Module._compile (node:internal/modules/cjs/loader:1119:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
at Module.load (node:internal/modules/cjs/loader:997:32)
at Module._load (node:internal/modules/cjs/loader:838:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:18:47

Node.js v18.9.0

To Reproduce
Steps to reproduce the behavior:

  1. Create a file named index.js with the following code:

const { SlasherClient } = require("discord.js-slasher");

const client = new SlasherClient();

client.on("ready", () => {
console.log(Bot logged in as ${client.user.tag});
});

client.on("command", (ctx) => {
if (ctx.command == "test") {
ctx.reply(This is a test! You are ${ctx.user.username}!)
}
});

client.login();

  1. Create a commands.json file and fill it with a command named "test"
  2. Run npx slasher and save auth.json
  3. Run node index.js

Environment (please complete the following information):

  • OS: Windows
  • Version: 11
  • Node Version: 18.9.0
  • Language: Javascript
@Superredstone Superredstone added the bug Something isn't working label Sep 18, 2022
@Romejanic
Copy link
Owner

Hey there, thanks for the report.

Looks like you're missing the options object in your client constructor, which is required in slasher.

Try changing that line to this

const client = new SlasherClient({ useAuth: true });

Let me know if this issue still persists.

Thank you

@Superredstone
Copy link
Author

That works! Thanks. (And sorry for the stupid question)

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

Successfully merging a pull request may close this issue.

2 participants