const { MessageEmbed, Guild } = require("discord.js");
const db = require('quick.db');
module.exports = {
config: {
name: "restart",
category: "moderation",
aliases: ["r"],
description: "restarts the bot",
accessableby: "Administrator",
usage: "restart",
},
run: async (bot, message, args) => {
if (!message.author.id === '556247341838106624' ) {
return message.channel.send(`you cant use this!`)
}
await message.guild.channels.cache.find(channel => channel.name === "restart").id
process.exit();
}
}
ERROR:
(node:6772) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:6772) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
exports.run
returns a promise. If the caller doesn't handle its rejection, or theawait
operator is not in atry/catch
block, then failing to find a channel namedrestart
will produce the error. Now, what's the question? – traktor