Enabling / commands
Hi, I'm trying to enable slash commands on my bot. I set a prefix variable in index.js and the value is "/". However, after 48 hours of having the bot in my server, the bot commands don't show when typing /. Is there a different way of coding this that could help?
33 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!did you deploy your commands
no, how do I do so? sorry, I'm new to discord.js
no worries, we all have to start somewhere
ok, I've finished writing the code for deploying
it says I should be able to type / and see my bot but I still can't do so, even though the code has no errors
did you run your deploy script
yes
can you show that script
and any output you got
and here's the error
/home/runner/bot-1/handler/console.js:5
bot.channels.cache.get(message.channel.id).send(x.join(" "));
^
TypeError: Cannot read property 'channel' of undefined
at ReadStream.<anonymous> (/home/runner/Lizard-1/handler/console.js:5:44)
at ReadStream.emit (events.js:314:20)
at addChunk (_stream_readable.js:297:12)
at readableAddChunk (_stream_readable.js:272:9)
at ReadStream.Readable.push (_stream_readable.js:213:10)
at TTY.onStreamRead (internal/stream_base_commons.js:188:23)
exit status 1
those errors are unrelated
are you actually running your deploy file?
running your index file does not run your deploy file
I used node deploy-commands.js
and do you get any output from that
Error: Cannot find module 'node:fs'
Require stack:
- /home/runner/bot-1/deploy-commands.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/runner/bot-1/deploy-commands.js:3:12)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/home/runner/bot-1/deploy-commands.js' ]
whats your node version
iirc you can just use require('fs')