Giter VIP home page Giter VIP logo

Comments (4)

ravener avatar ravener commented on August 12, 2024

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.

buttermiilk avatar buttermiilk commented on August 12, 2024

Ah, yes. May I take a look at it?

from miyako.

ravener avatar ravener commented on August 12, 2024

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 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.
  • In 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 don't know if i missed anything else, test it out and lemme know if you have any questions.

from miyako.

buttermiilk avatar buttermiilk commented on August 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.