
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
discord-permission-helper
Advanced tools
Convert discord permission bitfields to readable strings and check for permissions
This npm package provides a simple implementation for converting and checking Discord permission bitfields.
npm i discord-permission-helper
import { PermissionConverter } from 'discord-permission-helper';
// Create a PermissionConverter instance
const permissionConverter = new PermissionConverter();
// Convert a permission bitfield to an array of permission names
const permissionBitfield = '2199023255552n';
const convertedPermissions = permissionConverter.convertPermission({
hash: permissionBitfield,
json: false
});
console.log(convertedPermissions);
// Output: ['VIEW_CREATOR_MONETIZATION_ANALYTICS']
// Check if a specific permission is granted in a bitfield
const hasPermission = permissionConverter.checkPermission('KICK_MEMBERS', permissionBitfield);
console.log(hasPermission);
// Output: false
// Convert permissions to JSON string
const jsonPermissions = permissionConverter.convertPermission({
hash: permissionBitfield,
json: true
});
console.log(jsonPermissions);
// Output: '["VIEW_CREATOR_MONETIZATION_ANALYTICS"]'
FAQs
Convert discord permission bitfields to readable strings and check for permissions
We found that discord-permission-helper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.