1.0.0 • Published 3 years ago

discord-status v1.0.0

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

discord-status

Easily update your Discord Status !

Installation

With NPM

npm install discord-status

Usage

const discordStatus = require("discord-status");

// New instance of discord-status with a Discord Token
let status = new discordStatus("YOUR_DISCORD_TOKEN");

// Fetch current Discord settings
status.current ()
.then (res => {
    // Check if the request has been passed successfully
    if (res.status === 200) {
        res.json ()
        .then (body => {
            // body is an object that will looks this:
            // { theme, custom_status, guild_folders, status, locale, ...res }
        })
    }
    else {
        // There was an error in the request !
        // do `res.text(console.log)` to show the API output
    }
})

// Update your status with "👀 Hello World !" (and it will expires tomorrow)
status.update({text: "Looking at the sky !", emoji_name: "🌙"})

// You can update only text without updating your current emoji
status.update({text: "i'm sleeping..."})

// or the emoji wihout updating the text
status.update({emoji_name: "🌙"})

// Reset your custom status
status.update(null, new Date())

// You can even do things like this
status.update({text: null})
let text = "Hello World"
for (let i in text) {
    setTimeout(() => {
        status.update({text: text.slice(0, parseInt(i) + 1)})
    }, 200  + (i * 200));
}

Examples

Spotify Lyrics Syncer

With this, you can synchronise the music you're currently listening to in Spotify with your Discord status !

Contribute

All the code is in /src/DiscordStatus.js ~