Premium Collection

So, I'm kind of new, how do I make it so when I run a command that once I put an ID in, it adds a user to a collection. The collection will have multiple user IDs and will allow only those people to use certain commands. My question is, how would I do that.
10 Replies
d.js toolkit
d.js toolkit7mo 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 staff
treble/luna
treble/luna7mo ago
if you want it to persist you would need a db A collection is basically a Map with added methods
coco
coco7mo ago
I want it so it updates a message adding an id and with those ids users can access commands
treble/luna
treble/luna7mo ago
So use .set to set a user, and .get, or .has to check
coco
coco7mo ago
aka I could use a const premium = ['id1,id2'] ahh ok
treble/luna
treble/luna7mo ago
that is an array
coco
coco7mo ago
mhm I want to make it so when I run a /addpremium command and I put an id it adds the user id that I put into the array
treble/luna
treble/luna7mo ago
this is basic js at this point
d.js docs
d.js docs7mo ago
mdn Array.prototype.push() The push() method of Array instances adds the specified elements to the end of an array and returns the new length of the array.
coco
coco7mo ago
I figured it out lol