This repository has been archived by the owner on Sep 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Module: Security
Paul edited this page Jul 24, 2020
·
2 revisions
The security module lets you put security checks on commands.
You can test permission functions, bot permissions and user permissions!
- 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
}
}
});
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
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!
©BananenBot 2017-2020 - all rights saved