🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@discord-rose/admin-middleware

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@discord-rose/admin-middleware

Admin middleware for Discord-Rose

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
8
700%
Maintainers
1
Weekly downloads
 
Created
Source

Admin Middleware

Admin middleware for discord-rose

Install

npm i @discord-rose/admin-middleware

Usage

Setting CommandOptions.admin to true will let the middleware run and lock a command if a user is not an admin.

The middleware can either take an ID of an admin, an array of an IDs of an admin, or an async function to check.

const adminMiddleware = require('@discord-rose/admin-middleware')

worker.commands
  .middleware(adminMiddleware('142408079177285632'))
  .add({
    admin: true,
    command: 'eval',
    exec: (ctx) => {
      // naughty eval code
    }
  })

This command will now only run if the user has an ID of 142408079177285632, essentially admin locking the command.

Alternate methods

worker.commands
  .middleware(adminMiddleware(['142408079177285632', '277183033344524288']))

Or

worker.commands
  .middleware(adminMiddleware(async (id) => { // author id
    return await isAdmin(id)
  }))

Keywords

discord-rose

FAQs

Package last updated on 13 Feb 2021

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