My knowledge of discord bots is limited, but in JavaScript, writing to the file system is restricted due to security constraints, preventing local storage. To overcome this obstacle without relying on a server for file system writes, using a database is recommended. For example, if your user array looks like:
[
{
username: example,
age : 222,
userId: 1
},
{
username: exampleTwo,
age : 221,
userId: 2
}
]
You can store each key-value pair in a users table within the database:
| Username | age | userId |
| ---------- | ---- | ------ |
| example | 222 | 1 |
| exampleTwo | 221 | 2 |
By setting an autoincrement ID, you ensure that each user is unique.