Advertisement
Nimbi

onError.ts

Dec 6th, 2022 (edited)
1,286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TypeScript 0.84 KB | Source Code | 0 0
  1. discord.on('MESSAGE_CREATE', async (Message) => {
  2.   let self = await discord.getBotUser();
  3.   let err = await Error();
  4.   let logChannel = await discord.getTextChannel('xxxxxxxxxxxxxxxxx');
  5.  
  6.   console.log(err.message);
  7.  
  8.   let embed = new discord.Embed({
  9.     title: 'Pylon Error Handler',
  10.     description: 'An error has been triggered.',
  11.     color: 7441133,
  12.   })
  13.     .setFields([
  14.       {
  15.         name: 'Error Message',
  16.         value: ['```ts', err.message, '```'].join('\n'),
  17.         inline: false,
  18.       },
  19.       {
  20.         name: 'Error Stack',
  21.         value: ['```ts', err.stack, '```'].join('\n'),
  22.         inline: false,
  23.       },    ])
  24.     .setThumbnail({ url: self.getAvatarUrl() })
  25.     .setFooter({
  26.       text: 'Powered by ' + self.username,
  27.       iconUrl: self.getAvatarUrl(),
  28.     });
  29.   await logChannel?.sendMessage(embed);
  30. });
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement