#topgg-api

1 messages · Page 40 of 1

half delta
#

just track the IPs that do it

#

that appear to scrape

junior goblet
#

why not just introduce heavier ratelimits instead of auth tonk

#

and can you actually answer me

#

do you have me blocked

arctic arch
#

yes but IP bans arent effective so we're going deeper, because you need a bot for a token...

half delta
#

oh i get it

arctic arch
#

stricter ratelimits arent too helpful

restive otter
#

bot owners only monkashake

half delta
#

yeah i see why you want to do it now

#

confused me at first lol

junior goblet
#

yep same

#

thank you T🎃nk

sonic jacinth
#

also @arctic arch another question, can we publish a bot that will take cryptos as payment for services, but it will also have some free features / vote features

raven zinc
#

then again now people will just scrape instead of using the api

#

that like won't change anything ThinkRaging

arctic arch
#

@raven zinc I dont see why that would happen?

glass maple
#

tonk

raven zinc
#

for the same reason they use the api in the first place?

dreamy agate
#

umm, nothing changes for the people that are using webhook to get their votes, correct?

junior goblet
#

because this api sucks so im making my own one hahaYes

#

is that allowed

#

is no scraping actually in the rules

plain timber
#

Tonkku will adding the auth token change anything related to ratelimits?

glass maple
#

same

solemn knot
#

How about that certifacation program, eh?

glass maple
#

ew it’s the dbm guy

solemn knot
#

ew luna

plain timber
#

@dreamy agate yeah those aren't api requests

arctic arch
#

@dreamy agate correct
@plain timber it wont

glass maple
#

Spookku

plain timber
#

So will it change anything at all for us?

arctic arch
#

us who?

safe spade
#

Before I give my judgement
If a bot token is refreshed, does the Discord websocket server automatically disconnect any bots using that token?
And if authorization headers are used for endpoints, would this mean a RESTful API would be added as a secondary option apart from using websockets?

plain timber
#

Wut

#

Why are you talking about the discord api

glass maple
#

coz he dumb

plain timber
#

The announcement is for the dbl api

safe spade
#

That's what I assumed it was about

#

Oof okay

#

Disregard my message

plain timber
#

Why would they announce something about the discord api here

safe spade
#

I mean, it would make sense to

plain timber
#

That would be in the discord api servers

#

Tonkku isn't even discord staff

arctic arch
glass maple
#

This isn’t an official discord server @safe spade

safe spade
#

Yeah I'm already in that

glass maple
#

well ask there

safe spade
#

Probably doesn't help that I'm still waking up so yeah just disregard my previous messages

restive otter
#

hmm

worn belfry
#

boo

#

booo

#

i don feel like changing everything angery

wary ether
#

I'm guessing the rates were too much to handle huh 😉

restive otter
#

when you say a valid authorization token is that something we already have from when we started our bots on the list?

arctic arch
#

yes

restive otter
#

ok cool thanks T

normal quail
#

oof token as in discord token or you guys are generating tokens for us to also store in our bots

#

im betting on #2

molten geyser
#

oop

#

number 2 lol

normal quail
#

k thanks lol

molten crystal
#

I was going to say. I don’t think they would want us to give them our token

#

I don’t think we’d want them to want that

normal quail
#

yeah major security issue

molten geyser
#

auth token basically just means they 100% confirm every api call is done by your bot and your bot only

normal quail
#

yeah were calls coming from other bots and flooding the server

#

no not flooding the server

#

drowning the api in requests

misty scroll
#

@arctic arch wdym by authorization token

arctic arch
#

the token you get from our api docs

misty scroll
#

oh that one

#

thanks

cyan ruin
#

ay yo @arctic arch u betta not do that or me and my mandem will fok u right up ye we'll shank ya

bronze swift
#

Aye... what if you don’t use the discordbotlist api @arctic arch

cyan ruin
#

bruv

bronze swift
#

what

cyan ruin
#

u use it all the time just by visiting site ye

bronze swift
#

Whaaa

#

What do you even mean

#

There is a downloadable api which shows your server number thingy on @abstract moth @cyan ruin

#

i thought they meant that

cyan ruin
#

downloadable api ting?

#

ya what m8

bronze swift
#

The npm api budd

cyan ruin
#

yo i'm a sick dev ye i use foking node-superfetch

bronze swift
#

That doesn’t make any sense but okay

#

Oh well nvm there is the website api too

#

MAHHHH shh

cyan ruin
bronze swift
#

anyhow what do we do with the token

cyan ruin
#

you set it in auth header

#

and then continue as normal

bronze swift
#

Auth header?

cyan ruin
bronze swift
#

Hmmm?

cyan ruin
#

do you use the official module or do you using something like snekfetch

bronze swift
#

OwO

cyan ruin
#

i see

bronze swift
#

I have no idea what you wven talking about really sorryyy

cyan ruin
#

i mean

#

how do you use api rn

#

oh wait i didn't see above

bronze swift
#

I don’t even use it really

cyan ruin
#

fucking hell i gotta sleep

#

but it's only 17:34

bronze swift
#

take a quick nap xD

sudden rampart
#

if you dont use the api or just post server counts, you can safely ignore the announcement

#

nothing will change for you

bronze swift
#

That’s what i was asking “what if you don’t even use the api”

cyan ruin
#

ohh

#

i see

bronze swift
#

Alright so I don’t really do anything

#

phew

solemn knot
#

You know what'd be fun? Certification.

restive otter
#

Can someone run me through using dblpy to check who Upvotes my Bot (discord.py)?
Please I really need a quick guide on it...
Thanks..

#

DM me if so 😄

tiny nebula
#

Yeah how about we just write you your whole bot?

lucid vale
#

this API change is fine and i have no objections

lunar tide
#

does the announcement incloud webhooks

arctic arch
#

only the REST API

restive otter
#

so, /bots and /users are going to require a DBL token to use?

#

and you have to have a whitelisted bot on the site to get a token, correct?

arctic arch
#

correct

tidal burrow
#

what's the main reason behind it?

grand plaza
#

I guess they got to many requests.

lucid vale
#

