[英]Errorhandler discord
I'm trying to make an error handler so my bot will not go offline.我正在尝试制作一个错误处理程序,因此我的机器人不会 go 离线。
async function catchErr (error, message) {
await client.users.fetch("id").send("ERROR" + error) ("There was an error at channel" + message.channel + "in guild" + message.guild);
await client.users.get("id").send ("ERROR" + error)
console.error(error, message);
await message.author.send(error)
}
No error没有错误
You don't need to make your own.你不需要自己做。 Use the
.catch()
method to catch errors.使用
.catch()
方法来捕获错误。
Usage:用法:
if (message.content.startsWith(prefix + "ping")) {
message.channel.send("pong").catch(err => {
console.log(``)
console.log(`Unable to Respond in ${message.guild.name}`) | message.channel.send(`**Error.**`).then(msg => {
msg.delete({ timeout: 3000 })
})
})
}
Catches errors when a command is requested...if there is an error.在请求命令时捕获错误...如果有错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.