JSON File Counter
I am trying to make a simple word counter in discord.js I have managed to get the bot counting the specific word i want to be counted but how do i permanently store this data in a JSON file and update it when the bot is active.
26 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!the thing you are looking for is probably a database, and not really djs related
but i am using it for a bot through discord.js
don’t store data in a json file, it’s not a file storage solution
its for a small scale thing
just messing around
It’s slow, prone to failure and slower to write and read than most databases
SQLITE etc are very easy to setup and learn
much quicker and more efficient that json
Okay I will look into it now and see
You can handle processes within an sql db too, for example with a JSON file you have to fetch and filter the whole data, whereas with sql you can grab any data from any any column or row in w few words
SELECT * FROM table WHERE condition
will get you a row of data dtored
depeneds if you want to use SQL or NoSQL though
see i wanted it so when the bot saw the word "example" it would reply saying "this user has said 'example' 4 times" or something
I want to use something lite and easy to setup
nothing to complex
i find mongodb very easy to work with
For something like this use a table then, NoSQL might be difficult to understand
and keep organised
You don’t need to store that though, discord has history as an attribute if you’re only doing stuff locally.
Plus, why make this if discord search enables this anyway?
uhh
bots cannot access search
no but people can
yes but this is about using a bot