#Slash command issue
94 messages · Page 1 of 1 (latest)
ok i deleted it again now its telling me where the other one is now weird it didnt do that last time
ok
const variables in the same file cannot be defined more than once
it was next to the 60
deleted it and saved it just in case
on a diff tab
now its
unexpected token..
can you show the error please?
i found it as well its like in the same paragrath of code SyntaxError: Unexpected token '}'
at internalCompileFunction (node:internal/vm:77:18)
at wrapSafe (node:internal/modules/cjs/loader:1288:20)
at Module._compile (node:internal/modules/cjs/loader:1340:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49
Node.js v20.10.0
thats a syntax error
do you know how to fix your syntax?
not much..
only delete
check #resources for learning javascript. proper syntax is essential to every programming language for proper functionality
when i was reading the thing when look at the console i just saw this SyntaxError: /home/runner/Purple-mooser-bot/config.json: Unexpected end of JSON input
at parse (<anonymous>)
at Module._extensions..json (node:internal/modules/cjs/loader:1453:39)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (/home/runner/Purple-mooser-bot/index.js:15:19)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
Node.js v20.10.0
oh config.json
nope..
i finished reading and that as no help..
cuz no infermation about whats happening now..
those links are to help you learn javascript. i don't expect you to learn proper syntax in 5 minutes
please look at them again
ok..
looking at one of the wbsites (ps: im not going to sho the id's to be safe) {
"token": "my bot token",
"clientId": "bot application id",
"guildId": "server id"
} is Error: Unexpected token ':'
even tho the error is
SyntaxError: /home/runner/Purple-mooser-bot/config.json: Unexpected end of JSON input
at parse (<anonymous>)
at Object.<anonymous> (/home/runner/Purple-mooser-bot/index.js:15:19) leads to const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
all i found from the websites is nothing for this i read it carefully i didnt find anything to help out..
all i ask is for help not to learn about javascript
so that as a waste of nothing cuz i learned nothing cuz they were all not what i was looking for..
but it's hard to help someone that doesn't even know the basics of javascript syntax
or syntax in general
i just want to know what i need to fix
you need to fix your syntax. if you show your code properly in a code block, it would be helpful to know exactly where the issue is located
```json
// json code
```js
// js code
your code editor should be telling you where the syntax error is
yes
yes to...?
yes saying it tells me where it is im grabing it
this is json i hide the ids just in case {
"token": "your-token-goes-here",
"clientId": "your-application-id-goes-here",
"guildId": "your-server-id-goes-here"
}
Codeblocks:
```js
const Discord = require("discord.js");
// further code
```
becomes
const Discord = require("discord.js");
// further code
Inline Code:
`console.log('inline!');` becomes console.log('inline!');
saying {
"token": "your-token-goes-here",
"clientId": "your-application-id-goes-here",
"guildId": "your-server-id-goes-here"
}
oops
/home/runner/Purple-mooser-bot/config.json: Unexpected end of JSON input
at parse (<anonymous>)
ok im sorry i cannot help you anymore. please learn proper syntax #resources
what catagory do you nat me to learn in????
I CHECK THOSE
they had nothing hepfull
but 1 more time thats it
reading it for 5 minutes does not mean you'll be an expert at syntax
learning how to code takes time
just like everything else
I RED IT FOR LIKE 30 MINS THE 2ND TIME
please stop with the caps
im going to leave the post if you keep talking to me like that
all i found for this json problom is this SyntaxError: JSON.parse: bad parsing
is that what i should be reading about..
show a screenshot of your code please from the code editor
alright
thats what it said to do on the how to create slash commands guied
show your index.js
ima put it in a sourcebin if thats ok
yes
to be honest, i dont see anything wrong. not sure if its because you use replit and the file isn't saving properly or something else. i suggest using visual studio code instead for coding. i dont know what else to suggest and there's nothing else i can do to help at this time
on the other hand, you dont seem to know what any of these errors mean which is hard on your end because the discord.js guide expects you to know this already
i do have that
but i have to figure out ho to add express and discord.js on there..
why do you need express?
oh
replit is not meant for your main location to host your bots
its not a host
then i need to figure out how to add discord.js on there somehow..
its a simple command to install packages with npm, just like the guide suggests
umm
do you know how to use npm?
if not, i really can't help you anymore
welp i guess i cant make a discord bot
you can
idk npm
npm is a command from node
please look at #resources again, but not for 5 seconds
i wish you luck
ok..
but i might give up lator if i dont have any luck
thats a choice you make, but if you dont actually push yourself and try instead of looking at places to do it for you, you won't get anything done on your own
well im doing this for a friend
and they can't do it cuz that will lag out there mobile
but if you dont know anything about how the code works or how to read errors, making a bot will be 100x harder
only thing i cann do with bots is makeing them online forever is the only thing i was able to do with them
thats very simple. to keep a bot online, either make sure the code won't have errors or don't kill the terminal process
if you don't need anymore help besides what i have tried to suggest for you, im going to leave the post
ya im giveing up anywas..
and shuting them down..