[英]"Send" is undefined, lost what I've done? | Discord.jsbo
exports.exec = async (message, bot) => {
await message.channel.send("Rebooting...").catch(err => this.client.console.error(err));
process.exit(1);
};
exports.config = {
aliases: [ ],
enabled: true,
};
exports.help = {
name: 'Restart',
botPermission: '',
userTextPermission: '',
userVoicePermission: '',
usage: 'Restart',
example: [ ]
};
Is the code I've got attempting to run, throws back this error是我试图运行的代码,抛出这个错误
I've got no clue at all, I've done a lot of other commands and all defines are fine but I'm absolutely struggling with this one?我根本没有任何线索,我已经完成了很多其他命令并且所有定义都很好,但是我绝对在为这个而苦苦挣扎? I don't see how it's failing at all..
我根本看不出它是如何失败的..
exports.exec = async (client, message, args, level) => { // eslint-disable-line no-unused-vars
message.delete();
message.channel.send("Are you sure you want to reboot?\n\nReply with `cancel` to abort the reboot. The reboot will self-abort in 30 seconds");
return message.channel.awaitMessages(m => m.author.id === message.author.id, {
"errors": ["time"],
"max": 1,
time: 30000
}).then(resp => {
if (!resp) return;
resp = resp.array()[0];
const validAnswers = ["yes", "y", "no", "n", "cancel"];
if (validAnswers.includes(resp.content)) {
if (resp.content === "cancel" || resp.content === "no" || resp.content === "n") {
return message.channel.send("Aborting reboot");
} else if (resp.content === "yes" || resp.content === "y") {
client.destroy().then(() => {
process.exit();
}).catch(error => console.error(error));
}
} else {
message.channel.send(`Only \`${validAnswers.join("`, `")}\` are valid, please supply one of those.`).catch(error => console.error(error));
}
}).catch(error => {
console.error(error);
message.channel.send("Reboot timed out");
});
};
/* * * * */
When inputting $restart you'll have an automated reply back from the bot with " Are you sure you want to reboot? Reply with
cancel to abort the reboot. The reboot will self-abort in 30 seconds
"输入$restart 时,机器人会自动回复“
Are you sure you want to reboot? Reply with
取消to abort the reboot. The reboot will self-abort in 30 seconds
”
If you type " cancel
" obviously it'll cancel it, if you wait out the time-out it'll also cancel.如果您键入“
cancel
”,显然它会取消它,如果您等待超时,它也会取消。
Replying with回复
Yes
| Yes
| Y
| Y
| will restart the bot将重新启动机器人
No
| No
| N
| N
| will cancel it将取消它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.