Socket
Book a DemoInstallSign in
Socket

@einsyntax/discord-perms

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@einsyntax/discord-perms

Create and manage own permissions for discord.js! with mongodb

1.0.7
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Introduction

This package is meant to provide an easy way to create and use own discord.js permissions, all data is stored with mongodb

Installation

npm i @einsyntax/discord-perms

Require Package

var permissions = require('discord-perms')

What is Discord Perms?

Discord Perms is an easy-to-use permissions manager built with mongodb/mongoose. It's simple and perfect for smaller projects, with Discord Perms you can create your own permissions for discord.js! the permissions are processed via MongoDB.

Example

const permissions = require('discord-perms')

// Set the mongodb url and connect to database(For example do it in the ready event of discord.js):
permissions.setmongoURL('mongourl');

// To create a user:
permissions.createUser(userID, guildID);
//Example:
permisions.createUser("390810485244821505", "653154689218641930")


// To delete a user:
permissions.deleteUser(userID, guildID);
//Example: 
permisions.deleteUser("390810485244821505", "653154689218641930")


// Add a permission to a user:
permissions.addPermission(userID, guildID, permission)
//Example: 
permisions.addPermission("390810485244821505", "653154689218641930", "bot.moderator")

// Remove a permission from a user:
permissions.removePermission(userID, guildID, permission)
//Example: 
permisions.removePermission("390810485244821505", "653154689218641930", "bot.moderator")

// Check if user has a permission
permissions.hasPermission("390810485244821505", "653154689218641930", "bot.moderator")
//Example: 
if (await permissions.hasPermission(message.author.id, message.guild.id, "bot.admin")) {
		console.log("HE HAS THE PERMISSION!")
	} else {
		console.log("HE HASN'T THE PERMISSION!")
}
//PLEASE USE THIS WITH await

You have ideas and questions?

Create an issue on the Github respository

Keywords

discord

FAQs

Package last updated on 04 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.