Unable to get Discord Bot to save Usernames to a txt file on command

Hi so I have recently been attempting to get my Discord Bot to save a User’s name to a txt file, once a user types a specific command. (Such as !joinqueue) I was wondering if anyone would be able to assist me with this?

Why a txt file may i ask?

So i could easily see who is in the queue, if theres another way i could do this that doesnt include a txt file let me know.

1 Like

You should store it in an actual database

3 Likes

Currently it’s a really small bot meant for one server for very specific actions. I don’t think I should store everything in a database for this reason, thank you though. Would like to know if you know how I could still maybe store the names in a txt file or on Google Docs?

As @anon43649539 said, you can use a database such as sqlite and place it on ./data. I would also suggest(if you dont want to use a database) a JSON file to make it easy grabbing data from the file. You need to use FS to write data to any files.

3 Likes

Ok. Don’t use JSON for holding user data especially not txt. They are easily corruptible and you will use data. Use MongoDB, it is free and reliable. It will be more than enough space for your bot.

JSON will not corrupt if handled and edited correctly. Atomically writing to a JSON file is advised to prevent JSON corruption in a persistent environment.

3 Likes