Lightweight PermissionsBitField package
Hey! I want to use the PermissionsBitField class in an API of mine, without having to import all of DiscordJS. I did some searching to see if there was any sort of standalone package for it but wasn't able to find anything.
I know it wouldn't be too hard to make from scratch but I wanted to check first to see if anyone knows of an existing package. Thanks!
4 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Post the full error stack trace, not just the top part!
- Show your code!
- Explain what exactly your issue is.
- Not a discord.js issue? Check out #useful-servers.
- Issue solved? Press the button!DiscordJS Version: 14.8.0
Node version: v18.16.1
PermissionsBitField
is a class defined inside of discord.js, it isn't exported from elsewhere. You could alternatively use PermissionFlagsBits
from discord-api-types
if you need just the bits without utility functionsMainly package size, it doesn't really make sense to pull in all of DiscordJS to my api - I also ran into a build error with it making me have to hoist it with pnpm
Serverless functions hosted through vercel, compared to Prisma the package size of DiscordJS isn't really a problem - it's more just trying to cutdown if it's not needed
It seems a bit goofy to me to install DiscordJS to just use the PermissionsBitField class