Skip to main content

Plugins

Erine has plugins available to save you some work when creating commands.

To handle plugins errors, use the contextError event.

Plugin List

Client-oriented plugins

  • Plugins.hasAnyBotPerms(...PermissionResolvable)
  • Plugins.hasAnyBotChannelPerms(...PermissionResolvable)
  • Plugins.hasBotPerms(...PermissionResolvable)
  • Plugins.hasBotPermsInChannel(...PermissionResolvable)

Guild-oriented plugins

  • Plugins.isGuild
  • Plugins.isNSFW
  • Plugins.isInChannelType

Member-oriented plugins

  • Plugins.cooldown(number, Bucket)
  • Plugins.hasAnyPerms(...PermissionResolvable)
  • Plugins.hasAnyChannelPerms(...PermissionResolvable)
  • Plugins.hasPerms(...PermissionResolvable)
  • Plugins.hasPermsInChannel(...PermissionResolvable)
  • Plugins.isOwner
  • Plugins.onlyForIDs(...Snowflake)

Example

const { Bucket, CommandBuilder, Plugins } = require('erine');

const data = {
data: new CommandBuilder({
name: "eval",
description: "Evals the provided code.",
as_prefix: true,
as_slash: true
}),
plugins: [Plugins.isOwner, Plugins.cooldown(5000, Bucket.User)],
async (context) {
// Code here...
}
}

module.exports = { data }

Global Plugins

If you don't provide plugins to some commands. Erine will use the default ones provided in Erine#addGlobalPlugins or will push these one to the command's plugins.

Setup

const { Bucket, Erine, Plugins } = require('erine')

const client = new Erine(...)

client.addGlobalPlugins([
Plugins.cooldown(2, Bucket.Member),
Plugins.hasPerm("Administrator")
])