This code is what i am using now to have a rough idea of what to do
bot.on('message', (message) => {
if (messege.content.includes) {
int (num = 0);
switch(num) {
case 1:
System.out.println('The IP of the server is .');
case 2:
System.out.println('The Store is');
case 3:
System.out.println('Disord instant link : ');
default:
System.out.println('Sorry ');
}
}
});
bot.on('message', (message) => {
if(message.content == (prefix + 'help')) {
message.channel.sendMessage('With what may you like help?');
message.reply('Enter 1, ...');
message.reply('Enter 2, Stores link!');
message.reply('Enter 3, discord instant link');
}
});
How would i create a case statement based on what was given in the input and how to return the outcome?
You're going to have to look into async / await
functions, so that on a message, you can run a certain function. Tutorial on async/await
Essentially you send the prompt:
message.channel.send('With what may you like help?');
then await
to wait for a response and you can use the result in your switch statement.
Edit: You don't have to look into async/await
consider using this solution: Waiting for reply with discord.js
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.