1.2.0 • Published 5 years ago

dbnapi.js v1.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

DiscordBots Nation API(s)

An API Wrapper for DiscordBots Nation API

Documentation

WIP :P

How to install

npm i dbnapi.js --save

Examples

With async/await

const Discord = require("discord.js");
const dbn = require("dbnapi.js");

const bot = new Discord.Client();
const dbn = new discordbotsNats("yOuRdIsCoRdBoTsNaTsApItOkEn", "Your Bot's User ID", "Your IDs");

bot.on("ready", () => console.log("Ready!"));

bot.on("message", async message => {
    var args = message.content.split(" ").replace(".", "");

    if (messsage.content === ".bot") {
        var botData = await dbn.getBot(args[0]);
        if (!botData || botData === undefined) return message.channel.send("Sorry, but that Bot was not registered *yet* on DiscordBots Nation.");
        message.channel.send(`${botData.bot.tag} by ${botData.owner.tag} with Prefix ${botData.prefix}!`);
    }
});

bot.login("yourDiscordBotToken");

With .then() Promises

const Discord = require("discord.js");
const dbn = require("dbnapi.js");

const bot = new Discord.Client();
const dbn = new discordbotsNats("yOuRdIsCoRdBoTsNaTsApItOkEn", "Your Bot's User ID", "Your IDs");

bot.on("ready", () => console.log("Ready!"));

bot.on("message", message => {
    var args = message.content.split(" ").replace(".", "");

    if (messsage.content === ".bot") {
        dbn.getBot(args[0]).then(botData => {
            if (!botData || botData === undefined) return message.channel.send("Sorry, but that Bot was not registered *yet* on DiscordBots Nation.");
            message.channel.send(`${botData.bot.tag} by ${botData.owner.tag} with Prefix ${botData.prefix}!`);
        });
    }
});

bot.login("yourDiscordBotToken");