Hey I hope someone can help me with my problem.
The following code should Output:
Hello World! Goodbye!
But it doesn`t wait for the second Line to be execute.
So the Output is Hello Goodbye! World!
const Discord = require("discord.js");
const config = require("./config.json");
const client = new Discord.Client();
const prefix = "02";
client.on("message", async message => {
if (message.author.bot) return;
if (!message.content.startsWith(prefix)) return;
const commandBody = message.content.slice(prefix.length);
const args = commandBody.split(' ');
const command = args.shift().toLowerCase();
if (command === "help" || command === "h" || command === "hilfe"){
console.log("Hello");
await setTimeout(() => { console.log("World!"); }, 2000);
console.log("Goodbye!");
}
});
client.login(config.BOT_TOKEN);