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