commando-provider-keyvdeprecated

A Keyv based SettingProvider for the Discord.js Commando framework

Usage no npm install needed!

<script type="module">
  import commandoProviderKeyv from 'https://cdn.skypack.dev/commando-provider-keyv';
</script>

README

Commando Provider Keyv

Build Status

A Keyv based SettingProvider for the Discord.js Commando framework.

Documentation

Back-end Support

  • Redis
  • MongoDB
  • SQLite
  • PostgreSQL
  • MySQL
  • Third-party storage adapters (see Keyv docs)

Usage

In Memory

const { CommandoClient } = require('discord.js-commando');
const Keyv = require('keyv');
const KeyvProvider = require('commando-provider-keyv');

const client = new CommandoClient();

client.setProvider(new KeyvProvider(new Keyv()));

Redis

const { CommandoClient } = require('discord.js-commando');
const Keyv = require('keyv');
const KeyvProvider = require('commando-provider-keyv');

const client = new CommandoClient();

client.setProvider(new KeyvProvider(new Keyv('redis://user:pass@localhost:6379')));

MongoDB

Set the serialize and deserialize functions to do no transformations, since MongoDB can support storing raw JSON.

const { CommandoClient } = require('discord.js-commando');
const Keyv = require('keyv');
const KeyvProvider = require('commando-provider-keyv');

const client = new CommandoClient();

const settings = { serialize: data => data, deserialize: data => data };

client.setProvider(new KeyvProvider(new Keyv('mongodb://user:pass@localhost:27017/dbname', settings)));

SQLite

const { CommandoClient } = require('discord.js-commando');
const Keyv = require('keyv');
const KeyvProvider = require('commando-provider-keyv');

const client = new CommandoClient();

client.setProvider(new KeyvProvider(new Keyv('sqlite://path/to/dbname.sqlite')));

PostgreSQL

const { CommandoClient } = require('discord.js-commando');
const Keyv = require('keyv');
const KeyvProvider = require('commando-provider-keyv');

const client = new CommandoClient();

client.setProvider(new KeyvProvider(new Keyv('postgresql://user:pass@localhost:5432/dbname')));

MySQL

const { CommandoClient } = require('discord.js-commando');
const Keyv = require('keyv');
const KeyvProvider = require('commando-provider-keyv');

const client = new CommandoClient();

client.setProvider(new KeyvProvider(new Keyv('mysql://user:pass@localhost:3306/dbname')));