1.1.1 • Published 3 years ago

djs-settingutils v1.1.1

Weekly downloads
3
License
ISC
Repository
-
Last release
3 years ago

Description

This is a npm package that can set and sends data to mongodb then caches the settings for efficiency.

Installation

npm install djs-settingutils

Setup

In the index.js file you will need to use this:

const Discord = require("discord.js")
require("dotenv").config()
const settingUtils = require("djs-settingutils")

const client = new Discord.Client({})

client.on("ready", () => {
	settingUtils.dbInit(process.env.MONGO_URI)
})

client.login(process.env.BOT_TOKEN)

In your .env file (in your project root) you will need to specify the mongo url like this:

MONGO_URI="URL_TO_MONGODB"

Usage

module.exports = async () => {
  const settingUtils = require("djs-settingutils")
  const settingsName = "Name of setting"
  const boolean = "false"
  const string = "Whatever you want here"

  await settingUtils.writeSetting(
    messages.guild.id,
    settingsName,
    boolean,
    string
  )
  const setting = await settingUtils.getSetting(messages.guild.id, settingsName) //This returns an array
  console.log(settings)

  // WILL BE ADDING SUPPORT FOR ADDING YOUR OWN ITEMS TO CACHE SOON!!!
}

Upcoming Features

  • Ability to write directly to the cache
  • Ability to fetch directly from the cache
  • Add Support for postgres
  • Add Support for sql
  • Add Support for sqlite
  • Add Support for mysql

To make feature suggestions @ or dm me on twitter (@Wrssmithjr04)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago