我想做的是在我的控制台中运行命令,但我想知道如何为控制台中的命令创建一个监听器。
client.on(“message”,async message=>{//rest of the code
但是在一个同样适用于控制台的版本中,有没有人知道如何做到这一点呢?
可以使用名为prompt-sync的模块(https://www.codecademy.com/articles/getting-user-input-in-node-js)完成类似的操作
示例:
let guess = prompt('Enter your command : ');
if (guess === "message") {
client.channels.cache.get(`644164162968223744`).send(`Hey, this is a message`)
}