# djs-settingutils

> This package will allow you to have per-server settings and cache them for easy and efficient use.

Latest version **1.1.1** (published 2020-12-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install djs-settingutils
pnpm add djs-settingutils
yarn add djs-settingutils
bun add djs-settingutils
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2020-12-24 |
| First published | 2020-12-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| Author | wrssmithjr04, wrssmithjr04.netlify.app |
| Maintainers | wrssmithjr04 |

## Links

- npm: https://www.npmjs.com/package/djs-settingutils
- Homepage: https://github.com/wrssmithjr04/djs-settingsUtil#readme
- Issues: https://github.com/wrssmithjr04/djs-settingsUtil/issues
- npm.io page: https://npm.io/package/djs-settingutils

## Dependencies (3)

- [dotenv](https://npm.io/package/dotenv.md) ^8.2.0
- [mongoose](https://npm.io/package/mongoose.md) ^5.11.8
- [discord.js](https://npm.io/package/discord.js.md) ^12.5.1

## Recent versions

- 1.1.1 (latest) — 2020-12-24
- 1.1.0 — 2020-12-22
- 1.0.0 — 2020-12-18

## README

# Description

This is a npm package that can set and sends data to mongodb then caches the settings for efficiency.

## Installation

```node
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

```javascript
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.

---
_Source: https://npm.io/package/djs-settingutils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
