Module: Security - Paultje52/BananenBase GitHub Wiki
The security module lets you put security checks on commands.
You can test permission functions, bot permissions and user permissions!
Configuration
- defaultPermissions > Object
- user > Array with strings, permissions from docs
- bot > Array with strings, permissions from docs
- permissionNames > Object with test functions
Option example
.addModule("security", {
defaultPermissions: {
user: ["MANAGE_GUILD"], // For each command
bot: ["MANAGE_MESSAGES"] // For each command
},
permissionNames: { // Permission names
botOwner: (message, BananenBase) => {
// Check for "botOwner" permission name
},
serverAdmin: (message, BananenBase) => {
// Check for "serverAdmin" permission name
}
}
});
Command options
Name: Security
Value: Needs to be an object, with these values. (All of them are optional)
- permissions > Object
- user > Array with strings, permissions from docs
- bot > Array with strings, permissions from docs
- permissionName > String, a key name of a function from
Configuration > PermissionNames
Example
In the command constructor
super(BananenBase, {
name: "ping",
description: "Test my reaction speed!",
enabled: true
}, {
name: "security",
value: {
permissions: {
user: ["MANAGE_GUILD", "ADD_REACTIONS"], // User needs "MANAGE_GUILD" and "ADD_REACTIONS" permissions for this command
bot: ["MANAGE_MESSAGES"] // Bot needs "MANAGE_MESSAGES" permission for this command
},
permissionName: "botOwner" // Test the "botOwner function"
}
});
// Security checks are added!