SIA
Sapphire - Imagine a frameworkdriedfxrn
Slash Command Error
node:events:492
throw er; // Unhandled 'error' event
^
TypeError: interaction.isChatInputCommand is not a function
at Object.execute (C:\Users\LoneDeveloper\Documents\Bots\events\interactionCreate.js:13:26)
at Client.<anonymous> (C:\Users\LoneDeveloper\Documents\Bots\index.js:24:50)
at Client.emit (node:events:514:28)
at InteractionCreateAction.handle (C:\Users\LoneDeveloper\Documents\Bots\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
at module.exports [as INTERACTION_CREATE] (C:\Users\LoneDeveloper\Documents\Bots\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\LoneDeveloper\Documents\Bots\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)
at WebSocketManager.<anonymous> (C:\Users\LoneDeveloper\Documents\Bots\node_modules\discord.js\src\client\websocket\WebSocketManager.js:239:12)
at WebSocketManager.emit (C:\Users\LoneDeveloper\Documents\Bots\node
_modules\@vladfrangu\async_event_emitter\dist\index.cjs:282:31)
at WebSocketShard.<anonymous> (C:\Users\LoneDeveloper\Documents\Bots\node_modules\@discordjs\ws\dist\index.js:1173:51)
at WebSocketShard.emit (C:\Users\LoneDeveloper\Documents\Bots\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:282:31)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:397:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)
Node.js v20.5.1
driedfxrn•49d ago
Favna•49d ago
Where do you actually bind the exported function to
client.on('interactionCreate', ...)
Also since you're in the server for sapphire, have you considered using sapphire instead of making your own framework?driedfxrn•49d ago
no bcuz in new
Favna•49d ago
Well you did join the server and you got the welcome screen that clearly told you the purpose of the server :wtfummm:
driedfxrn•49d ago
oh wai
no im new to the discord bot dev
i plan on using sapphire after a bit of learning
Favna•49d ago
I guess but this way you're learning poor practises that you're going to have to unlearn later.
driedfxrn•49d ago
do you have any recommendations then
Favna•49d ago
Well yeah just starting your bot with sapphire from the get go. Follow the guide on the website and/or generate a template with the CLI and go from there.
Spinel•49d ago
The guide for Sapphire and its many utilities, plugins and related libraries can be found on our website
driedfxrn•49d ago
ok
this where i register the commands
Favna•49d ago
The problem with your code is that you call
event.execute(client, ...args)
but then implement it as execute(interaction)
. So it's not an interaction but a client in the implementation. Either you have to implement it as execute(client, interaction)
or do what sapphire does and not pass client that way at all but use depdency injection.
You have to be mindful of the order of parameters when programming.Spinel•49d ago
Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:
- Read and understand docs
- Debug code
- Syntax
- NodeJS module system
If you aren't sure that your understanding of JavaScript is truly good enough to make a bot, you should try to continue learning first. Here are good resources to learn both Javascript and NodeJS:
- Codecademy: https://www.codecademy.com/learn/javascript
- Udemy: https://www.udemy.com/javascript-essentials/
- Eloquent JavaScript, free book: http://eloquentjavascript.net/
- You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
- JavaScript Garden: https://bonsaiden.github.io/JavaScript-Garden/
- JavaScript reference/docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
- Nodeschool: https://nodeschool.io/
- Pluralsight: https://www.codeschool.com/courses/real-time-web-with-node-js
Before you ask a question, you should ask these yourself:
1. Is this question related to JavaScript, or the library I am using?
- If it is the library you are using, go to the proper server. You would get better answers there.
2. Have I tried to google and/or check StackOverflow?
- Double-check that you can't find anywhere that can lead you to a solution online.
3. Have I tried to look on MDN or the library documentation?
- You should always check documentation to make sure you aren't missing any details.
4. Does my question make enough sense so that people can understand it, and do they understand what I am trying to accomplish?
- If no, revise your question. Give as much detail as possible. Include any error or code output that can help us help you.
5. Am I aware of what I am doing, and not just mindlessly copying and pasting?
- If you are just copying and pasting code from a guide, you are not going to be able to solve anything. Make sure you understand the code you are writing.
driedfxrn•49d ago
oke
i passed in client myself
it wasn't in the guide or anything
Welcome to the Sapphire Discord server! The next-gen object-oriented Discord.js bot framework can be found here.
2.2KMembers
View on DiscordWant results from more Discord servers?
More PostsError when clicking buttonerror: https://srcb.in/dIL4feMtz6
code: https://srcb.in/MGmSNTYXw6
I tried using Message Component Prevent commands from being ran on DMs and prevent bots from using commands by defaultdid Sapphire recently add this behavior stated in the title? I recently removed Preconditions that pButton doing nothing```const button = new ButtonBuilder()
.setCustomId("COB")
.setLabel("Custom InteractionOptionResolver pleasing TypeScriptI have an HTTP interactions app that utilizes `@discordjs/core/http-only`. Currently, I have my own JavascriptAlright guys, quick question if i am new to javascript (i want to learn typescript by the way.) and Any way to add a sort of "middleware" to all listenersIs there any way to have something like a middleware or precondition for all events? I want to delayAre my slashcommands guild based or global?When I use `registerApplicationCommands` (like shown in the picture) does that command get registereTwo Commands In One Filewhen i export chat input command and user context menu command in one file it reads the first exportQuestion regarding client.login()A bit of a curiosity question, I noticed that you can use `await client.login();` without providing Invalid Token ErrorHow do I fix this error:
```js
const invalidToken = new DiscordjsError(ErrorCodes.TokenInvalid);
@sapphire/type error```Error when loading '/home/matthew/projects/ts/waddlebot/src/commands/General/eval.ts': error: CanloggingIs there anyway I can log to console every time a command or a listener is ran?Random ErrorSo everything was working fine and all but then out of no where it's decided to go and throw this onDiscordAPIError[10062]: Unknown interactionSo it keep giving me unknow interaction, while im using deferReply normaly. Also when i try to log sScheduled Tasks with Common JSI am looking to do a task every 2 minutes, I want to use scheduled tasks but seems like all the examCannot find module issue though the module is exported.Please check the screenshot attached with this post.Apply Overwrites in a voicechannelHow do i apply overrides after a channel was created?User Install (The new update)Hello, I am attempting to make my JavaScript d.js Discord Bot work with the new User Install featureTranslated Subcommand does not register because a error```
2024-03-22 19:16:49 - INFO - ApplicationCommandRegistries: Initializing...
2024-03-22 19:16:49 Interactionits just a dumb question , but i didnt manage to find it on the doc , i might have missed the part ,