Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Api

discord.bots.gg API Client for Posting stats or Fetching data

example
const DBGG = require("dbots.gg")

const Api = new DBGG.Api(client, 'Your discord.bots.gg token')
link

Library docs

link

API Documenation

Hierarchy

  • EventEmitter
    • Api

Index

Constructors

Methods

Constructors

constructor

  • new Api(client: Client<boolean>, token: string): Api
  • Create discord.bots.gg API instance

    Parameters

    • client: Client<boolean>

      Discord Client or options

    • token: string

      Token or options

    Returns Api

Methods

get

  • get(id: BotStats): Promise<BotStats>
  • example
    await Api.get("123456789123456789");
    // =>
    {
      guildCount: 25162,
      shardCount: 1,
      //and other data
    }
    

    Parameters

    • id: BotStats

      Bot Id

    Returns Promise<BotStats>

    Stats of bot requested

post

  • post(stats: BotStats, log: Boolean): Promise<BotStats>
  • Post bot stats to discord.bots.gg

    example
    await Api.post({
      guildCount: 25162,
      shardCount: 1
    }, true); //Change it by false if you want no messages in console
    
    // =>
    `Server count posted on discord.bots.gg for bot: USER#0000 (123456789123456789)`
    

    Parameters

    • stats: BotStats

      Stats object

    • log: Boolean

      Log a message in console when stats are posted

    Returns Promise<BotStats>

    Passed object

search

  • search(results: BotStats): Promise<BotStats>
  • example
    await Api.search("Data", 50, 0);
    // =>
    {
        "count": 1000, // total number of matching bots
        "limit": 50, // the max number of bots to retrieve
        "page": 0, // the current page
        "bots": [
            // Uses the Bot structure
            { Bot }, { Bot }, { Bot }, etc...
        ]
    }
    

    Parameters

    • results: BotStats

      Stats object

    Returns Promise<BotStats>

    Stats of bot requested

Generated using TypeDoc