DDBL's Docs


Here's the API of the site, you will find the necessary information of the API here.

Endpoints:

POST server_count JavaScript

  • Authorization: "yes"
  • Ratelimit: "1 minute"


        
  const DDBL = require("ddblapi.js");
  const ddbl = new DDBL("xxx"); //Replace xxx to your ddbl's token
    
  ddbl.postStats("bot_id", 0); //Replace "0" to your server_count and "bot_id" to your bot ID

GET stats JavaScript

  • Authorization: "yes"


          
  const DDBL = require("ddblapi.js");
  const ddbl = new DDBL();
    
  ddbl.getStats("bot_id").then((res) => console.log(res)); //Replace "bot_id" to your bot ID

GET votes JavaScript

  • Authorization: "yes"

            
    const DDBL = require("ddblapi.js");
    const ddbl = new DDBL();
      
    ddbl.getVotes("bot_id").then((res) => console.log(res)); //Replace "bot_id" to your bot ID


POST server_count Python

  • Authorization: "yes"
  • Ratelimit: "1 minute"


          
  import asyncio
  import aiohttp
  
  token = 'xxx'
  # discord.py (rewrite) and Python 3.6+
  # Cog example to update divinediscordbots server count
  # You have to replace 'xxx' with your token
  
  class Update: 
  
      def __init__(self, bot):
          self.bot = bot 
          self.session = aiohttp.ClientSession(loop=self.bot.loop) 
  
      async def update(self):
          guild_count = len(self.bot.guilds)
          payload = json.dumps({
          'server_count': guild_count
          })
  
          headers = {
              'authorization': token,
              'content-type': 'application/json'
          }
  
          url = 'https://divinediscordbots.com/bot/{}/stats'.format(self.bot.user.id)
          async with self.session.post(url, data=payload, headers=headers) as resp:
              print('divinediscordbots statistics returned {} for {}'.format(resp.status, payload))
  
      async def on_guild_join(self, guild): 
          await self.update()
  
      async def on_guild_remove(self, guild): 
          await self.update()
  
      async def on_ready(self):
          await self.update()
  
  def setup(bot):
      bot.add_cog(Update(bot))