#Slash command issue

94 messages · Page 1 of 1 (latest)

prisma snow
#

check if your files are saved

ember coyote
#

ok i deleted it again now its telling me where the other one is now weird it didnt do that last time

#

ok

prisma snow
#

const variables in the same file cannot be defined more than once

ember coyote
#

it was next to the 60

#

deleted it and saved it just in case

#

on a diff tab

#

now its

#

unexpected token..

prisma snow
#

can you show the error please?

ember coyote
#

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

prisma snow
#

thats a syntax error

#

do you know how to fix your syntax?

ember coyote
#

not much..

#

only delete

prisma snow
#

check #resources for learning javascript. proper syntax is essential to every programming language for proper functionality

ember coyote
#

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..

prisma snow
#

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

ember coyote
#

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');

ember coyote
#

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..

prisma snow
#

but it's hard to help someone that doesn't even know the basics of javascript syntax

#

or syntax in general

ember coyote
#

i just want to know what i need to fix

prisma snow
#

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

ember coyote
#

yes

prisma snow
#

yes to...?

ember coyote
#

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"
}

humble stoneBOT
#

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!');

ember coyote
#

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>)

prisma snow
#

ok im sorry i cannot help you anymore. please learn proper syntax #resources

ember coyote
#

what catagory do you nat me to learn in????

prisma snow
ember coyote
#

I CHECK THOSE

#

they had nothing hepfull

#

but 1 more time thats it

prisma snow
#

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

ember coyote
#

I RED IT FOR LIKE 30 MINS THE 2ND TIME

prisma snow
#

please stop with the caps

#

im going to leave the post if you keep talking to me like that

ember coyote
#

all i found for this json problom is this SyntaxError: JSON.parse: bad parsing

#

is that what i should be reading about..

prisma snow
#

show a screenshot of your code please from the code editor

ember coyote
#

alright

#

thats what it said to do on the how to create slash commands guied

prisma snow
#

show your index.js

ember coyote
#

ima put it in a sourcebin if thats ok

prisma snow
#

yes

ember coyote
prisma snow
#

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

ember coyote
#

i do have that

#

but i have to figure out ho to add express and discord.js on there..

prisma snow
#

why do you need express?

ember coyote
#

oh

prisma snow
#

replit is not meant for your main location to host your bots

#

its not a host

ember coyote
#

then i need to figure out how to add discord.js on there somehow..

prisma snow
#

its a simple command to install packages with npm, just like the guide suggests

ember coyote
#

umm

prisma snow
#

do you know how to use npm?

#

if not, i really can't help you anymore

ember coyote
#

welp i guess i cant make a discord bot

prisma snow
#

you can

ember coyote
#

idk npm

prisma snow
#

npm is a command from node

#

please look at #resources again, but not for 5 seconds

#

i wish you luck

ember coyote
#

ok..

#

but i might give up lator if i dont have any luck

prisma snow
#

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

ember coyote
#

well im doing this for a friend

#

and they can't do it cuz that will lag out there mobile

prisma snow
#

but if you dont know anything about how the code works or how to read errors, making a bot will be 100x harder

ember coyote
#

only thing i cann do with bots is makeing them online forever is the only thing i was able to do with them

prisma snow
#

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

ember coyote
#

ya im giveing up anywas..

#

and shuting them down..