toowake

prefix catch error

May 5th, 2023 (edited)
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. try {
  2.         command.execute(client, message, args);
  3.     } catch (error) {
  4.         console.error(error);
  5.         message.channel.send({
  6.             content: 'There was an error while executing this command! I reported that to the staff team!'
  7.         });
  8.         const channel = client.channels.cache.get(`Your Error ChannelID`);
  9.         const embed =  new EmbedBuilder()
  10.         .setTitle("Someone had an error!")
  11.         .addFields(
  12.             {name: "User:", value: `<@${message.author.id}>`, inline: false}
  13.         )
  14.         .setDescription(`\`${error}\``)
  15.         .setColor("Red")
  16.  
  17.         channel.send({
  18.              embeds: [embed]
  19.         }).catch(err => {
  20.             return;
  21.         });
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment