Skip to content
What is wrong with my Code?
Profile icon
xfrozenxbake

Why do I get a unexpected end of input
Here is my code,
const mySecret = process.env['TOKEN'];
const { Client, MessageEmbed } = require('discord.js');
const config = require('./config');
const commands = require('./help');

let bot = new Client({
fetchAllMembers: true, // Remove this if the bot is in large guilds.
presence: {
status: 'online',
activity: {
name: ${config.prefix}help,
type: 'LISTENING'
}
}
});

bot.on('ready', () => console.log(Logged in as ${bot.user.tag}.));

bot.on('message', async message => {
// Check for command
if (message.content.startsWith(config.prefix)) {
let args = message.content.slice(config.prefix.length).split(' ');
let command = args.shift().toLowerCase();
switch (command) {
};

client.on('messageCreate', async (message) => {
if ((message.content) == '/dailyverse') {
message.channel.send(String('Hey Biblebot, whats the dailyverse?'));
message.channel.send(String('+dailyverse'));
};

client.on('messageCreate', async (message) => {
if ((message.content) == '/ping') {
let msg = await message.reply('Pinging...');
await msg.edit(PONG! Message round-trip took ${Date.now() - msg.createdTimestamp}ms.)

};

/* Unless you know what you're doing, don't change this command. /
client.on('messageCreate', async (message) => {
/
Unless you know what you're doing, don't change this command. */
client.on('messageCreate', async (message) => {
if ((message.content) == '/help') {
let embed = new MessageEmbed()
.setTitle('HELP MENU')
.setColor('GREEN')
.setFooter(Requested by: ${message.member ? message.member.displayName : message.author.username}, message.author.displayAvatarURL())
.setThumbnail(bot.user.displayAvatarURL());
if (!args[0])
embed
.setDescription(Object.keys(commands).map(command => ${command.padEnd(Object.keys(commands).reduce((a, b) => b.length > a.length ? b : a, '').length)}:: ${commands[command].description}).join('\n')); else { if (Object.keys(commands).includes(args[0].toLowerCase()) || Object.keys(commands).map(c => commands[c].aliases || []).flat().includes(args[0].toLowerCase())) { let command = Object.keys(commands).includes(args[0].toLowerCase())? args[0].toLowerCase() : Object.keys(commands).find(c => commands[c].aliases && commands[c].aliases.includes(args[0].toLowerCase())); embed .setTitle(COMMAND - ${command})

if (commands[command].aliases) embed.addField('Command aliases', `\`${commands[command].aliases.join('`, `')}\``); embed .addField('DESCRIPTION', commands[command].description) .addField('FORMAT', `\`\`\`${config.prefix}${commands[command].format}\`\`\``); } else { embed .setColor('RED') .setDescription('This command does not exist. Please use the help command without specifying any commands to list them all.'); } } message.channel.send(embed); if (commands[command].aliases) embed.addField('Command aliases', `\`${commands[command].aliases.join('`, `')}\``); embed .addField('DESCRIPTION', commands[command].description) .addField('FORMAT', `\`\`\`${config.prefix}${commands[command].format}\`\`\``); } else { embed .setColor('RED') .setDescription('This command does not exist. Please use the help command without specifying any commands to list them all.'); } } message.channel.send(embed);

};
bot.login(process.env.TOKEN);
}
}
});

Here is the error message when running node index.js
SyntaxError: Unexpected end of input
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1031:15)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint as runMain
at node:internal/main/run_main_module:17:47
Thanks in advance

You are viewing a single comment. View All
Profile icon
LordSoloOfficial