1.1.0 • Published 3 years ago

disdata v1.1.0

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

npm.io

Use Discord like a database

View all documentation

Docs

Table of Contents

Disdata

Disdata

Parameters

  • token
  • dbname (optional, default null)

Examples

const Disdata = require('disdata');
async function main(){
 const db = new Disdata("NzE3NzI2Njgz.x.x.x.ClUADtk")
   await db.login()
   await db.useDB("test")
   // console.log(await db.inviteDB())
   await db.set("hello","World")
   console.log("Hello =>"+await db.get("hello"))
}

login

Parameters

  • BotToken string? Bot token (optional, default this.token)

Returns Promise

newDB

Parameters

  • name string? name of db (optional, default this.dbname)

Returns Promise

useDB

Parameters

  • name string? Name of the DB (optional, default this.dbname)
  • createIfNotExist boolean create database if note exist (optional, default true)

Returns Promise

set

Parameters

  • key string
  • data string (use JSON.stringify for object)
  • editIfAlredyExist boolean edit key if already used (optional, default true)

Returns Promise

edit

Parameters

  • key string
  • data string new data (use JSON.stringify for object)

Returns Promise

get

Parameters

Returns Promise[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) Data of this key

has

Parameters

Returns Promise[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean) Boolean if key exist

delete

Parameters

Returns Promise

inviteDB

Returns Promise[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) URL invitation Discord