A lightweight managing package,which catches and save discord errors and even send daily bot reports. Intelligent saving ways and good interface. Find every Bug in your Code!
If you need help feel free to join our discord server. We will provied you all help ☺
You can download it from npm:
npm i discord-error-handler
First we include the module into the project (into your main bot file).
const Errorhandler = require("discord-error-handler");
const client = new Discord.Client();
const handle = new Errorhandler(client, {
webhook: {id: `Webhook id for error logging`, token: `Webhooktoken for error logging`}
}) // do not rename here something, or else Dx
Following examples assume that your Discord.Client
is called client
.
client.on('message', async message => {
try{
if(message.author.bot) return;
if(message.content === "!notwork") return message.chanel.send("ddd");
// the error here is "chanel" , the right thing would be "channel" ==> this will now send a message in the log channel.
//When the error happens again. It will not send the error again
}catch(error){
handle.createrr(client, message.guild.id, message.content, error)
}
});
if(message.content === "!report") return handle.report(client , message);
process.on('unhandledRejection', error => {
handle.createrr(client,undefined, undefined, error)
});
//This Codes is just for sharded bots
const status = await handle.status(client);
console.log(status)
const Discord = require('discord.js');
const Errorhandler = require("discord-error-handler");
const { prefix, token , url} = require('./config.json');
const client = new Discord.Client();
const handle = new Errorhandler(client, {
webhook: {id: `Webhook id for error logging`, token: `Webhooktoken for error logging`}
stats: false, ///true when you want hourly stats
}) // do not rename here something, or else Dx
client.once('ready', () => {
console.log('Ready! Logged in as ' + client.user.tag + " with Prefix: " + prefix);
});
client.on('message', async message => {
try{
if (message.author.bot) return;
if(message.content === "!start") return message.chanel.send("ddd"); ///create a error
if(message.content === "!report") return handle.report(client , message);
}catch(error){
handle.createrr(client, message.guild.id, message.content, error)
}
});
client.login(token);
process.on('unhandledRejection', error => {
handle.createrr(client,undefined, undefined, error)
});
Have fun and feel free to contribute/suggest or contact me on my discord server or per dm on Meister#9667
If you encounter any problems feel free to open an issue in our github repository or join the discord server..