dsc.js

1.0.5 • Public • Published

Dsc.js

NPM Package Version Size

The official Javascript wrapper for the dsc.gg API

To use this package, you need to create a developer app here and grab the API token. This token is required for all API requests.

Install instructions

Install with NPM

npm install dsc.js

Install with Yarn

yarn install dsc.js


Getting Started

Initilize the dsc.js client

const Link = require("dsc.js");

const client = new Link.Client("Your API token")

Client Functions

Fetch information on a dsc.gg link

var link = await client.fetchLink('link_ending')
console.log(link)

Fetch information on a dsc.gg user

var user = await client.fetchUser('user_id')
console.log(user)

Fetch a dsc.gg user's links

var links = await client.fetchUserLinks('user_id')
console.log(links)

Fetch a dsc.gg user's developer apps

var apps = await client.fetchUserApps('user_id')
console.log(apps)

Fetch information on a dsc.gg developer app

var app = await client.fetchApp('app_id')
console.log(app)

Fetch the top dsc.gg links

var top_links = await client.fetchTopLinks()
console.log(top_links)

Search for dsc.gg links

var results = await client.search('search_query', {
    type: 'bot', //optional - can be bot, server, or template
    limit: 10, //optional - limit the # of results that will be returned
})
console.log(results)

Create a dsc.gg link

var response = await client.createLink({
    link: 'link_ending',
    type: 'server', //this can be server, bot, template or link
    redirect: 'something', //the redirect of the link
    unlisted: false, //true or false
    password: 'some_password', //optional - exclude this for no password
    meta: {
        title: 'some embed title', //optional
        description: 'some embed description', //optional
        image: 'some image url' //optional
    }
})
console.log(response)

Update a dsc.gg link

var response = await client.updateLink({
    link: 'link_ending',
    type: 'server', //this can be server, bot, template or link
    redirect: 'something', //the redirect of the link
    unlisted: false, //true or false
    password: 'some_password', //optional - exclude this for no password
    meta: {
        title: 'some embed title', //optional
        description: 'some embed description', //optional
        image: 'some image url' //optional
    }
})
console.log(response)

Delete a dsc.gg link

var response = await client.deleteLink('link_ending')
console.log(response)

Full Example

Search for links from a given input

const Link = require("dsc.js");

const client = new Link.Client("Your API token")

var input = 'gaming'

var results = await client.search(input, {
    type: 'server',
    limit: 10
})
console.log(results[0])

Package Sidebar

Install

npm i dsc.js

Weekly Downloads

5

Version

1.0.5

License

ISC

Unpacked Size

12.9 kB

Total Files

5

Last publish

Collaborators

  • colecci