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
- 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 staffif you want it to persist you would need a db
A collection is basically a Map with added methods
I want it so it updates a message adding an id
and with those ids users can access commands
So use .set to set a user, and .get, or .has to check
aka I could use a const premium = ['id1,id2']
ahh ok
that is an array
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
this is basic js at this point
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.
I figured it out lol