#Dude'sOp -
1 messages · Page 1 of 1 (latest)
Apparently we can make threads, so imma do that.
Are you able to send your config.json? - OBVIOUSLY omitting any important information like your bot token
yep, its again a super short thing, im following the discord bot guide
{
"token": "abc?",
"clientId": "its not 123",
"guildId": "why look for this :p"
}
i followed the guide and it basically just said to plug in the ID's
interesting
the guildID, im using my test server to prep the thing
im kinda new to js, what does the error tell you?
The error leads me to believe that there is a mistake in config.js, this is hinted at by the SyntaxError you received.
I wonder if it may be because you are missing the last ,... but I don't see why that would be the case
try add that last trailing ,
{
"token": "abc?",
"clientId": "id1",
"guildId": "id2",
}
sadly not
SyntaxError: C:\Users\Dudes\OneDrive\Desktop\StrictlyStudents\config.json: Expected double-quoted property name in JSON at position 164
at parse (<anonymous>)
at Module._extensions..json (node:internal/modules/cjs/loader:1227:39)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (C:\Users\Dudes\OneDrive\Desktop\StrictlyStudents\deploy-commands.js:2:38)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
thats the error i got after adding the trailing comma
okay, well remove line 2 from deploy-commands.js, that being this one;js const { clientId, guildId, token } = require('./config.json'); and add this instead;```js
const token = "your-token-goes-here";
const clientId = "123456789012345678";
const guildId = "876543210987654321";
just circumvent the issue lol
You can’t have trailing commas in json
I forgor, but then the guide should be updated ;p
Feel free to make a PR
idk how right is the guide but im jus following along and asking as i see issues
Or I can do it in a few minutes
got it lemme give it a try
I'll make a pr quick
SyntaxError: C:\Users\Dudes\OneDrive\Desktop\StrictlyStudents\config.json: Expected double-quoted property name in JSON at position 162
at parse (<anonymous>)
at Module._extensions..json (node:internal/modules/cjs/loader:1227:39)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (C:\Users\Dudes\OneDrive\Desktop\StrictlyStudents\deploy-commands.js:2:38)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
sadly another error
did you remove line 2?
Show ur config.json file (hide the token)
^ this is their config.json
yep
const { REST, Routes } = require('discord.js');
"token": "token";
"clientId": "id1";
"guildId": "id2";
const fs = require('node:fs');
const commands = [];
// Grab all the command files from the commands directory you created earlier
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
const command = require(./commands/${file});
commands.push(command.data.toJSON());
}
// Construct and prepare an instance of the REST module
const rest = new REST({ version: '10' }).setToken(token);
// and deploy your commands!
(async () => {
try {
console.log(Started refreshing ${commands.length} application (/) commands.);
// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
);
console.log(Successfully reloaded ${data.length} application (/) commands.);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
this is my deploy-commands.json
const { REST, Routes } = require('discord.js');
const token = "token";
const clientId = "id1";
const guildId = "id2";
const fs = require('node:fs');
const commands = [];
// Grab all the command files from the commands directory you created earlier
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
const command = require(./commands/${file});
commands.push(command.data.toJSON());
}
// Construct and prepare an instance of the REST module
const rest = new REST({ version: '10' }).setToken(token);
// and deploy your commands!
(async () => {
try {
console.log(Started refreshing ${commands.length} application (/) commands.);
// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
);
console.log(Successfully reloaded ${data.length} application (/) commands.);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
use this instead
you used the wrong formatting :3
SyntaxError: C:\Users\Dudes\OneDrive\Desktop\StrictlyStudents\config.json: Expected double-quoted property name in JSON at position 162
at parse (<anonymous>)
at Module._extensions..json (node:internal/modules/cjs/loader:1227:39)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (C:\Users\Dudes\OneDrive\Desktop\StrictlyStudents\deploy-commands.js:2:38)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
same error sitll pops up
im starting to question theres something wrong with the guide