getInput needs await and message as parameter

This commit is contained in:
Mohammed Ashab Uddin
2020-08-06 13:05:02 +04:00
parent 75073e5e03
commit e4df23516f

View File

@@ -188,7 +188,6 @@ const commands = [
];
module.exports= onMessage = async (message, client) => {
let command = null;
@@ -213,13 +212,12 @@ module.exports= onMessage = async (message, client) => {
let input = {};
//check if the command requires input
if(command.requireInput){
input = command.getInput(message.body);
input = await command.getInput(message);
}
//determine the user
logic.setUser(message.id.remote);
//determine the input
logic.setInput(input);
//call callback function in the command
//await is used, so that if a command is an async function
//the program will wait until it is finished