ApplicationCommand & PermissionFlagsBits

I recently refactored my static Command files to store the SlashCommands, and underlying SubCommands, SubCommandGroups and CommandOptions, in my DB (I consider this Metadata) and expanded on the different fields available. (Like NSFW, DmPermission, etc) For the .setDefaultMemberPermissions() method, what would be the best way to store this? Was considering in string form, e.g. "2 | 4" with the numbers representing KICK_MEMBERS and BAN_MEMBERS respectfully.
5 Replies
d.js toolkit
d.js toolkit8mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Syjalo
Syjalo8mo ago
A bigint
Xanthos Prime
Xanthos PrimeOP8mo ago
Forgive my ignorance with DataBase Data storage, is it safe to assume I can store 2 | 4 as a BigInt? Or do I need to use a ForeignKey?
Syjalo
Syjalo8mo ago
| is a bitwise or, which makes 2 | 4 = 6
2 0b010
4 0b100
6 0b110
2 0b010
4 0b100
6 0b110
You save it as 6
Xanthos Prime
Xanthos PrimeOP8mo ago
I feel like such an idiot at the moment. XD The reason is I would have liked to keep the different Flags separated, easier to read when SELECTing in the DB. I'll store the result of the bitwise then. Thank you Magic Wizard!🤩
Want results from more Discord servers?
Add your server