npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

azury-perms

v0.6.2

Published

Azury Perms! Expand your Exclusivity

Downloads

12

Readme

Azury Permission System 🔥

permImage

How to install?

$ npm install azury-perms

What can it do?

  • Control command permissions via interaction
  • Supports custom array permissions
  • Supports Discord's role id system
  • Supports Disord's Permission
  • Simple to use with functions!
  • Mongodb DB support!
  • Can check if its true or false!

How to use it in code?

/* ---~~~---~~~---~~~--- Example code provided by azury ---~~~---~~~---~~~--- */

const { Client, Intents } = require("discord.js"); // Install discord's package
const client = new Client({
  intents: [
    Intents.FLAGS.GUILDS,
    Intents.FLAGS.GUILD_MESSAGES,
    Intents.FLAGS.GUILD_MEMBERS,
    Intents.FLAGS.GUILD_INVITES,
  ],
});

var { PermConfig } = require("azury-perms"); // Install our package



var azPermList = ["1", "2", "3"] // Discord user ids

client.on("ready", () => {
  console.log(`The bot ${client.user.tag} is now up and running!`)
});

var permConfig = new PermConfig(client);


// Assuming that you have the id admin registered in your bot

if (commandName === 'admin') {

PermConfig.checkUserPerms(interaction, "LIST", true, azPermList) // Example for adding arrays

}

Special variables?

Examples:

PermConfig.checkUserPerms(interaction, "LIST", true, azPermList) // Example for adding arrays
PermConfig.checkUserPerms(interaction, "PERMS", false, 0, "ADMINISTRATOR") // Example for admin perms
PermConfig.checkUserPerms(interaction, "ROLES", false, "0", "0", "nothing", roleId) // Example for role specific users 
PermConfig.checkUserPerms(interaction, "MONGODB_ARRAY", false, "0", "0", "nothing", 0, myMongodbConnectCmd, myMongodbModelFile, myMongodbArrayName) // Example for mongodb users who want to fetch from their database
  • Ex 1: Uses the Array system and checks the array's value and looks at a users discord id and checks if its there
  • Ex 2: Uses the discord permission system built in into discord and just reads and checks if the user has a valid permission
  • Ex 3: Uses the discord role system built in into discord and of course checks if you have the needed role or not?
  • Ex 4: Fetches and connects to your mongodb database and looks at your model file and looks for your array via the name!

Version 0.6.0!

What has changed?

  • 2 New Functions (Beta)

  • checkUserInfo and addUserPerms have been added (BETA)

  • Readme.md fixs

  • Mongodb DB Is now supported! You can know connect to your database and look at array data (Beta!)

  • Improvements to readme.md

  • New Number means some updates have be made!

  • Join discord.gg/azury and go to the suggestions channel! We would love to hear your ideas!

  • All bugs discovered have been patched but if you see one lurking around, please join discord.gg/azury and go to suggestions please!

What is coming soon?

  • Your ideas can become into reality for this project! What can you do? go to discord.gg/azury and submit some ideas in the suggestions channels!!!

Need Help

Your welcome to join discord.gg/Azury and go to code-help!

Azury Permission System - Documentation 🔥

permImage

Learn how the bot really works

How does the check system really work

  • There are two systems that you can use, the permission system, array system, role system and mongodb_array system (BETA) with both unique features you can use

  • First the permission system, it uses discord's permission API inside a guild and checks if a user has the permissions required to run the cmd

  • The array system uses your own array system and checks all the ids inside the array system and sees if the user's id is in it or not.

  • The ROLE SYSTEM system which allows you to use discord roles systems!

  • The MONGODB ARRAY system which allows you to fetch a array from your mongodb database

Methods to use the function

  • There are lots of things in this function currently. There is a cmdType that we just talked about now, cusTT, a boolean system which makes you either able to use a List system or not as a activator, CustArr which is basically the location of the array which you can define, Permname which is used if you really want to use the permission system and there is the errMsg system which is basically allows you to make messages if a user doesn't meet the requirements and of course roleID which checks if a user has a role or not via the role id (the bot must see the role and be in the guild with the role!) though it requires the cmdType to be ROLES!

  • All of this stuff is pretty easy to use and i'll document how you can both use all the methods!
    1. CusTT is a boolean type, you can use true if you wish to use a Array but if you don't, you can leave it at false!
    1. CustArr is a array type if you didn't know from the name, you can use any array with discord ids included! It must require a discord id, any amout below 0!
    1. PermName is a string type, you can type any permission, it just has to be a permission or it won't work!
    1. ErrMsg is a string type aswell except you can write anything, doesn't matter, you can write literally anything
    1. roleID is a int type and you can put your discord role ids for interactions!
    1. MongodbDataFILE is a string type which is to look a specific modal .
    1. MongodbArray Name is a string type that allows you to write the name of the array inside of your modal

Examples to those methods

  • We are going to showcase some code about all this methods and how to use them

  1. The CusTT
PermConfig.checkUserPerms(interaction, "LIST", true) // true and false can enable and disable the list feature!
  1. The CusARR

const myArray = ["discordid1", "discordid2"]

PermConfig.checkUserPerms(interaction, "LIST", true, myArray) // it will look at the myArray and look for the user's id and check if its in the array or not
  1. PermName
PermConfig.checkUserPerms(interaction, "PERM", false, "0", "ADMINISTRATOR") // It will check if the user has the ADMin perm or not (Note, the LIST methods will not matter if the cmdType is PERM)
  1. ErrMsg

const myArray = ["discordid1", "discordid2"]

PermConfig.checkUserPerms(interaction, "LIST", true, myArray, "", "Test test") // Err msg works for both PERM and LIST types! heres another example


PermConfig.checkUserPerms(interaction, "PERM", false, "0", "ADMINISTRATOR", "test Test")
  1. roleID

PermConfig.checkUserPerms(interaction, "ROLES", false, "0", "0", "nothing", 203947364839847) // must be in a int, no strings included ok! also replace the numbers without the string with your real discord role id!
 
  1. MongodbDataFIle


PermConfig.checkUserPerms(interaction, "MONGODB_ARRAY", false, "0", "0", "nothing", 0, myMongodbConnectCmd, myMongodbModelFile, myMongodbArrayName) // The Mongodb Data file is where the modal is with all your stuff 

  1. MongodbArray

PermConfig.checkUserPerms(interaction, "MONGODB_ARRAY", false, "0", "0", "nothing", 0, myMongodbConnectCmd, myMongodbModelFile, myMongodbArrayName) // The Mongodb Array is the last part of the array system!

Join discord.gg/azury if you wish to have your concepts and ideas come to reality!

Made with 🔥 By Azury