client.login(config.BOT_TOKEN);
SyntaxError: Unexpected end of input
That was the error
const Discord = require(‘discord.js’);
const client = new Discord.Client();
const PREFIX = ‘,’;
const fs = require(‘fs’);
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync(’./commands/’).filter(file => file.endsWith(’.js’));
for(const file of commandFiles){
const command = require(./commands/${file}
);
client.commands.set(command.name, command);
}
var version = ‘1.0.1’
client.once(‘ready’, () =>{
console.log(‘online!’)
})
client.on(‘message’, message=>{
if(!message.content.startsWith(PREFIX) || message.author.bot) return;
const args = message.content.slice(PREFIX.length).split(/ +/);
const command = args.shift().toLowerCase();
if (command === ‘ping’) {
client.commands.get(‘ping’).execute(message, args);
} else if (command === ‘calc’) {
client.commands.get(‘calc’).execute(message, args);
};
client.login(config.BOT_TOKEN);
And this is my code so far,
I dont get what they are asking here or what im missing
Can you share your full error? (in backticks —> `)
client.on(‘message’, message=>{
if(!message.content.startsWith(PREFIX) || message.author.bot) return;
const args = message.content.slice(PREFIX.length).split(/ +/);
const command = args.shift().toLowerCase();
if (command === ‘ping’) {
client.commands.get(‘ping’).execute(message, args);
} else if (command === ‘calc’) {
client.commands.get(‘calc’).execute(message, args);
};
Needs to be
client.on(‘message’, message=>{
if(!message.content.startsWith(PREFIX) || message.author.bot) return;
const args = message.content.slice(PREFIX.length).split(/ +/);
const command = args.shift().toLowerCase();
if (command === ‘ping’) {
client.commands.get(‘ping’).execute(message, args);
} else if (command === ‘calc’) {
client.commands.get(‘calc’).execute(message, args);
}
});
It’s the same thing as before basically
/home/container/index.js:37
client.login(config.BOT_TOKEN);
SyntaxError: Unexpected end of input
at wrapSafe (internal/modules/cjs/loader.js:1167:16)
at Module._compile (internal/modules/cjs/loader.js:1215:27)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1272:10)
at Module.load (internal/modules/cjs/loader.js:1100:32)
at Function.Module._load (internal/modules/cjs/loader.js:962:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:4
This is all that i got
bruh you’ve got to be kidding me
1 Like
system
Closed
April 11, 2021, 8:17am
6
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.