because why would you want to call the API if your bot has no assiciation with dbl, i.e. being on the site

sudden rampart
#

@tidal burrow scraping

plain timber
#

Usually scraping means getting data from a non-api page

arctic arch
#

yeah thats what scraping is, just dont know a better word for api scraping

elfin solstice
#

thing is even tho you make the api token locked you still can api scrape it Thonk and even if you limit it to like idk 1 request a minute at this endpoints its only taking ~10 request to get all data

#

and if you completely remove it you can still scrape from the html site if you know how to parse it

arctic arch
#

we can track down malicious scrapers and ban them
cloudflare should have protection against html scraping, if it doesn't im gonna be angery
anyway its more effort to scrape the html

elfin solstice
#

you can't 100% block html scraping anyway

#

how do you wanna see the difference between a normal user and a bot?

#

if i slow my request speed to like 1 request / 2s down you won't be able to block it

#

and html scraping is still easy af in most langs

arctic arch
#

idk what cloudflare does but apparently it works so idk

elfin solstice
#

95% sure i would still be able to scrape it

#

literally copy/paste the headers browser send and you should be able to scrape, delay the request speed to a normal user speed and easy

sudden rampart
#

100% avoiding scrape isn't possible

#

but you can make it hard enough that most give up

elfin solstice
#

but i mean you said you wanna discontinue it without a token in 1 month you could still scrape it in the meantime

lucid vale
#

why do scrapers make you angery'

arctic arch
#

gotta give users a heads up tho

sudden rampart
#

there was a site that fully copied all bots

#

for example

elfin solstice
#

there was one site scraping dbl and putting it on there own shop site

lucid vale
#

why in the fresh hell would you want to do that lul

elfin solstice
#

its a shit site tho

lucid vale
#

like are we talking geocities level shit?

restive otter
#

🤔

proven garnet
#

👎

shell token
#

ok

severe iron
#

wrong channel

humble hare
#

oh sorry, can you say me the right channel?

severe iron
#

can you guess which one it is?

humble hare
severe iron
#

winner winner chicken dinner

humble hare
#

okay thx

neat bolt
#
const Discord = require('discord.js');

module.exports = function(req, res, bot){
 
  
    if(req.headers.authorization===process.env.DBL_TOKEN){
  
       let user = req.body.user
   
        if(bot.users.get(user)){
            let embed = new Discord.RichEmbed()
            .setColor('#AABBED')
            .setTitle('Thank you for voting, ' + bot.users.get(user).tag + '!')
           
            bot.users.get(user).send(embed).catch((err)=>{});
        }

    }
}
#

I need some help, im trying to make an upvote webhook and i get one error
it says user is undefined
so i did console.log(req.body) and all i got was {}
Can some one help me?

grand smelt
#

hmm

#

valid authorization token?

#

is that just the token you're using has to be valid?

polar mirage
#

It just means you need a token to use the dbl api

#

For most people, nothing will change..

neat bolt
#

i have a valid auth token

restive otter
restive otter
#

reconnect your internet or reboot your pc

topaz wyvern
#

what

#

no

restive otter
#

would that work

neat bolt
#

can someone help me?

restive otter
#

on what

neat bolt
#

let user = req.body.user
im trying to make an webhook and user is undefined

restive otter
#

dm me i will do it

lunar tide
#

its in json format

#

the vote responce

restive otter
#

dm me the server invite

neat bolt
#

ah

#

so what do i do?

lunar tide
#

the docs are nice

neat bolt
#

i know

#

But i dont understand how to get the users ID

lunar tide
#

in the json responce it gives the user id

shut ibex
#

are you using express

#

@neat bolt

neat bolt
#

yes

shut ibex
#

did you pass body-parser

lunar tide
#

the vote has its own webhook you can use

shut ibex
#

as middleware

neat bolt
#

yes

shut ibex
#

you did this right

app.use(bodyParser.json())
neat bolt
#

oh

#
    extended: true
}));```
#

So whats that for?

shut ibex
#

application/x-www-form-urlencoded

neat bolt
#

ah

shut ibex
#

thats what the urlenconded is

neat bolt
#

thxs

#

I got it working

shut ibex
#

ok

#

np

modest cobalt
#

nobody care

tough stream
#

wait what does thonkuu mean to "require a valid authorization token" for every api request? doesn't the code need the token to check what account to retreive stuff from anyway?

shut ibex
#

every api request will require you to set an authorization header

plain timber
#

@tough stream most api endpoints dont need auth tokens currently

obtuse flicker
#

but your npm package for the lib will be updated right...

still siren
#

Um can anyone help me when I am trying to get it bot on my main account servers it keeps logging me into my alt accounts and I don't know how to change it to my main

tough stream
#

change your token @still siren

arctic arch
#

@obtuse flicker yes, it will be updated

plain timber
#

@still siren go to discord in your browser and log out, also this isn't the channel for that

storm zephyr
#
  setInterval(function() {
    console.log('Server count posted!', { type: "PLAYING"});
}, 1000)
})```
#

is this thing exist?

smoky trench
#

that will make a new interval to log "server counted posted!" and the object {type:"PLAYING"} to console each time that event fires

#

pretty sure thats not what you want, what are you trying to do?

storm zephyr
#

oops

#
dbl.on('posted', () => {
  setInterval(function() {
    console.log('Server count posted!')
}, 1000)
})```
#

this

#

@smoky trench i want dbl to automatically

#

update

#

the server count

smoky trench
#

that will still make a new interval each time the event is posted, each second it will log that message

#

that wont update the server count

storm zephyr
#

so how do i do that?

#
    console.log("bot.on loaded");
    console.log(`Connected in ${bot.guilds.size} servers`);
    bot.user.setStatus('online')
    setInterval(function() {
      bot.user.setActivity(`?help | ${bot.guilds.size} Servers`, { type: "PLAYING"})
  }, 1000)
});``` i do this for bot status but no idea for dbl api
elder anvil
#

The interval for changing your playing message is too high.

#

Set it to something like 300000ms (5 minutes)

storm zephyr
#

@elder anvil thats intentionally i will use that for now

