0.0.4 • Published 4 years ago

tdbapi.js v0.0.4

Weekly downloads
2
License
MIT
Repository
-
Last release
4 years ago

The Discord Bots API

A Node.JS module to interact with The Discord Bots API.

Installation

npm install tdbapi.js

Glitch

pnpm install tdbapi.js

Examples

PRO TIP

You can use voted() and fetchBot() functions as synced. All you have to do is add the Sync keyword at the end of function name. Like this: votedSync()

Posting guild count and shard count automatically (Supported Libraries: Discord.JS & Eris)

const Discord   = require("discord.js"),
      client    = new Discord.Client(),
      TDBotsAPI = require('tdbapi.js'),
      TDBots    = new TDBotsAPI('ur token', client);

// Events
TDBots.on('error', console.error)
TDBots.on('post', () => console.log("Guild & shard count posted."))

Posting guild count and shard count manually

const Discord   = require("discord.js"),
      client    = new Discord.Client(),
      TDBotsAPI = require('tdbapi.js'),
      TDBots    = new TDBotsAPI('ur token');

// Events
TDBots.on('error', console.error)
TDBots.on('post', () => console.log("Guild & shard count posted."))

// Posting
client.on('ready', async() => {
  setInterval(() => {
    TDBots.post(client.guilds.cache.size, client.shard.count)
  }, 900000);
})

Checking if the user has voted

const Discord   = require("discord.js"),
      client    = new Discord.Client(),
      TDBotsAPI = require('tdbapi.js'),
      TDBots    = new TDBotsAPI('ur token', client);

// Events
TDBots.on('error', console.error)
TDBots.on('post', () => console.log("Guild & shard count posted."))

client.on('message', async(msg) => {
  const check = await TDBots.voted(msg.author.id)
  if (check) {
    // if voted
  } else {
    // else
  }
})

Get the information of a bot.

const Discord   = require("discord.js"),
      client    = new Discord.Client(),
      TDBotsAPI = require('tdbapi.js'),
      TDBots    = new TDBotsAPI('ur token', client);

// Events
TDBots.on('error', console.error)
TDBots.on('post', () => console.log("Guild & shard count posted."))

client.on('ready', async() => {
  const botInformation = await TDBots.fetchBot("511970030502805521")
  console.log(botInformation) // { owners: [...], prefix: "...", ... }
  return
})
0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago