tdbapi.js
v0.0.4
Published
A Node.JS module to interact with The Discord Bots API.
Downloads
8
Maintainers
Readme
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
})