Closed buttermiilk closed 4 years ago
There isn't a direct way to change it but nothing stops you from changing the code. The main database driver is in structures/Settings.js
then the connection logic is in structures/MiyakoClient.js
other than that if the settings class is properly implemented the rest of the code should work as it does not directly touch the database. Let me know which database you are using. I've let my friend use the base framework of my bot except he wanted to use mongodb so I do have a mongodb implementation ready if you are interested
Ah, yes. May I take a look at it?
Here you go: https://hastebin.com/foqelubaqu.js
Add that to structures/Settings.js
Then edit the client to connect a mongodb
database and define it on client.db
Few major notes:
this.settings
that does new Settings(this, "guilds")
will have to also describe defaults, e.g new Settings(this, "guilds", { prefix: "default prefix" });
do this for every keys you use to ensure default values.extensions/
members/users/guilds have a settings
getter. It returns defaults if there is no db entry but with mongodb remove that line and use getDefaults(id)
instead of the get(id) || { ... }
defaults are already given in the db driver so lets use those.I spent a few hours to get this work, and it did, but I think PostgreSQL does the job better than MongoDB a little bit. Thanks for the help!
So um, are there anyway to change from PostgreSQL to something else? I feel like PostgreSQL isn't an option for me, and I would really appreciate it if there is a method for that.
Oh, if you can, may I ask for a list of stuff that I need to rewrite? Thanks.