Skip to content

nocrasher is an npm package designed to prevent crashes/stops of your node.js project caused by errors

Notifications You must be signed in to change notification settings

croxtyl/nocrasher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

nocrasher

What is this and how do I use it?

nocrasher is an anti crash npm package designed to prevent crashes/stops of your node.js project caused by errors

Installation

npm install nocrasher

Add this to your main file

const NoCrash = require('nocrasher');
const noCrashing = new NoCrash({
  enableNoCrasher: true, //or set false to disable nocrasher
  enableWebhook: true, //or set false to disable webhooks logs
  webhookURL: 'https://api.example.com/webhook/123456789', //paste your webhook url (discord webhook can also be)
});

Examples

For discord.js (v14):

const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [ 
  GatewayIntentBits.Guilds,
  GatewayIntentBits.MessageContent,] });
  const NoCrash = require('nocrasher');
  const noCrashing = new NoCrash({
    enableNoCrasher: true,
    enableWebhook: true,
    webhookURL: 'https://discord.com/api/webhooks/1234567890/0987654321',
  });
  
client.on("ready", () => {
  console.log(`Bot is ready. Logged in as ${client.user.tag}`);
});

client.on("messageCreate", (message) => {
    if (message.content === "!ping") {
      message.reply("Pong!")
    } 
    });

client.login("bot_token");

It's not just for discord.js. Can It can work in other projects using many other packages e.g. express.js.

About

nocrasher is an npm package designed to prevent crashes/stops of your node.js project caused by errors

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published