Socket
Socket
Sign inDemoInstall

@kaname-png/plugin-sentry

Package Overview
Dependencies
1
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kaname-png/plugin-sentry

Plugin for @sapphire/framework to post error on sentry.


Version published
Weekly downloads
44
decreased by-88.24%
Maintainers
1
Install size
199 kB
Created
Weekly downloads
 

Readme

Source

Neko Plugins Logo

@kaname-png/plugin-sentry

Plugin for @sapphire/framework to publish errors to sentry.

GitHub codecov npm (scoped) npm

Description

This plugin allows you to integrate Sentry with Bot. Sentry is a developer-focused error tracking and performance monitoring platform that helps developers see what really matters, solve faster, and learn more about their applications.

More information about Sentry can be found on its website.

Features

  • Fully ready for TypeScript!
  • Includes ESM ready entrypoint
  • Easy to use

Installation

@kaname-png/plugin-sentry depends on the following packages. Be sure to install these along with this package!

You can use the following command to install this package, or replace npm install with your package manager of choice.

npm install @kaname-png/plugin-sentry @sentry/node @sentry/integrations @sapphire/framework discord.js

PS: You can view events by default here.


Usage

JavaScript

In your main or setup file, register the plugin:

require('@kaname-png/plugin-sentry/register');

const client = new SapphireClient({
	/* your bot options */
	sentry: {
		loadSentryErrorListeners: true, // (Optional) Load the default events .
		options: {
			// The options to pass to the sentry client.
		}
	}
});

async function main() {
	await client.login();
}

void main();

TypeScript

In your main or setup file, register the plugin:

import '@kaname-png/plugin-sentry/register';

const client = new SapphireClient({
	/* your bot options */
	sentry: {
		options: {
			// The options to pass to the sentry client.
		}
	}
});

async function main() {
	await client.login();
}

void main();

Then, you can create new listener by extending the SentryListener class.

With TypeScript

import { SentryListener } from '@kaname-png/plugin-sentry';
import { ApplyOptions } from '@sapphire/decorators';

// Using ApplyOptions decorator makes it easy to configure
@ApplyOptions<SentryListener.Options>({
  event: 'error'
})
// Extend `SentryListener` instead of `Listener`
export class ErrorListener extends SentryListener {
  public async run(error: unknown) {
    return this.captureException(error, {
      // your context options
    })
  }
}

With Javascript

import { SentryListener } from '@kaname-png/plugin-sentry';

module.exports = class ErrorListener extends SentryListener {
  constructor(context, options) {
    super(context, {
      ...options,
      event: 'error'
    })
  }

  async run(error) {
    return this.captureException(error, {
      // your context options
    })
  }
}

**The default listeners:

  • plugin-api: "error"
  • plugin-subcommands: "MessageSubcommandError", "chatInputSubcommandError"
  • plugin-scheduled-tasks: "scheduledTaskError"
  • framework: "messageCommandError", "chatInputCommandError", "contextMenuCommandError", "commandAutocompleteInteractionError", "error", "listenerError" and "interactionHandlerError"

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Kaname

💻 🐛 📖 🚇 🚧 👀

This project follows the all-contributors specification. Contributions of any kind welcome!

Keywords

FAQs

Last updated on 27 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc