Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example interrupt plugin #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions interrupts/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*!
* @plugin bastion-example-plugin
* @author Sankarsan Kampa (k3rn31p4nic)
* @license MIT
*/

"use strict";

const tesseract = require("@bastion/tesseract");

class ExampleInterruptPlugin extends tesseract.Interrupt {
constructor() {
super("example", {
// Type of the interrupter
// 0 - Interrupts `message` and `messgeUpdate` events. The event processing will be interrupted at the first encounter of this interrupter.
// 1 - Interrupts `message` and `messgeUpdate` events. The event processing will be interrupted only after all interrupters of this type are evaluated and at least one of them evaluates to true.
// 2 - Interrupts `message` event. The event processing will be interrupted at the first encounter of this interrupter.
// 3 - Interrupts `message` event. The event processing will be interrupted only after all interrupters of this type are evaluated and at least one of them evaluates to true.
type: 0,
});
}

/**
* @param {Message} message Discord.js Message object - https://bastion.gitbook.io/docs/plugins#supported-events for all supported events.
* @returns {boolean} If a truthy value is returned, it signals the event handler to interrupt further processing.
*/
exec = async (message) => {
console.log(message);
}
}

module.exports = ExampleInterruptPlugin;