#

did u mean the bot statu

#

s

elder anvil
#

yes

storm zephyr
#

or dbl api?

elder anvil
#

bot status

storm zephyr
#

oh for the bot status its intentionally

#

ill use it fo rnow

elder anvil
#

Um okay... you might get rate limited though

storm zephyr
#
  setInterval(function() {
    console.log('Server count posted!')
}, 1000)
})```
#

but i want this dbl api

#

to refresh

#

server count automatically

elder anvil
#

Your problem there is that once the server count is posted, it says a log every 1 second

storm zephyr
#

how do i do that

#

so how do i fix it?

#

setinterval(posted)?

#

or something

elder anvil
#
setInterval(() => {
        dblClient.postStats(client.guilds.size);
}, 900000);
storm zephyr
#

ohh

#

lemme try

#

what u mean rate limit tho

elder anvil
#

Rate limiting is where it stops you from sending requests to do stuff too quickly

storm zephyr
#

ohh

elder anvil
#

So Discord basically says: "woah hey there, you're trying to change your playing message too quickly"

storm zephyr
#

its like having 2000 ppl add my bot

#

in 5 sec

#

and that will happen?

elder anvil
#

well no, its just basically what happens

#

it will just stop you from sending requests for a few seconds

storm zephyr
#

oh now i understand

elder anvil
#

just don't make the timeout too quick

storm zephyr
#

ok!

#

thanks tho

elder anvil
#

also you should add dblClient.postStats(client.guilds.size); as a seperate line in your bot's ready event

storm zephyr
#

So Discord basically says: "woah hey there, you're trying to change your playing message too quickly"

#

wait

elder anvil
#

that was an exaduration

storm zephyr
#
    ^

ReferenceError: dblClient is not defined```
#

i mean this

elder anvil
#

what is your DBLClient defined as in your code?

storm zephyr
#

nothing

#

rip

#

what should i defined it then

#

i dont know bout htis api

elder anvil
#
const DBL = require('dblapi.js'); /* <-- Run npm install dblapi.js to install this if you haven't */
const dblClient = new DBL('Your DBL token')
storm zephyr
#

i run that npm

elder anvil
#

Ok good.

#

just make sure you have dblClient.postStats(client.guilds.size); in your ready event so your bot posts the count to DBL when your bot starts, and not after the interval time. otherwise you'll be waiting too long.

arctic arch
#

you could just include client here const dblClient = new DBL('Your DBL token', client) and the module will handle it for you

elder anvil
#

or that

#

I didn't even know that was a thing

#

awesome thanks.

storm zephyr
#
  console.log("Server count posted!")
setInterval(() => {
  dblClient.postStats(client.guilds.size);
}, 900000);
})```
#

am i right?

#

i think im wrong

#

xD

elder anvil
#

You're gonna want that interval outside of the dbl.on('posted')

#
dbl.on('posted', () => {
  console.log("Server count posted!")
});

setInterval(() => {
  dblClient.postStats(client.guilds.size);
}, 900000);
#

like that ^

storm zephyr
#
  console.log("Server count posted!")
})

setInterval(() => {
  dblClient.postStats(client.guilds.size);
}, 900000);```
#

oh u posted it

elder anvil
#

yes

storm zephyr
#

look similar

#

90000 mean 3 min?

#

i mean

#

1 min 30 sec

elder anvil
#

You'll want 900000 Nine hundred thousand

#

which is 15 minutes

storm zephyr
#

is this

#

has rate limit too?

elder anvil
#

@arctic arch What is the rate limit for DBL?

arctic arch
storm zephyr
#

60?

#

is 1 min enough?

elder anvil
#

Oh you should be fine with 1 min

#

yeah

#

My dumbass thought it was 15 minutes ffs

storm zephyr
#

so it would be 6000

#

xd

#

am i right?

elder anvil
#

60000*

storm zephyr
#

ohh kk

elder anvil
#

6,000 = 6 seconds

storm zephyr
#

xd

#

im a bit retarded

#

xd

#

so now everything should be fine right

elder anvil
#

probably

#

test it

storm zephyr
#

yea its fine

elder anvil
#

awesome

storm zephyr
#

thanks for helping me ❤

elder anvil
#

no problemo

storm zephyr
#

tonkku how toget verify bot developer?

#

@arctic arch

arctic arch
#

?

mighty glacier
#

I'm trying to connect Dbl API with my bot using python but I'm getting this error ````AtrributeError: module 'dbl' has no attribute 'Client'```

restive otter
#

ok

tidal burrow
#

and it contains sensitive information @박재형#5450

#

nice

#

someone delete his message

topaz wyvern
#

@plush totem that file contains a token apparently

tidal burrow
#

that file is also a copypaste of itself 4 times

restive otter
#

also i like how the js file doesn't even have actual javascript code

#

@short pumice sir your token

primal owl
#

did they just leave

restive otter
#

yes

primal owl
#

Whenever I try to test my webhook from my bot's edit page, it never sends a request. Whenever I post to the endpoint I'm giving it, it works. What's wrong?

#

I would say that if you guys are using Node.js in the backend then their hardcoded list of ssl cert providers doesn't include Let's Encrypt X3.

#

And therefore it would never send the request because it's unauthorized.

restive otter
#

It would be nice if you could allow ALL providers except for maybe self-signed

#

(and for symantec)

#

Just adding let's encrypt to it doesn't solve it entirely

#

or find a newer list

#

oh wait my bad

#

hardcoded
😓

arctic arch
#

pretty sure letsencrypt works

primal owl
#

No, I'm saying that whenever they post to my url, that my url is using Let's Encrypt X3 ssl, and that if they are using Node.js in their backend, which they might not be, the hardcoded list does not include Let's Encrypt X3 so their request won't go through on their end.

restive otter
#

ah

#

hmm
user reports bug
tonka: pretty sure it works

arctic arch
#

I use letsencrypt so

restive otter
#

does the test webhook send client-side?

primal owl
#

no

restive otter
#

o

#

no clue then sorry

primal owl
#

And no, I had to disable rejectUnauthorized on my https agent in Node.js to be able to send requests to my API because let's encrypt isn't in the hardcoded list.

arctic arch
#

yup

#

I tried

restive otter
#

use axios kthx

#

ok I'll stop shitposting bye

primal owl
#

Doesn't seem to work whenever I test it, but whenever I post to it manually it does.

arctic arch
#

have you saved before testing

primal owl
#

Yes

#

No extra internet traffic comes to my API at all.

#
export async function DBLRoutes (app: Application) {
  app.post('/api/dbl/webhook', (req, res) => {
    const sentCode = req.get('Authorization')

    if (sentCode !== code) {
      res.statusCode = 401
      return res.send('Unauthorized.')
    }

    console.log(req.body)
    res.send('Done')
  })
}```
arctic arch
#

