Comments (4)
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
from miyako.
Ah, yes. May I take a look at it?
from miyako.
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:
- With postgresql we relied on the schema to include defaults, so we never do null checks etc and believe that the settings are always available. Since mongodb is dynamic we had to change the idea a little bit, the schema is defined in the code itself. The above class i sent you can see it will try to insert defaults which means we have to tell it the defaults whenever we construct them. So in the client the parts in
this.settings
that doesnew Settings(this, "guilds")
will have to also describe defaults, e.gnew Settings(this, "guilds", { prefix: "default prefix" });
do this for every keys you use to ensure default values. - In
extensions/
members/users/guilds have asettings
getter. It returns defaults if there is no db entry but with mongodb remove that line and usegetDefaults(id)
instead of theget(id) || { ... }
defaults are already given in the db driver so lets use those. - I don't know if i missed anything else, test it out and lemme know if you have any questions.
from miyako.
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!
from miyako.
Related Issues (16)
- UnhandledPromiseRejectionWarning HOT 4
- Framework library HOT 2
- Help HOT 2
- Invite link of ur server HOT 1
- The bot does not respond after a while HOT 5
- num.replace not function v11 to v12 HOT 1
- What is prefix?? HOT 1
- question regarding imgflip api HOT 1
- Rewrite HOT 1
- Unify the command handler code
- welcome and other stuff outdated HOT 4
- Slash Command subcommands
- Database support
- Command cooldowns
- Missing file HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from miyako.