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.
- Fully ready for TypeScript!
- Includes ESM ready entrypoint
- Easy to use
@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.
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();
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.
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
})
}
}
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
})
}
}
-
plugin-api
: "error" -
plugin-subcommands
: "MessageSubcommandError", "chatInputSubcommandError" -
plugin-scheduled-tasks
: "scheduledTaskError" -
framework
: "messageCommandError", "chatInputCommandError", "contextMenuCommandError", "commandAutocompleteInteractionError", "error", "listenerError" and "interactionHandlerError"
Thanks goes to these wonderful people (emoji key):
Kaname 💻 🐛 📖 🚇 🚧 👀 |
This project follows the all-contributors specification. Contributions of any kind welcome!