press test now

primal owl
#

Nothing

arctic arch
#

request failed with no response code

primal owl
#

Weird

#

You do post to it, right?

shut ibex
#

Do you need the port in the url

primal owl
#

Yes

shut ibex
primal owl
#

8000 is the port my api runs on

shut ibex
#

Yes but can you use nginx or Apache and stuff like that

primal owl
#

I can literally copy and paste that url into postman and it works

#

No, my API is run with node.js

#

And since apache runs on 80, I can't make it run on 80. Anyways, not my point. The port shouldn't be causing the problem.

#

(443)

arctic arch
#

I think

#

hold on

#

it might be invalid because of the port?

#

Error: unable to verify the first certificate

#

while mine works

#

yeah

#

when I remove the port the cert is valid

#

also

#

you route your port 8000 via apache's 80

#

that's why apache exists

primal owl
#

Either way, I'm wondering why the port invalidates it.

arctic arch
#

Node's handler might be fucked

#

while browsers have them more advanced

#

could be worth looking into filing an issue to the node repo

primal owl
#

Yeah maybe

#

Because an ssl cert covers all ports

#

Well redirecting ports wouldn't do much in this case, because you're still on port 8000

arctic arch
primal owl
#

Okay I'm obviously not very good with apache, so if you know something that I don't it would be much appreciated

arctic arch
#

I'm not good with apache either but I do know nginx

primal owl
#
<VirtualHost *:443>
DocumentRoot   /var/www/html
ServerName     www.macho.ninja
SSLEngine      on
Include     /etc/letsencrypt/options-ssl-apache.conf
ServerAlias macho.ninja
SSLCertificateFile /etc/letsencrypt/live/www.macho.ninja/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.macho.ninja/privkey.pem

ProxyPass "/api"  "https://www.macho.ninja:8000/api"
ProxyPassReverse "/api"  "https://www.macho.ninja:8000/api"
</VirtualHost>```

epic
arctic arch
#

I think you should proxy those to localhost

primal owl
#

Nope, didn't work

arctic arch
#

got more info tho?

primal owl
#

AH01144: No protocol handler was valid for the URL /api. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

light crag
#

@primal owl <VirtualHost *:80> ServerName URL ProxyPreserveHost on ProxyPass / http://localhost:PORT/ </VirtualHost> This should work

primal owl
#
<Location "/api/">
    ProxyPass "https://localhost:8000/api/"
</Location>```
I am using this. It is inside of my virtualhost thing
#

I did it

#

Finally, it worked.

#

Thanks tons @arctic arch

#
SSLProxyEngine on
SSLProxyVerify none 
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off

ProxyPass "/api/"  "https://localhost:8000/api/"```

for anyone else that has my problem i guess
storm zephyr
#

is it possible for me to make my bot

#

to send user that upvote my bot

#

to my channel

#

not into console

#
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

i got this rn

plain timber
#

Yes, just run any code there where the console.log is

storm zephyr
#

@plain timber like htis? dbl.webhook.on('vote', vote => { console.log(`User with ID ${vote.user} just voted!`); dblClient.channels.get("498051419648163851").send(`User with ID ${vote.user} just voted!`) });

#

tonkku help me

plain timber
#

Yeah assuming dblClient is your client

storm zephyr
#

what ${hook.hostname}${hook.port}{hook.path} this thing mean?

jolly leaf
#

Why when I point to https://discordbots.org/api/votes it returns me an error 404?

azure pollen
#

because there's nothing there?

jolly leaf
#

The /votes endpoint for your bot (the one you use via getVotes) only indexes the last 1000 votes. 🤔

#

Do I miss something?

azure pollen
jolly leaf
#

Okay I missed something

#

thanks

storm zephyr
#

what ${hook.hostname}${hook.port}{hook.path} this thing mean?

azure pollen
#

it's self explanatory

#

that is the string where the webhook hostname, port and path is provided

storm zephyr
#

should i change it?

#

or no

azure pollen
#

duh

#

actually depends on what you're doing exactly

#

looks like that's automatically generated by dblapi.js so i don't think you need to change that at all

#

that's just confirmation that the webhook is listening, right @arctic arch ?

arctic arch
#

yeah its just information for your eyes

azure pollen
#

ez

storm zephyr
#

webhookPort: 5000, webhookAuth: 'password' }); what should i replace the password with how can i get the webhookauth

azure pollen
#

just generate some random password only you know ¯_(ツ)_/¯

storm zephyr
#

ok

#
  console.log(`User with ID ${vote.user} just voted!`);
  dblClient.channels.get("498051419648163851").send(`User with ID ${vote.user} just voted!`)
});``` am i right?
storm zephyr
#

plz i need someone to help with this dbl api

#

i know nothing

#

goddamn

vital anvil
#

fucc

#

do i have to update the .net lib now?

#

oh wait

#

I can just yell at people to use AuthDblApi

storm zephyr
#

rip

#

noone want to help me

restive otter
#

?

restive otter
topaz wyvern
#

is the bot in this server

#

its not

#

so uh

#

thats why

restive otter
#

and how do it get here?

arctic arch
#

@restive otter you've made your bot leave this server. You can ask a mod to invite it back

restive otter
#

huh, how did i made that?

quick trellis
#

why dosent it post the server amount to the public only when im logged in???

tidal burrow
#

there's no such thing as posting to public or not, it's most likelly a bug then?

quick trellis
#

i guess so

#

it works not

#

"REALLY SLOw"

restive otter
#

what are you using to post it to the website

plain timber
#

its probably just the cache

#

@restive otter only dblapi.js is supported, not dbl.js

fringe epoch
#
#Importing libraries 
import discord
from discord.ext import commands

import dbl
import time
import random
import pickle
import re

import aiohttp
import asyncio
import logging

class DiscordBotsOrgAPI:
    """Handles interactions with the discordbots.org API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = 'HIDDEN NOW'  #  set this to your DBL token
        self.dblpy = dbl.Client(self.bot, self.token)
        self.bot.loop.create_task(self.update_stats())

    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""

        while True:
            logger.info('attempting to post server count')
            try:
                await self.dblpy.post_server_count()
                logger.info('posted server count ({})'.format(len(self.bot.guilds)))
            except Exception as e:
                logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
            print("updated")
            await asyncio.sleep(300)


def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(DiscordBotsOrgAPI(bot))

Dear ppl, I have python and I copy pasted the example.
I have my bot running for 2 days with it now.
But it doesn't update.
Is there something else I have to do? Except copy paste the example to update the server count (it now is NA)

#

Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Traceback (most recent call last):
File "/Users/Zl109819/Documents/PythonBot/Bot.py", line 167, in update_stats
await self.dblpy.post_server_count()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dbl/client.py", line 100, in post_server_count
await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dbl/http.py", line 189, in post_server_count
await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/dbl/http.py", line 160, in request
raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}"

#

How to solve this

plain timber
#

@fringe epoch 403 is usually wrong token

shut ibex
#

you are setting your dbl token right?

#

not bot token

fringe epoch
#

I did

#

The dbl token

#

Well you can check, I just regen one

#

self.token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjQ1ODQwNDkyMDk3MDk2OTA5OCIsImJvdCI6dHJ1ZSwiaWF0IjoxNTM4NzM5ODkxfQ.lAMK4Vh_T5xPDNQzrjZ8D3JtnK9ixcjPhER2eHvsv2w' # set this to your DBL token

restive otter
#

ok

#

so uh

#

you should probs delete that

fringe epoch
#

Nah

#

No

#

I just need answer

#

That's all

restive otter
#

you did regen that didn't you

arctic arch
#

is the id of the bot the same as the id of the bot the token is for

#

@shut ibex if it was bot token they'd get 401 unauthorized

shut ibex
#

huh?

#

o

fringe epoch
#

Of course I said I would regen it

arctic arch
dusky rampart
#

oh

restive otter
#

restive otter
#

@rough wharf

restive otter
fringe epoch
#

@arctic arch "is the id of the bot the same as the id of the bot the token is for" yes it is, it is a other program but it uses the same token so the same Discord bot + id in fact. Sorry for the late answer.

vital anvil
#

.NET api is up to date again on nuget

formal dawn
#

hi

silent perch
#

When i try to send my shard total to the dbl site it errors with Im using discord.js TypeError: Cannot read property 'total' of undefined

plain timber
#

@silent perch show your code

#

@restive otter whats the issue?

silent perch
#
    setInterval(() => {
        dbl.postStats(bot.guilds.size, bot.shards.total);
    }, 1800000);
})``` and when i add the ID part it breaks.
loud gulch
#

are you sharding?

topaz wyvern
#

i guess we should ask first

silent perch
#

Yes

topaz wyvern
#

yea

#

uh

loud gulch
#

looks like ur not

silent perch
#

well i am.

loud gulch
#

what version do you have

silent perch
#

Of?

loud gulch
#

discord.js

#

wait no

#

ik

silent perch
#

discord.js@11.4.0

loud gulch
#

its shard not shards

silent perch
#

Really?

loud gulch
#

looking at the docs its shard

#

d.js docs

topaz wyvern
#

dbl docs are probably outdated a bit

loud gulch
#

oh they are

silent perch
#

it worked so idk

loud gulch
restive otter
plucky ingot
#

uh

#

i just ran my shard

#

and i had 4 shards with 7 guilds and 1 shard with 6 guilds

polar mirage
restive otter
#

You must be kidding

#

4 shards with 7 guilds is ridiculous and laughable.

night obsidian
#

I got issue with the server count on the web site. It only displays servercount from the latest shard which update the value (in python, I give shardcount and shardno to the function post_server_count but it seems it does not care about it).

fading kraken
#

is there any issues with vote webhooks atm?

#

nvm, was issue on my end

grizzled agate
#

hello can anybody please explain to me how to use the api as all my bots have N/A on them

plain timber
#

What's the best way to post shard stuff using internal sharding?

#

And @grizzled agate what language

grizzled agate
#

discord.js @plain timber

plain timber
plain timber
#

quick question about the API

#

if i send something for ex shards in one request

#

then i send something like server count in another request

#

will the second overwrite the first one or will it keep the data from both

humble bison
#

i think keep both

arctic arch
#

so you're sending {server_count:1337} and then {shards:[420, 69]}?

plain timber
#

yeah would that work

#

well

#

actually i was gonna send server_count then shard_count

#

im using internal sharding so i can just get client.guilds.size and client.ws.shards.length

arctic arch
#

the latter request replaces server_count with the sum of all shards

plain timber
#

what about shard_count

arctic arch
#

you need server_count in a request with shard_count

plain timber
#

oh ok

#

so in that case server_count is the total count right

arctic arch
#

yes

plain timber
#

if i use dblapi.js should I use the poststats function and set shardid to null?

arctic arch
#

yes

plain timber
#

k looks like it works 👍🏾

copper vapor
#

I am confused when I am trying to setup the api for my bot what do I put in the client section of const dbl = new DBL("dbl token", client)

#

nvm

restive otter
#

how to i check if bot is certified

#

with dblapi.js

arctic arch
#

getBot(id).then(bot => console.log(bot.certifiedBot))

restive otter
#

Owo ty

restive otter
#

With node-fetch I do .certifiedBot but it isn’t working

arctic arch
#

show code

solemn knot
#

Open modules and show code pls

elfin solstice
#

is the webhook down?

#

it doesn't register either votes or test requests for me anymore

#

and the bot was running for 4 days now

#

👀

#

just tried and seems like its aswell for other bots

#

@arctic arch peepodetective

arctic arch
#

fixed

elfin solstice
#

thank you 02heart

#

does it resume the votes we got but not recieved via webhook aswell Tonkku?

#

doesn't seem like so

vital thistle
#

Pf smh

#

@silent perch took my bots source code

#

@latent flume

#

Mans locked me out of the server it's running on

plain timber
#

@vital thistle go to a different channel

vital thistle
#

oh mb

restive otter
#

webhooks broken again?

proud sphinx
#

@elfin solstice do you think they will do it like Google push notification GWqlabsKek

grizzled agate
#

mmm ok im here now

plain timber
grizzled agate
#

i have that @plain timber all i wanna know id must i use the whole code or just some part of it

grand plaza
#

Just read it slowly... @grizzled agate

plain timber
#

Use the first example

grand plaza
#

48 tabs, that's lotta porn my boi

plain timber
#

Lol 48 is nothing [and no it's not porn]

grizzled agate
#

i did use that @plain timber

plain timber
#

And?

grizzled agate
#

there is the whole thing

#

maby im dum or something but it doesnt want to work 😦

plain timber
#

DUDE THAT HAS YOUR API TOKEN

grizzled agate
#

ok but isnt it supposed to be there ?

plain timber
#

Don't post it publicly, that's like your password 🤦🏾‍♂️

#

Also did you wait an hour?

grizzled agate
#

well i can regen it

#

yes i did it has been there for 24/hours 😦

wintry leaf
#

it not letting me click generate.

restive otter
wintry leaf
#

ye it is not letting me press generate token

restive otter
#

Getting voted: 0 even for people that have upvoted

arctic arch
#

try removing the / at the end

restive otter
#

okay

#

DOPE

#

ty

#

tysmmm <3

restive otter
#

@arctic arch webhooks broken rn?

arctic arch
#

they're working

restive otter
muted pecan
#

a

#

^a

#

^help

grizzled agate
#

@arctic arch sorry for the ping just want to ask must i place the api in my index.js or ready.js as i have both and also i have created a dblapi.js also for it and still it doesnt want to show 😢

tidal parcel
#
Oops! Error: 401 Unauthorized

Wtf

grizzled agate
grand plaza
#

@grizzled agate snekfetch is outdated tho

grizzled agate
#

ok any otherway for me to use them ? @grand plaza

#

i did try dblapi also and still not same with superagent

#

thats why im asking do i need to place them in my index.js or ready.js or dblapi.js

grand plaza
#

I use superagent

#

You can also use request

grizzled agate
#

what do you meen with request ?

grand plaza
#

It's a package on npm

grizzled agate
#

ok link maby please

grand plaza
grizzled agate
#

thank you will try that now and hopefully it will work 😦

shut ibex
#

or you can use the base node.js http bus driver

primal owl
#

Although that's harder than using than the libs most of the time

#

I only use that when I really want to have as little deps as possible

plain timber
#

@grizzled agate Try logging something at the top of that file to make sure the code is running

restive otter
#

Not working

grizzled agate
#

what do you meen @plain timber ?

#

sorry for the late reply was having fun with clan in pubg xD

restive otter
#

What is the variable for the bot owner’s ID ?

summer osprey
#

Quick question if I am making a get request what do I put before this to get the request?
/bots/{bot.id}

humble bison
summer osprey
#

Thanks

plain timber
#

@grizzled agate at the top of the file put something like console.log('DBL script running!') and start your bot, if it doesnt log that it means its not running that file and you need to make sure you're running it

brisk torrent
#

how do i get get upvotes count on botlist?

plain timber
#

what language

brisk torrent
#

js

#

nodejs

plain timber
brisk torrent
#

tnx

plain timber
#

yw

#

in the bot object, points is total votes and monthlyPoints is votes in the current month @brisk torrent

brisk torrent
#

i found it

plain timber
#

k

summer osprey
#
const request = require('node-superfetch');

try {
    const { body } = await request.get(`https://discordbots.org/api/bots/${bot.user.id}/check?userId=${message.author.id}`);
    console.log(body);
} catch (err) {
    console.error(err);
}
``` Would this get a user voting in the last 24 hours?
#
Error: 401 Unauthorized
``` More of what i am asking is how do you Authorize this
restive otter
#

using yoru api token

summer osprey
#

but like how would I add it in @restive otter would I add ?access_token=MY TOKEN HERE

restive otter
#

you don't

topaz wyvern
#

auth header

restive otter
#

cuz thats not how the api works

summer osprey
#

@restive otter What does the header need to be named? or does it not matter

restive otter
summer osprey
#

Thank you

ornate vapor
#

Curious to see if anyone would know where I could find API for minecraft that would access the chat for servers

restive otter
#

Cool

severe iron
#

@ornate vapor this channel is for the DBL API only. also, why would that exist? that makes no sense...

tiny nebula
#

@ornate vapor just use rcon

craggy apex
#

How Can I send Votes To My Server Without Webhooks

tidal burrow
#

send or receive?

elfin solstice
#

you can't send without webhook

restive otter
paper briar
#

?

restive otter
#

that is a low budget meme my good sirs

restive otter
#

sa

grizzled agate
topaz wyvern
#

dbl isnt defined

grizzled agate
#

yeah but why ?

topaz wyvern
#

i dont need to explain that

grizzled agate
#

i wont come and ask if i knew 😦

shut ibex
#

its not defined bevause you need to define it

#

error kind is self explanatory

grizzled agate
#

ok not sure what i must put there 😢 but will look it up

restive otter
#

pls learn how to js

restive otter
#

are votes required to use webook

restive otter
#

also mine binds to 0.0.0.0 fro some reason?

#

nvm

restive otter
#

yea ignore me i was being retarded

dusty dagger
#

sa

mighty glacier
#

I'm trying to connect Dbl API with my bot using python but I'm getting this error ````AtrributeError: module 'dbl' has no attribute 'Client'```

slate merlin
#

it's about the api Thonk

summer osprey
#

maybe const dbl = require(“what ever the name of this package is called”)

topaz wyvern
#

no

alpine raven
#

and you have to write npm i dbl on node.js command

topaz wyvern
#

using official api

#

it would be

#
const DBL = require('dblapi /* iirc */');
const dbl = new DBL('token', client)```
#

using js ofc

mighty glacier
#

I'm using python and I fixed it. I named the cog dbl.py and that caused the error changing it to dblcog.py fixed it

restive otter
#

@topaz wyvern

const DBL = require ('dblapi') //iirc
#

fixed your commentation

topaz wyvern
#

ok

restive otter
#

yt*help

loud bolt
#

Hey help

fast tapir
#

Ok

loud bolt
#

vote for many commands

#

e.g. Vote And Use Command.

fast tapir
#

I don’t understand

restive otter
#

i think they're trying to figure out how to unlock several commands on dbl vote

restive otter
#

How do I show that on how many servers my bot is? Google Translate

restive otter
#

@restive otter what lib

#

@restive otter

#

ok thx

plain timber
zenith marsh
#

hey, um my server count is not updating.

#

the server count posts every 5 minutes, but recently it's been stuck at 21 servers, when it should be 25.

trail shadow
#

lol

shut ibex
#

show code

zenith marsh
#

wait a min

#

there we go

#

hmm

#

seems like dbl is lagging

#

but it finally posted

vernal isle
#

@mighty glacier Don't name your class or file dbl

tiny nebula
#

why not

#

just rename the library files

#

and no conflicts

mighty glacier
#

@vernal isle I figured that out yesterday

alpine raven
#

@midnight oriole

noble current
#

oi , . ,

restive otter
#

help-me???

restive otter
#

help me to get a server counter without dbl

tiny nebula
#

Magic

wraith reef
#

g

sick egret
#

Is possible to do the vote thing using the api instead of the webhook?

smoky trench
#

wdym vote thing

#

you can check if a user has voted through the api

sick egret
#

exactly, I want to do it with the api instead of doing all that webhook stuff

#

just wanted to know if it is possible

smoky trench
#

webhook stuff is for events, like adding a reward to someone when they vote. you'll want to use the api if you're checking if they can use a command, etc

sick egret
#

ok, then I must do the webhook, cause I want to send bot money on vote

smoky trench
#

okay, what language are you using?

#

you'll be able to use a lib that handles setting up webhooks for you

sick egret
#

javascript

smoky trench
sick egret
#

yes, but I leave port and password 5000 and "password"?

smoky trench
#

You'll need to change that according to your bot's setup, you'll also need to go into your bot's page and press edit to change webhook settings

#

set the url to your host's ip address and then the port (whatever you pick) and then set a password to verify requests

sick egret
#

ok

#

thanks for the help

smoky trench
#

ye, not too difficult

#

np, ask again if you need help

sick egret
#

but in url I must put the ip of the bot hosting, right?

smoky trench
#

Yes

#

unless you have a domain that points to the bot's host

sick egret
#

I put vps ip and console is returning me that is running on 0.0.0.0:5000

sick egret
#

any help?

restive otter
#

Why would you even be asking this in this channel, this is help with DBL's libraries not your Vps

azure pollen
#

did you even read the convo

restive otter
#

haha yes

restive otter
#

just to let you know

restive otter
#

How do i use the member counting bot?

shut ibex
#

ask in the support server

restive otter
#

And where do i find that?

#

where it says Join Support Server

restive otter
severe iron
#

probably

#

don't know the specific limit though

restive otter
#

Hopefully I don't go over the limit

severe iron
#

make it so it does it when your bot joins a new guild

#

don't do it like every few seconds

restive otter
#

Mine does it every 30 minutes

severe iron
#

that should be fine

light crag
#

60 requests per minute

restive otter
#

ok good

tidal finch
#

Why upvote is still slow to get on api

tawny oxide
#

probably because of caching

polar mirage
#

Webhooks down or am I down

frosty sierra
#

cloudflare was xD

limber radish
#

Cloudflare is neat.

frosty sierra
#

Yea, they reboot sometimed

daring solar
#

-bots @daring solar

abstract mothBOT
#
Joshua#0848
Bots

@inland nymph

topaz wyvern
lunar monolith
#

-bots @tender willow

abstract mothBOT
#

Bots don't have bots, silly.

lunar monolith
#

-bot @tender willow

restive otter
#

What's the size of the widget?

#

300x150

#

Thanks

runic ridge
#

I’ve got a question about the api

#

Do they mean the api key by token?

#

If no then where do I get the token from

#

I got the token

#

I get an error “unauthorized”

weary ember
#

u gotta put the token in the headers

runic ridge
#

i did

main frigate
#

or use a lib for it

runic ridge
#

i am using the library they gave

#
    def __init__(self, bot):
        self.bot = bot
        self.token = 'dbl_token'  #  set this to your DBL token
        self.dblpy = dbl.Client(self.bot, self.token)
        self.bot.loop.create_task(self.update_stats())
#

i am using what they provided

#

i added the bot's token in there

#

what else am i missing?

#

@weary ember

weary ember
#

u should be gud

runic ridge
#

Isn’t working

#

Lemmi send you the error

#

@weary ember

weary ember
#

did u change the dbl_token to ur token?

#

and u sure it is correct the token

runic ridge
#

I got the token from the bot

#

Where I go to the bot and click edit, all the way down I got the token.

weary ember
#

ngl it looks pretty short

runic ridge
#

Token not api key right?

weary ember
#

u put in the dbl api key

runic ridge
#

I tried

#

Lemmi try again

weary ember
#

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjQyOTU3NzYwNjY0NDQ5ODQzMiIsImJvdCI6dHJ1ZSwiaWF0IjoxNTM5Nzc4MTc3fQ.2rwUc58yOv6pukzG4D0A0rgC7OlSWdbWPmiJIXvVfhE it should be around that long(this token is my bots old token kthx)

runic ridge
#

Error code 403

#

Forbidden

#

@weary ember

runic ridge
#

I have the token in

amber dune
#

did you copy it correctly

runic ridge
#

Yes

#

There is one thing that I had to change because I’m using async

amber dune
#

are you sure the URL is right

runic ridge
#

But it’s exact same thing

#

Url?

#

There is no url in the code

amber dune
#

what

runic ridge
#

I installed dblpy library

amber dune
#

then how are you using the app w/o the url

runic ridge
#

Yes

#

I’m talking about dbl api

#

I installed dblpy and used tee code provided in the website

#

Using python -m pip install dblpy

#

The real problem is that I am getting an error but the stats is updating on the bot’s dbl profile

tidal finch
#

Well your work is done why care about error XD

restive otter
#

@runic ridge use aiohttp

runic ridge
#

@restive otter aiohttp vs requests

restive otter
#

Boi i hope your against reqd

#

Requests

#

aiohttp is asynchronous since that requests aren't @runic ridge

runic ridge
#

I mean I use requests sometimes

#

But mainly aiohttp

elfin solstice
#

@arctic arch webhooks are down again i think, no votes, test request are comming through to my bot and i also tested on other bots

#

👀

#

might only be extremly delayed

#

users reported they got there message like 10 minutes too late

restive otter
#

^ can confirm

cobalt ruin
#

should be fixed

elfin solstice
#

thanks

limber radish
#

Why is every large codebase somewhat unstable.

plain timber
#

all codebases are somewhat unstable

restive otter
#

can anyone help me with bot development?

plain timber
#

@restive otter 1. #development 2. first you need to code, nobody here is gonna teach you how so go online and look up tutorials and stuff, and go to #development when you have a specific question

restive otter
#

@plain timber i wanna know which languages are used to develop Discord bots, unlike Telegram bots need Python or JSON

plain timber
restive otter
#

thanks mate @plain timber i hope if i need help i can ask here

topaz wyvern
tawny cargo
restive otter
#

what you mean

tawny cargo
#

this https://discordbots.org/api/bots/493011382539911170
As far as I remember u could grab github url and support server invite from there

restive otter
#

you can

#

use the api

plain timber
#

nope he's right

#

its not in the api anymore

#

the docs are pretty outdated

topaz wyvern
#

for real?

#

i was about to make a dbl command

#

ok then

plain timber
#

i already made one and the support and github fields arent showing up anymore

topaz wyvern
#

thats a rip

arctic arch
#

oh that's a mistake

#

anything else missing?

topaz wyvern
#

not sure

arctic arch
#

quick fix™

plain timber
#

yeah its just support and github

crude pumice
#

I don’t understand the api docs

#

Where is a good place to learn how to construct a bot?

#

I’ve looked at Discord.NET docs but is the lib official?

plain timber
#

@crude pumice you need to google coding tutorials and learn a coding language, then pick a lib and learn it. Nobody here will teach you how to code, but if you have any specific question go to #development as this is only for the DBL api.

crude pumice
#

Ok

#

I know csharp, python, and a little of java so I should be good there

#

Thnx

plain timber
#

there are also libs for python and java and many other languages

restive otter
#

*help

terse nebula
grand plaza
terse nebula
#

yus.

terse nebula
#

i'll take that as a no then.

winged star
#

If he or she votes on the bot, he can use a command ! How can I do it?
@arctic arch

restive otter
#

coding

#

and using the api

ocean patrol
#

Does the Java API work for the vote webhook?

plain timber
#

@ocean patrol you'll need to set up a webserver system, i've heard Spark is good

late prawn
#

. .

[__]

loud gulch
plain timber
#

@restive otter 1. wrong channel, #general
2. just use html and css...

loud gulch
#

@plain timber the appropriate channel is #development actually

plain timber
#

its not help with bot dev tho

loud gulch
#

development is not only for bot dev

plain timber
#

then why does it say (bot) in the topic

loud gulch
#

true

silk sage
#

hi

vestal jacinth
#

Anybody have issues with Dank Memer bot joining a voice channel?

restive otter
#

Dank what

#

We will never know

zenith marsh
#

Is it okay to use UptimeRobot to check if the "online" keyword exists on the discordbots page to see if my bot is online?

#

I have no idea if I can set authorization headers in UptimeRobot so it can access the api every 5 minutes.

plain timber
#

i dont think uptimerobot can look for the text on a page

#

cant you make it check your server?

zenith marsh
#

@plain timber maybe, but i have multiple bots on one server

#

so itd be good to isolate each

#

like how u do with widgetbot (love your bot 😉)

restive otter
#

hey @inner venture Not sure who to ask about this but https://discordbots.org/api/docs#mybots the generate/regenerate token buttons dont seem to work on ms edge. They work fine on chrome though

inner venture
#

@arctic arch

restive otter
#

seems to be due to the table:

<table class="exampleTable api_key_viewer" style="transition:0.2s; opacity: 1;">

that wraps around it

plain timber
#

Why would you expect websites to work properly in edge

wary ether
#

Because it's "so much faster than Chrome or Firefox!"

restive otter
#

xD

restive otter
#

hye, in the request api JSON to gent bot info, how can i get a shard count from the bot?

#

i has see in the docs already but in JSON theres nothing

#

post a github issue @restive otter

#

there have been a few things missing recently since i think there were some api changes

#

so if something doesnt match the docs make an issue and it should get fixed

#

Where the github can i post the issue?

arctic arch
restive otter
#

Yeah thats it

#

tonky boi those docs lie

arctic arch
#

no u

restive otter
#

Then for now, can't get the shard count from the bot anymore?

arctic arch
#

yes you can

#

this is pokecord

#

it just depends on if they have posted shard count

#

hence the ? (marking that it might not always exist)

restive otter
#

in the website my bot have 2 shard total but in JSON request i can't see anything

arctic arch
#

I see it

restive otter
#

oh i see, different link GWowoHehe

#

Okay thanks

hearty bramble
#

Does

#

vote.user.username works?

arctic arch
#

if you have d.js
client.users.get(vote.user).username

restive otter
#

Did webhooks break again

polar mirage
#

Yeh

#

Think so

restive otter
#

:/