#topgg-api

1 messages · Page 23 of 1

golden wind
#

wanna make an issue for it?

primal lark
#

Um yeah

#

Maybe Im doing something wrong, but I dont think so

golden wind
#

no thats my end cause you didnt call the HTTP directly

restive otter
#

@golden wind does your lib use f strings?

golden wind
#

ye

restive otter
#

So it doesn’t support the same py versions as d.py reeeee

golden wind
#

👀

#

4jr made a fork and fixed a few of the things you mentioned yesterday, i havent had a chance to test it today but it looks good (apart from the docstrings)

#

i also redid the example but wanted to double check it through you first

restive otter
#

Oh cool if he’s forked I’ll take a look later

thin vessel
#

Am I the only one who has to JSON.parse(Object(response)) the API call response

arctic arch
#

yes

thin vessel
#

😦

amber gorge
tall nebula
#

Pro tip for fellow Java devs: the library uses retrofit which requires gson version 2.6.2 and I was getting methodnotfound errors with 2.8.2

tame kindle
#

rip

little harbor
#

am i misunderstanding this or can the C# library really only target .NET 2.0? GigaThonk

vagrant kayak
#

Oh that's annoying if that's the case

little harbor
#

that's older than my grandma

vagrant kayak
#

Do you mean .NET 2.0 or .NET Standard 2.0

#

There's a difference here

little harbor
#

idk what do you think i am some kind of programmer

#

oh wait

still bay
#

That was weak

#

I'll give you a 3 second slow cap

little harbor
inner rune
#

@cobalt ruin Do you collect stats on API keys?

queen dagger
#

I get this error when trying to do a server count:

ValueError: data and json parameters can not be used at the same time
foggy lava
#

(node:13672) UnhandledPromiseRejectionWarning: Error: 503 Service Unavailable

#

?

calm torrent
#

@queen dagger which lib?

bold fulcrum
#

Can a "voted_at" be added to the API's json return on api/bots/:{bot.id}/votes ?

#

If it's possible

restive otter
#

halp

#

discord.js

#

customize bot/id/vote one day?

junior goblet
#

@restive otter you probably have the wrong version of node

#

what version of node do you have

restive otter
#

wait

#

im using a host so how can i know...

junior goblet
#

try and update your node version

restive otter
thin vessel
#

Can we do api suggestions in here

elfin solstice
#

you can make suggestions to the api in here

thin vessel
#

Okay it would be nice to have an api endpoint for checking how many calls your token has made in the last minute, to check if its close to 60 and if it is lockdown all dbl api command until it resets to 0

#

Something like https://discordbots.org/api/token/<yourtoken>

uncut crystal
#

it would be on a header

arctic arch
#

ratelimits are not per token they're per IP

#

via cloudflare

thin vessel
#

Thats the most retarded ratelimit system ive ever seen then if you allow me to say GWczeHowdy

arctic arch
#

lol

#

blame cloudflare then

calm torrent
#

why not put the ratelimit in your own api code and not cloudflare thonkku

arctic arch
#

because we can

severe mist
#

TBH rate limiting by IP is very restrictive, for example what if multiple bots are hosted on the same server?

#

That's the entire server rate limited

thin vessel
#

Lets just make this easy, react with tickYes if you want per token ratelimit and tickNo if you dont want/dont care. Majority wins.

arctic arch
#

you can't make everything into a vote

#

keep in mind some endpoints do not require a token as well

thin vessel
#

which ones

severe mist
#

Ultimately it's your call, and I understand why it's rate limited, I'm just thinking by IP imo is a tad overkill and rather restrictive over per-token

arctic arch
#

anything but POST /stats and GET /votes

#

we had to ratelimit because of assholes putting stat posts in while loops or some shit

#

I was going no ratelimits as long as it's not abused

raven zinc
#

there was someone who got the idea of making the token use "possible" but not required, so you could base the ratelimit per-token if its provided

arctic arch
#

either ip or whole api locked

restive otter
#

Pls token rate limits for authed endpoints

thin vessel
#

I put my post stats in async loops what wrong with it GWcorsairBully

elfin solstice
#

tbh lock the whole api with tokens, there is no need for an not bot developer to interact with it anyways

#

token rate-limit would be pretty much the best deal here

severe mist
#

Yukine has a very valid point

#

Realistically only bot developers would be using it

elfin solstice
#

@thin vessel you actually wanna know whats wrong with that? you spam the api for no reason, instead of looping shit just update on demand (server count changed due any event) and you would spam less blobthumbsup

severe mist
#

I poll the votes endpoint once every minute for my voter rewards

thin vessel
#

But my loop only fires every 15 mins and the ratelimit is 60 request per min GWemotesxdJuiceBox

elfin solstice
#

hmm thats pretty high tho

junior goblet
#

why do you need to fire it every 15 mins

#

i do it once per hour

thin vessel
#

Because Up To Date server count GWemotesxdBlobNom

raven zinc
#

unless you have rythm's growth i don't think your server count will be off that much in 1 hour

junior goblet
#

lmfao

#

but why does up to date server count matter that much anyways

#

once per hour isnt much to ask GWchadThonkery

raven zinc
#

guess you could even prevent cached request and don't post if the latest post was already that count zoomeyes

junior goblet
#

that is so smart im gonna add that to my bot

elfin solstice
#

or you just update on demand and dont waste any requests 👏

raven zinc
#

automation yukine

thin vessel
#

But making guildCreet and guilDelet events ish too hard GWcorsairBully

severe mist
#

@elfin solstice what if you have a rapid growth spurt, boom rate limited

elfin solstice
#

you dont join/leave 60 servers in 1 minute

thin vessel
#

yes yes

#

you do

elfin solstice
#

keep on dreaming york

raven zinc
#

rythm does

thin vessel
#

Mee6 leaves 100+ servers per min cuz its total shit

elfin solstice
#

well yea for big bots likey Rythm thats completly fine, but not for smaller bots > 5k servers

severe mist
#

And I never said me I'm speaking in a general sense

#

I'm quite surprised and shocked Misaki has as many guilds as she does

elfin solstice
#

aslong as your bot isn't on 20k servers this shouldn't really happen

elfin solstice
#

THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL API LIBRARIES AND API DOCS FOUND AT HTTPS://DISCORDBOTS.ORG/API/DOCS

#

yours is not any of that

sudden rampart
#

keep in mind that posting on guild join/leave events might spam the api a lot

#

if there's an outage

#

it's not rare to get guild joins for all your bot's guilds when discord has an outage

#

at once

raven zinc
#

most libs filter that but that's not the case for all zoomeyes

elfin solstice
#

hmm thats actuall a valid point

#

^

#

i think JDA doesn't (atleast it was like that last time i used it) but most JS libs do that

sudden rampart
#

it's simple to filter

#

but people who never got it have no idea that it might happen

elfin solstice
#

tru

bold fulcrum
#

@sudden rampart that's why in my case I submit stars every half hour

#

Stats

thin vessel
#

custom search for the /users/ endpoint pls

arctic arch
#

you can't search users

#

you can't even list users

#

you can only get a specific user

restive otter
#

That's why he's asking for it

arctic arch
#

we're not a user listing site

sacred horizon
#

U have an api thay could benefit from it tho

severe mist
#

@arctic arch the only usage case I can think of, is he wants to list bots the user may own

arctic arch
#

you can do that from the /bots/ endpoint

severe mist
#

that's the only usage I can think of for users

thin vessel
#

I found a workaround using the bots endpointing with the ?search=owners:ID thing

elfin solstice
#

its not a "workaround" if thats actuall intended functionality tho

sacred saddle
#

Someone didn't do perms riiiiight

#

@gloomy brook

uncut crystal
#

guys

#

I understand the frustration

sacred saddle
#

@fickle mango

#

wew

restive otter
#

Nailed the perms™

gloomy brook
#

Hey you wanna unmute me in shitpost? I did nothing but say what was true and you didn't like it.

uncut crystal
#

discord pls

restive otter
#

Wanna unmute me?

sacred saddle
#

uh ohs

inner venture
#

this the api channel

restive otter
#

Yup

#

And its the only place we can talk rn

sacred saddle
#

yupp

inner venture
#

lmfao

#

🙏

cyan ruin
#

congrats on shitposting general and getting muted

restive otter
#

sence ™

thin vessel
#

hello @restive otter are you seeing this

restive otter
#

hello @thin vessel i am seeing t his

reef apex
#

webhook for votes?

uncut crystal
#

What? why?

dreamy rain
#

probably would end up overloading our servers

reef apex
#

true on that part

ashen saddle
#

/bots

inner venture
#

A vote webhook would be actually really cool, I think

#

That way, bots aren't forced to repeatably call the votes endpoint to update their list of users that have voted

deep wagon
#

I could very easily reduce how many times I call the API if I knew when it changed. I'm already caching the results so it'd be really easy to implement.

reef apex
#

Yes I've implemented caching and in web dashboard for user to click when voted so there is no periodic checks.

cobalt ruin
#

Webhook is going live tomorrow or Thursday, sorry for the wait guys ❤

astral urchin
#

YES

#

@cobalt ruin I can't wait

reef apex
#

Even better then

cobalt ruin
#

Sorry for the wait guys 😛

tame kindle
#

oliy pls

#

we need dbl websocket @cobalt ruin

#

WE NEED DBL BOTS

cobalt ruin
#

@robust olive pls

robust olive
#

¯_(ツ)_/¯

cobalt ruin
#

Can't please everyone, even if I tried I would be wasting my time

tame kindle
#

ok Oliy-sama

vagrant kayak
#

Why do we need a websocket for DBL. That's pointless af

tame kindle
#

your pointless

uncut crystal
#

@tame kindle last warning

#

also, it's you're

#

novus, I'd imagine because people don't have to keep making new requests and they can maintain their own cache

cobalt ruin
#

@vagrant kayak So people don't have to request API every x seconds/minutes

vagrant kayak
#

That's why I initially suggested the webhook system

#

Websocket would be a pointless server running

uncut crystal
#

oh he said websocket

#

could've sworn I read webhook

#

eugh

restive otter
#
(node:10320) UnhandledPromiseRejectionWarning: Error: 400 Bad Request
    at _response.transport.finalizeRequest.call.then (C:\Users\Admin\Desktop\Hikari\node_modules\snekfetch\src\index.js:195:23)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)

this started happening after attempting to implement the api in djs

#

and it looks like it has nothing to do with me :/

normal sleet
#

OOF i've been getting that ToO

#

I checked all of my files and it wasn't caused by my code

restive otter
#

i have no way of checking whether or not it actually worked eee

thin vessel
#

Well I use d.js too and I dont get that

normal sleet
#

it all started after I put the api

restive otter
#
const dbl = require('dblapi.js');
const dblAPI = new dbl('don't steal token pls', client);

i assume client is our instance of the djs client

thin vessel
#

uhhh no

#

there is nothing after the token

#

just the token

#

and thats it

restive otter
#

api docs inaccurate reeeeeeeeeeeeeeeeeeee

thin vessel
#
const DBLapi = require("dblapi.js");
const dbl = new DBLapi('nope m8 u not getting it');
thin vessel
#

ew you do const DBL and dbl

#

bad practice

normal sleet
#

banne

#

anyways

restive otter
#

that's straight from the docs

thin vessel
#

docs are gay then

restive otter
#

gae

tame kindle
#

when will @arctic arch stop using discord.js client for it's api.

normal sleet
#

even if it's from the docs it's bad practive

tame kindle
#

I can make an api w/o discord.js instance

normal sleet
#

practice*

thin vessel
#

I can make an api with ur face

sacred horizon
#

Hot

manic wasp
#

t!t credits

shy vessel
queen dagger
#

I get this error when trying to do a server count in discord.py:

ValueError: data and json parameters can not be used at the same time
viral herald
#

What’s your code

queen dagger
#
await dbl.post_stats(jsonObject={
        "server_count": len(client.guilds)
        })
thin vessel
#

Python 🤢

tame kindle
#

^

left wren
#

API

#

DO SOME COMMAND

shy vessel
#

:S

tame kindle
#

when will tonkku test his bullshit

shy vessel
#

welp

#

someone ping me when they have solution

#

:C

#

@junior goblet do u know solution GWbowsuBlobThinkOwO

junior goblet
#

what version of node do you have?

shy vessel
#

3.10.10

junior goblet
#

what in tarnation

#

try and download the latest node version from nodejs website

shy vessel
#

👀

junior goblet
#

recommended or latest it doesn't really matter

#

yours seems pretty outdated

shy vessel
#

I said the wrong version GWjiangoOmegaLUL

#

v6.11.3

tame kindle
#

to use async, use Node 7

#

dbl api uses async

#

or add --harmony tag

shy vessel
#

I got it

tame kindle
#

@shy vessel

shy vessel
#

👀

junior goblet
#

sorry i didnt respond but yeah either way you had to update node blobthumbsup

shy vessel
#

yeah ty

shy vessel
tight vessel
#

ok

restive otter
#

can you see if a specific user has upvoted your bot, or do you just get the list and check from that

tame kindle
inner venture
#

@restive otter the latter

restive otter
#

thanks

reef apex
#

I like how you can do days=0.1 to get who voted in last 2**.**4h

foggy yoke
#

My bot has eveything accessable through the client, I don't feel all that good sharing the client object.

calm torrent
#

what?

restive otter
#

Ooo what is this channel for

inner venture
#

discussing the api/api libs

reef apex
#

newly overhauled api for DBL

restive otter
#

Ah k

#

Thx

inner venture
#

also

#

channel topc

restive otter
#

I'm on a phone sorry lol

median cedar
#

i'm having trouble with installing the python API

#
Collecting aiohttp>=2.3.9 (from dblpy)
  Using cached aiohttp-3.0.1-cp36-cp36m-win32.whl
Requirement already satisfied: multidict<5.0,>=4.0 in c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages (from aiohttp>=2.3.9->dblpy)
Requirement already satisfied: idna-ssl>=1.0 in c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages (from aiohttp>=2.3.9->dblpy)
Requirement already satisfied: attrs>=17.4.0 in c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages (from aiohttp>=2.3.9->dblpy)
Requirement already satisfied: chardet<4.0,>=2.0 in c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages (from aiohttp>=2.3.9->dblpy)
Requirement already satisfied: yarl<2.0,>=1.0 in c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages (from aiohttp>=2.3.9->dblpy)
Requirement already satisfied: async-timeout<3.0,>=1.2 in c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages (from aiohttp>=2.3.9->dblpy)
Requirement already satisfied: idna>=2.0 in c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages (from idna-ssl>=1.0->aiohttp>=2.3.9->dblpy)
Installing collected packages: aiohttp, dblpy
  Found existing installation: aiohttp 2.2.5
    Uninstalling aiohttp-2.2.5:
      Successfully uninstalled aiohttp-2.2.5```
#
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\shutil.py", line 387, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\user\\AppData\\Local\\Temp\\pip-bfbr6dwe-uninstall\\users\\user\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\aiohttp\\_http_parser.cp36-win32.pyd'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_set.py", line 795, in install
    requirement.commit_uninstall()
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_install.py", line 767, in commit_uninstall
    self.uninstalled.commit()
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_uninstall.py", line 142, in commit```
#
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\retrying.py", line 212, in call
    raise attempt.get()
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\six.py", line 686, in reraise
    raise value
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\utils\__init__.py", line 102, in rmtree
    onerror=rmtree_errorhandler)
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\shutil.py", line 494, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\shutil.py", line 384, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
#
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\shutil.py", line 384, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  [Previous line repeated 6 more times]
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\shutil.py", line 389, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\utils\__init__.py", line 114, in rmtree_errorhandler
    func(path)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\user\\AppData\\Local\\Temp\\pip-bfbr6dwe-uninstall\\users\\user\\appdata\\local\\programs\\python\\python36-32\\lib\\site-packages\\aiohttp\\_http_parser.cp36-win32.pyd'```
#

sorry i just spammed the channel :P

#

i'd be very grateful if someone could help. thank you

reef apex
#

temporal solution: run console as administrator and then install

median cedar
#

running in command prompt admin

#

um

reef apex
median cedar
#

i just closed it and tried again and it worked

#

🤔

#

well at least it worked

thin vessel
#

What link would I send the DBL webhook to if I want it to post on my discord server

inner venture
#

I don't think you fully understand webhooks

thin vessel
#

I dont have mony to buy a webserver for a heckin webhook GWcorsairBully

inner venture
#

Are you hosting the bot on your pc

thin vessel
#

no

median cedar
#

it doesn't say in the documentation how to find out if a user has upvoted your bot on a specific day. anyone know?

#

i'm using python

#

i want to know whether a certain user has upvoted today

inner venture
#

@median cedar. Grab the list of users with a limit of 1 days and then see if it contains the user you're looking for

median cedar
#

do i just add a limit=1 parameter to it then cuz that's not on the docs

#

nope that doesn't work

#

🤔

#

@inner venture that doesn't work

inner venture
#

🤔

#

days=1

reef apex
#

^

median cedar
#

nope

reef apex
#

it works

median cedar
#

what did you just put in...?

inner venture
#

I think it had his token in it lol

reef apex
median cedar
#

i'm using await dbl.get_upvote_info(id=id, token=token, onlyids=True)

reef apex
#

oooh the library

median cedar
#

yes

reef apex
#

sec gonna take a look at the library

inner venture
#

Maybe Francis hasn't added support for days

#

@golden wind

reef apex
#

yuup confirmed

median cedar
#

😭

#

i guess my daily voting system will have to wait

reef apex
#

what if you do a manual request?

#

or do you REALLY want to use the library

median cedar
#

can i add a manual request into my bot?

reef apex
#

ofc

median cedar
#

can you explain how to do a 'manual request' plz

reef apex
#

basic GET request with the aiohttp library

median cedar
#

🤔

#

could you explain in a little more detail please

inner venture
#

Perhaps you should do a bit of googling

reef apex
median cedar
#

thx

#

was already reading that but thx anyway

thin vessel
#

Can someone make a DBL webhook working on JS I cant get mine to work

#

I mean a tutorial for one*

dreamy rain
#

it should be as simple as running an http server of some kind

#

restify or something

thin vessel
#

I succ at http

severe mist
#

so we have to provide the webhook yes?

median cedar
#

this is what i get from the aiohttp request:

<CIMultiDictProxy('Date': 'Wed, 14 Feb 2018 20:24:39 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '24', 'Connection': 'keep-alive', 'Set-Cookie': '__cfduid=a_long_number_that_might_need_to_be_secret_idrk; expires=Thu, 14-Feb-19 20:24:39 GMT; path=/; domain=.discordbots.org; HttpOnly; Secure', 'X-Powered-By': 'Express', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': 'Authorization', 'ETag': 'W/"18-XPDV80vbMk4yY1/PADG4jYM4rSI"', 'X-Varnish': '96503185', 'Age': '0', 'Via': '1.1 varnish-v4', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains; preload', 'X-Content-Type-Options': 'nosniff', 'Expect-CT': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'Server': 'cloudflare', 'CF-RAY': '3ed2c0900d513536-LHR')>```
severe mist
#

boo, does not appear to be discord webhook friendly

median cedar
#

i have to go now, if anyone knows anything that could help me complete this then please ping me. i'll be back in ~20 mins

snow fiber
#

It's intended to be send to a server you own, so your bot can immediately respond on a vote

#

But you could generate the Discord webhook yourself by parsing the data on your backend

severe mist
#

I have a suggestion

#

a "TEST WEBHOOK" button

thin vessel
#

hell yeah plz

reef apex
#

@median cedar you have to put token in headers not in params

median cedar
#

where is the headers section?

#

@reef apex

#

i am very new to this

reef apex
#

async with session.get(url, params=params, headers=headers) as resp:

median cedar
#

Thx

thin vessel
#

Does anyone know a free http server to use for the webhook

#

for node

median cedar
#

i am still getting unauthorized error

#

@reef apex

#

sorry to keep bothering you, if you are busy doing something else feel free to say

reef apex
#

DM me your code

#

for future askers: ```python
import aiohttp

async def has_user_voted(user_id, bot_id=None, days=1, token=None):
async with aiohttp.ClientSession() as session:
async with session.get("https://discordbots.org/api/bots/{}/votes".format(bot_id), params={
"onlyids": True,
"days": days
}, headers={
"Authorization": token
}) as resp:
return str(user_id) in resp.json()

thin vessel
#

JS now plez

reef apex
thin vessel
#

but to what http server GWcorsairBully

reef apex
#

oh you want server

#

well

#

node has express

hardy valley
#

The webhook doesn't work? >.>

#

I'm listening for upvotes on my "bot" (currently a dummy to test the listening process), and it's not receiving any POST requests.

cobalt ruin
#

Are you sure the webhook URL is set?

hardy valley
#

Yes, I've set it four different times.

calm torrent
#

@median cedar try my fork of the wrapper pip install -U git+https://www.github.com/fourjr/DBL-Python-Library

median cedar
#

Thanks for your help but I’ve got it to work with aiohttp

calm torrent
severe mist
#

@cobalt ruin maybe look into "test webhook" functionality to send example payload for developers to verify the data they get etc

cobalt ruin
#

Okay! Thanks for your suggestion

spark osprey
#

Will the library packages ever emit an event of upvotes? Also, is there any way to prevent users from voting and un-voting repeatedly? That would screw up my auto rewards system.

sudden rampart
#

there's no "event of upvotes"

#

they'd need to run a HTTP server to achieve that

golden wind
#

@inner venture whoops i forgot about that

#

probably tomorrow

inner venture
#

Kek

muted thorn
#

Is there any way of verifying that the webhook request to the bot's HTTP server is valid?

sudden rampart
#

maybe have in the Authorization header a token

#

the bot token

#

so we can verify on our ends

muted thorn
#

yeah I guess if the POST request had an authorization header matching the bot's DBL token that would be enough

sudden rampart
#

btw if anyone wants i wrote (in go) a basic http server that redirects data to a redis pubsub

dawn fjord
#

for best security I have the packets of the webhook request sent on an encrypted flash chip in a locked container carried by a carrier pidgeon

uncut crystal
muted thorn
#

OR if you wanna get really fancy you could encrypt the entire request body using a SHA hash signed with the DBL token

#

might be excessive for what it is

sudden rampart
vagrant kayak
#

I think just a header with that info would be fine

muted thorn
#

that's not a shitpost.

#

but yeah I agree

short forge
#

You could also have your library verify if the post is coming from a host

#

I know for sure sanic (Python) has this, but check your library's docs for others

vagrant kayak
#

coming from a host being you check what?

#

What could you possibly check that makes sure it came from a specific host

#

(without the host giving you something)

short forge
#

in sanic, request.host gives you whatever host the request is coming from

#

in production/real use it'd be discordbots.org

inner venture
#

Im not sure how reliable that is, tbh

#

or how secure, i mean

short forge
#

¯_(ツ)_/¯

dreamy rain
#

I mean you can just obfuscate the endpoint

#

call it server.address.com/4j20q9f904q2jf09j24q0 or something

inner venture
#

lmao

golden wind
#

@calm torrent have you tested your fork yet?

calm torrent
#

i did minor testing, definitely not enough testing tho

golden wind
#

okay

#

i'll take a look at it

calm torrent
#

it should work though

#

oh one more thing, docstrings are half-complete xd

golden wind
#

ye i noticed lol

calm torrent
#

but at least it works :^)

golden wind
#

well

#
  File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/core.py", line 62, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "/root/github/test/modules/Cmds.py", line 26, in gs
    await self.dblpy.get_server_count(self.bot)
  File "/usr/local/lib/python3.6/dist-packages/dbl/client.py", line 121, in get_server_count
    self.bot_user_init()
  File "/usr/local/lib/python3.6/dist-packages/dbl/client.py", line 67, in bot_user_init
    if not self.bot.is_ready():
AttributeError: 'str' object has no attribute 'is_ready'
#

@calm torrent "works"

calm torrent
#

uh.. what did u parse in?

golden wind
#

self.bot

calm torrent
#

send code

golden wind
#
class Cmds:
    def __init__(self, bot):
        self.bot = bot
        self.token = 'no u'  # set this to your DBL token
        self.dblpy = dbl.Client(self.bot, self.token)

    @commands.command()
    async def gs(self, ctx):
        await self.dblpy.get_server_count()

def setup(bot):
    bot.add_cog(Cmds(bot))
#

also tried parsing self.bot into get_server_count

calm torrent
#

huh wait..

#

oh wait the latest versin is still on my pc :o

golden wind
#

lol rip

calm torrent
#

try updatin now

golden wind
#

hmm ye

#
Traceback (most recent call last):
  File "bot.py", line 120, in on_ready
    bot.load_extension(extension)
  File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/bot.py", line 704, in load_extension
    lib.setup(self)
  File "/root/github/test/modules/DiscordBotsOrgAPI.py", line 39, in setup
    bot.add_cog(DiscordBotsOrgAPI(bot))
  File "/root/github/test/modules/DiscordBotsOrgAPI.py", line 10, in __init__
    self.dblpy = dbl.Client(self.bot, self.token)
  File "/usr/local/lib/python3.6/dist-packages/dbl/client.py", line 59, in __init__
    self.loop = kwargs.get('loop') or bot.loop
#

@calm torrent in the client init, replace bot.loop with asyncio.get_event_loop()

#
    def __init__(self, token, bot, **kwargs):
        self.bot = bot
        self.bot_id = None
        self.loop = kwargs.get('loop') or asyncio.get_event_loop() # <------
calm torrent
#

why not use the bot loop..?

#

are u passing in bot as a str?

golden wind
#
class Cmds:
    def __init__(self, bot):
        self.bot = bot
        self.token = ' '  # set this to your DBL token
        self.dblpy = dbl.Client(self.bot, self.token)
#

im passing self.bot into it

calm torrent
#

oh...

#

dbl.Client(self.token, self.bot)

golden wind
#

oh lol

#

my bad

calm torrent
#

@golden wind does it work?

golden wind
#

posting and getting server count work

#

im looking at the rest atm

#

i'll update the examples once im done and work out the best way to implement stats every 30 mins

calm torrent
#

GWcfcThonk isn't it already in the thing?

#

oh wait.. ahh it's in my test bot/example

#
#def __init__
self.bot.loop.create_task(self.update_stats())


async def update_stats(self):
    while not self.bot.is_closed:
        await self.dblpy.update_thing()
        await asyncio.sleep(30 minutes in seconds) 
#

something like that @golden wind

golden wind
#

1800

calm torrent
chilly pulsar
#

@golden wind can i have hide NSFW role?

#

soz for ping

calm torrent
golden wind
#

^

chilly pulsar
#

k

#

im new

calm torrent
#

@golden wind what 1800?

chilly pulsar
#

soz

golden wind
#

@calm torrent 30m in sec

calm torrent
#

oh ok

golden wind
#

idk why i know that

#

i just do

calm torrent
#

3600 is an hour, that's all i know

chilly pulsar
#

i can't find my bot (sorry if this is dumb) will it be added later for testing?

calm torrent
chilly pulsar
#

kk

golden wind
#

@calm torrent all works 👍

calm torrent
#

want me to pr in?

golden wind
#

👍

calm torrent
#

I'll make bot the first parameter first thonkku

golden wind
#

👍 i'll sort out the docs later

rough walrus
#

pls how can i set up nintenbot on my server

#

anyone to help

sacred horizon
proven hedge
cobalt ruin
proven hedge
#

Oh, i only put the dbl poststats

astral urchin
#

If the webhook fails? will it try to send again?

proven hedge
#

btw, should i replcae the "client" to my bot client?

tough yoke
#

Yes

tacit dragon
#

@proven hedge, nodejs?

hardy valley
#

@cobalt ruin is the webhook sending out POST or PUT?

sudden rampart
#

post

proven hedge
hardy valley
#

Welp, I've been catching any requests to my port, and it's not sending anything.

sudden rampart
#

it works for me

hardy valley
#

Does it only send to a url and not a port?

#

Or do you have to specify a port?

raven zinc
#

iirc you do have to specify the URL + port

hardy valley
#

Mk, well I've still done that...

raven zinc
#

then pray

hardy valley
#

I have sold my soul to get this to work..

#

I've used postman to send a POST request to the url:port

#

And it works,

#

but when I try and vote. It doesn't send it.

proven hedge
#

do i put dbl.getStats("ID) below dbl.postStats?

sudden rampart
#

you don't have to get stats

proven hedge
#

what about the server count?

sudden rampart
#

postStats sends it

#

getStats is to view the stats of a bot

proven hedge
#

but it doesnt show the server count on the website

uncut crystal
#

it's fine

proven hedge
#

my bot is in like 5/6 servers

steady sundial
#

So I want to use a webhook to see who upvotes my bot. I already defined a discord webhook but idk how to continue. Which event triggers that someone upvoted my bot, can someone help me pls? Its for javascript btw

inner venture
#

That's not how webhooks work

sudden rampart
#

A webhook in web development is a method of augmenting or altering the behaviour of a web page, or web application, with custom callbacks. These callbacks may be maintained, modified, and managed by third-party users and developers who may not ne...

dreamy rain
#

I imagine it's possible to write a webhook handler that emits a d.js event

ocean marlin
#

most likely

sudden rampart
#

i have a go http server forwarding the webhook events to a redis pubsub channel

#

cba to run an http server on my bot process

hardy valley
#

Except in the docs, DBL has a webhook for posting when a user upvotes..

#

(Albeit it doesn't seem to want to work..)

cobalt ruin
#

Updates

  • Fixed some webhooks documentation
  • Added documentation about small widgets and querystrings
steady sundial
#

jesus idk how to make this webhook work

#

is there a tutorial how to make a simple node.js webhook?

cobalt ruin
#

We are trying to get one out on how to use webhooks on our site 😄

steady sundial
#

Okay that's very nice. Ty. I wonder how Nadeko could forgive the Flowers for upvoting their bot before the relase of the Webhook.

cunning forum
#

they polled the votes endpoint every set time

#

and checked for new people

#

probably

steady sundial
#

But they have soooooo many users and the api allows just 60 requests per hour

#

I wonder how a big bot can forgive the users when there is just a limit of 60.

cobalt ruin
#

You are mistaken friend

#

The ratelimit is 60 requests per minute

shut ibex
#

Since when

cobalt ruin
#

do you guys not read the api docs

shut ibex
#

No

cobalt ruin
#

Well get outta here then

sudden rampart
#

it's been 60/min for a decent time

steady sundial
#

lol I swear there was written per hour

sudden rampart
#

iirc at least a month

steady sundial
#

okay so i am sorry ^^

hardy valley
#

Yeah, your API doesn't send any data to my webhook...

sudden rampart
#

it's working for me

hardy valley
#

Okay, what port do you have your webhook going to

sudden rampart
#

i have on 23456

#

but i reverse proxy with nginx

#

so it ends up on 443

#

then proxied to localhost 23456

hardy valley
#

Mk, on my router. I have port 8000 open to my IP.

#

I've gone into my DNS and forwarded my domain on the subdomain w to go to the IP address

sudden rampart
#

i couldn't get it to work when pointing to my ip

hardy valley
#

on the edit page I have it going to my website to the ip 8000

sudden rampart
#

so i just tested it on my vps

#

using eval to poll results

hardy valley
#

That's the thing, I had a friend in a different country send a POST request to the website+port and it sent through

severe mist
#

@steady sundial I stole this from @hardy valley

const http = require("http");
const querystring = require("querystring");

const server = http.createServer().listen(6669);

console.log("Listening on port 6669");

server.on("request", function (req, res) {
  var body = "";
  req.on("data", function (data) {
    body += data;
  });

  req.on("end", function () {
    var post = querystring.parse(body);
    console.log(post);
    res.writeHead(200, {
      "Content-Type": "text/plain"
    });
    res.end("Hello World\n");
  });
});

Works perfectly for me

sudden rampart
#

querystring

steady sundial
#

@severe mist thx york. I appreciate it!

severe mist
#

all native node, no additional modules

#

now I'm just working on a way to constitute that into my bot to award upvotes now

sudden rampart
#

i'm just waiting for a way of verifying if the webhook request actually came from dbots.org

severe mist
#

yeah, that is a very very good point

cunning forum
#

oof

severe mist
#

maybe keep the webhook URL a secret?

cunning forum
#

its easily verifiable

#

cache the webhooks

#

and every 20 seconds

#

check with the votes api

uncut crystal
#

pls no

sudden rampart
#

i'd rather have a way of verifying the request as extra safety

cunning forum
#

this kills their purpose tho

sudden rampart
amber gorge
#

@cobalt ruin can you update your bot's description with http post?

cobalt ruin
#

No, why would you do that?

amber gorge
#

like a command count or something

cobalt ruin
#

do it manually

amber gorge
#

okay

dreamy rain
#

if you really want something like that, build your own website and link to it from your bot page

sudden rampart
#

<iframe>

hardy valley
#

OR, have the server send a token?

#

If it matches the correct one accept it, otherwise.

sudden rampart
#

that's what was suggested yesterday

sudden rampart
#

btw for people wanting to verify it's dbl, you can use the Cf-Connecting-Ip header if you have cloudflare

vagrant kayak
#

🤔

#

nvm I was confused on something

inner rune
#

Can someone confirm Ratelimit is for token rather than IP?

shut ibex
#

im pretty sure for ip

#

since they ip ban for an 1 hour after to many requests

#

@inner rune

inner rune
#

Damn it ok

#

So I have to manage under 60 requests per minute w/ 3 bots.

inner rune
#

Oh hey, how are server counts calculated with sharding? Because before the update w/ api they had it so I had to update it per shard but now I only need to add the shards up and send it?

#

I am really confused whether I am supposed to send it per shard or just in one shard.

#

(AKA @earnest lintel 's shard count is incorrect)

inner venture
#

you can do either, still

#

@inner rune There are still the 3 different ways you can post your stats

#

total server count

#

server count for a shard

#

and all the shard server counts in an array

solid scarab
#

So how would I setup a webhook with discord.js, just want a msg whenever someone upvotes

dawn fjord
#

see above

#

york posted a good example

solid scarab
#

Dont see it. Is it the querystring one?

severe mist
#
const http = require("http");
const querystring = require("querystring");

const server = http.createServer().listen(6669);

console.log("Listening on port 6669");

server.on("request", function (req, res) {
  var body = "";
  req.on("data", function (data) {
    body += data;
  });

  req.on("end", function () {
    var post = querystring.parse(body);
    console.log(post);
    res.writeHead(200, {
      "Content-Type": "text/plain"
    });
    res.end("Hello World\n");
  });
});

@solid scarab

solid scarab
#

Thank you

restive otter
#

probably a common question: can you put a discord webhook link in the webhook for the votes?

#

or how would you format it if you can

inner venture
#

no

#

thats not how that works

restive otter
#

figured id try ¯_(ツ)_/¯

gleaming smelt
#

¯_(ツ)_/¯ what is this ?

vast junco
#

help with the dbl api

steady sundial
#

Wow nice question tho

gleaming dragon
#

Is there a delay in how long it takes the server count to update for a bot?

raven zinc
#

no

foggy lava
#
if (!dbl.hasVoted(message.author.id)) return message.channel.send("You must vote to use the music commands. You can do so here: https://discordbots.org/bot/332971222897786892/vote");
#

this does not work?

raven zinc
#

never tried but im psure the method is asynchronous

golden spire
#

yes it is

raven zinc
#

therefore you have to await it

golden spire
#

i have some code for it ill see if i can find it

#
dbl.hasVoted(message.author.id).then(result => {
  if(!result) 
    return message.channel.send("You must vote to use the music commands. You can do so here: https://discordbots.org/bot/332971222897786892/vote");
}
//command
#

try this

foggy lava
#

okay]

golden spire
#

if it doesnt work try removing the return and slapping an else after the message

#

e.g.

dbl.hasVoted(message.author.id).then(result => {
  if(!result) {
    message.channel.send("You must vote to use the music commands. You can do so here: 
https://discordbots.org/bot/332971222897786892/vote");
  } else {
    //command
  }
}
tame kindle
#

heking weeb

golden spire
#

yes i know what that is

#

that was to do with the discord bot list api

tame kindle
#

ugh

#
dbl.hasVoted(msg.author.id).then((res) => {
    if (!res) { return; }
    // commands here
});
dull sundial
#

why would you put the return; into brackets notlikeblob

tame kindle
#

ban

sudden rampart
#

all my ifs have brackets

#

:^)

uncut crystal
#

why would you use .then

gleaming dragon
#

I'm not able to udpate the server count for my bot. I've verified I'm getting a 200ok header response from the API endpoint, but it doesn't update.

#

        $response = $guzzle->post(self::DISCORD_BOTS_URL.'/bots/'.env('DISCORD_BOT_ID').'/stats', [
            RequestOptions::FORM_PARAMS => [
                'server_count' => $guildCount,
                'shards' => 1
            ]
        ]);
dd($response->getStatusCode());

shows "200" as the response code

cobalt ruin
#

How long ago was your 200?

tame kindle
#

200 is ok tho?

cobalt ruin
#

Yes 200 is ok

gleaming dragon
#

Yes, it is. But I've harded coded the server count of 2018

#

So it should be indicating that number. the 200ok was about 5 mins ago

tame kindle
cobalt ruin
#

@gleaming dragon so you only have one shard?

gleaming dragon
#

Yeah

cobalt ruin
#

I believe it should be an array?

gleaming dragon
#

Yep, that fixed it.

#

Thanks

#

Seems strange for that to have to be an array though

cobalt ruin
#

Not sure @arctic arch designed the API

arctic arch
#

just remove the shards from your post

#

if you want to send a total server count and the amount of shards you have use shard_count

gleaming dragon
#

k

vital anvil
#

_csharp API anyone? SadShip _

#

I-i can help

restive otter
#

sure

solar umbra
#

Where do I have to insert the API?

sudden rampart
#

?

solar umbra
#
DiscordBotListAPI api = new DiscordBotListAPI.Builder()
                                             .token("token")
                                             .build();```

Do not I have to insert the API somewhere?
sudden rampart
#

save it in a field

solar umbra
#

?

inner venture
#

I don't understand your question

solar umbra
#

How should I paste the API into Eclipse so that I can use it?

In Maven? I need more information

sudden rampart
solar umbra
#

thx

sudden rampart
#

also jitpack reeee

#

use bintray

inner venture
#

lmao

#

jitpack is so easyyyyyyyyyyyy

sudden rampart
#

just click the button

inner venture
#

hmm

sudden rampart
#

and get the copy paste stuff

inner venture
#

do i have to push the builds to it?

sudden rampart
#

yes

inner venture
#

see thats harder 😩

sudden rampart
#

if you use gradle it's as easy as 2 clicks

#

make a custom gradle task for bot git push and bintray upload

#

ez

inner venture
#

jda is on bintray right?

sudden rampart
#
task pushAndPublish {
    dependsOn bintrayUpload

    Runtime.getRuntime().exec("git push").waitFor()
}```
#

yes

tame kindle
#

👏

restive otter
#

is there a problem or why is it returning a STATUS CODE: 503 Backend fetch failed whenever I try to make a post request

uncut crystal
#

we're aware of the issues on the service, it's being worked on

restive otter
#

oh okay blobokhand

spice jacinth
#
  1. multiple grammar (capitalization) mistakes in docs
  2. didn't find any documentation on manually POSTing server count, is that supposed to be a thing
  3. are there any headers that return # of requests remaining before a ratelimit? if not why not?
sudden rampart
#
  1. no, only when you get ratelimit
#

then there is the retry-after header

#

you have to handle ratelimits yourself

cobalt ruin
#
  1. look in bot
spice jacinth
#

not seing that

#

what sidebar is it at?

cobalt ruin
#

Bots

spice jacinth
#

oh makes sense right at the bottom

#

whoopsies

restive otter
#

So, do we have to actually use the webhooks and track ourselves how many times a user voted? Doing a GET to /votes just returned the users not how many times they voted. Only other way I can see doing it is by adding &days=1 and tracking the changes there.

cobalt ruin
#

Well, can't you just give a reward each time they vote? Why would you want to store about many times they voted?

restive otter
#

It's good information to have

cobalt ruin
#

Uhm @arctic arch ?

severe mist
#

Track it yourself @restive otter, the API doesn't, and shouldn't cover every little thing for edge cases like this, I mean depending on your setup you can store it in a db

restive otter
#

Is the webhook triggered with type none after 24h when the daily vote gets removed by DBL?

arctic arch
#

no

restive otter
#

Bad. Then I must use the old endpoint.

foggy lava
#

Why do i always find york in every server im in

shy vessel
#

not appropriate for this channel @foggy lava

foggy lava
#

didnt notice i was in the api channel, sorry

viral herald
sturdy forge
#

@viral herald did you read the error?

viral herald
#

Yeah

#

I don’t get it

karmic hound
#

knowning nothing about the lib but is server_count undefined

sturdy forge
inner venture
#

@viral herald What bot ID are you using

#

my guess is that youre trying to get the server count of a bot that does nto have a posted server count

#

so the lib tries to get at "server_count" but it doesnt exist, so error

#

@golden wind just tagging you because this might be an issue on your end

golden wind
#

@viral herald what bot id?

#

(thanks @inner venture)

viral herald
#

I got it

viral herald
#
Traceback (most recent call last):
  File "bot.py", line 278, in _eval
    ret = await func()
  File "<string>", line 8, in func
  File "/usr/local/lib/python3.6/site-packages/dbl/client.py", line 77, in post_server_count
    await self.http.post_server_count(id, token, guild_count, shard_count, shard_no)
  File "/usr/local/lib/python3.6/site-packages/dbl/http.py", line 114, in post_server_count
    await self.request('POST', f'{self.BASE}/bots/{id}/stats', json=payload)
  File "/usr/local/lib/python3.6/site-packages/dbl/http.py", line 78, in request
    raise Unauthorized(data.pop('message', 'unknown'))
TypeError: __init__() missing 1 required positional argument: 'message'

#

Is this a mistake in the lib?

golden wind
#

yep, fixed in latest version

golden wind
#

@arctic arch retry_after for ratelimits in ms or s?

sudden rampart
#

seconds

golden wind
#

👍

viral herald
#

@golden wind if it was fixed in the latest version then why is it still giving me the error Bc I just installed it today

golden wind
#

because the latest version hasn't gone up yet

#

because it was finished today

viral herald
#

Ah ok

twin dirge
arctic arch
#

from there you can probably see that shards like 2 (3rd one) are null which means their stats haven't been sent

twin dirge
#

I sent a eval to all shards to send them, along with the fact that any time the shard gains a server, which I’m sure all have by time I checked last, it updates.

vagrant kayak
#

That's a bad idea to update on guild join/leave

tough yoke
#

^^ lol , yes

twin dirge
#

Just join. That’s what I was told to do because an interval is apparently stupid.

uncut crystal
#

an interval isn't stupid

#

an interval is the way to go

twin dirge
#

I was told that was wrong by people in Discord Bots. blobshrug

cobalt ruin
#

They're stupid

gray root
#

For the webhooks, how would i prove that the requests are coming from DBL, not some rando request?

#

Github uses a X-Hub-Signature header.

sudden rampart
#

has been suggested before with an Authorization header with the bot token

gray root
#

ah

fallow nymph
#

hey with the API dbl.getVotes(true) function I get a 401 error like. How am I supposed to use it exactly?

sudden rampart
#

did you give it the token?

inner venture
#

did you use the right token

fallow nymph
#

yes

arctic arch
#

did you give it the correct token

#

do not give it your bot token

sudden rampart
#

bot page -> edit -> scroll down

fallow nymph
#

O yea i just found it, sorry

wanton matrix
#

I've been grinding this all day. I'm working with komada and trying to make an upvote inhibitor. using the api in code i can't get true/false, yet in eval i can.

#

I've tried some of the above options.

gray root
#

Is it possible to get the top voters of a bot?

inner venture
#

no

severe mist
#

@gray root unless you track the stats yourself, no

cobalt ruin
#

@wanton matrix I don't quite understand your problem, can you try and elaborate on your problem?

fallow nymph
#

ok so with

dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);

the 2nd and 3rd arguments do not work this is what it gives me

TypeError: Cannot read property 'Id' of undefined
which is the Id value in the 2nd argument, and in the 3rd argument it just flat out does not work for me. only way I can get the current shard id the bot is currently on is with client.shard.id and to get the total shards I have to use client.shard.count but if I change them to these working values only the server_count updates

{ server_count: bot_server_count_here, shards: [] }

like so but where is says bot_server_count_here is the number of guilds the bot is in. any idea why client.shards.total and client.shards.Id isn't working?

wanton matrix
#

I'm trying to use hasVoted to get a true/false value, yet it returns a promise, in code. But when i so the same line in an EVAL it returns the true/false

#

@cobalt ruin

sudden rampart
#

await it

#

your eval probably awaits the promise

wanton matrix
#

I have done that in an async function yet the returned value is another promise

cobalt ruin
#

if you're using js

wanton matrix
#

yes, but see again i've tried that. I need the value to be outside of the promise so i can access it

#

And komada don't like async funcs, they break if uses as the run

cobalt ruin
#

@fallow nymph the client.shards.Id, client.shards.total is a placeholder, they won't work by default

fallow nymph
#

oh ok.

amber junco
#

will this api support net framework 4.6 soon?

#

i cant implement this in my bot because it requires net standard amd my bot doesn't use it

karmic hound
#

do you support post requests?

amber junco
#

yes, i use some of them so i can use the api for my vps actually

karmic hound
#

so you can also use the api directly without the need for a lib

cobalt ruin
#

@vital anvil read this

short forge
#

@gray root In the request context you may have some sort of host variable. Check your server library docs for info

#

like request.host

gray root
#

?

vital anvil
#

@amber junco the API works on 4.6.1 afaik

#

It has a compatability table inside

hallow mist
#

With the API and posting stats, is it better to do it on guild join/leave or on a interval such as every 10-30 mins

elfin solstice
#

depends how big your bot is

#

with an guild count of 10k+ i would recommend do it in interval everything under that can be done on request (join/leave)

hallow mist
#

Yeah, I'm below the 2500 server limit. So I guess the join/leave will be fine for now

elfin solstice
#

yea

amber junco
#

im not able to install it because it only specifies net standard 2.0 on the nuget page @vital anvil

cunning forum
#

Shouldn't the API return like an x-ratelimit-remaining and x-ratelimit-reset headers?

#

This would make devs life's easier

calm torrent
#

it's cloudflare ratelimits iirc

cobalt ruin
#

Yes hopefully we will be able to have custom ratelimits etc soon, but at the moment, cloudflare handles our ratelimits, which limits what we can do with it

cunning forum
#

This should never be the case honestly, coding a ratelimit system yourself gives so much more possibilitites

calm torrent
#

The API is written in node?

cunning forum
#

And it can't be that hard

arctic arch
#

we need to do things in order to have the ratelimit have any efficiency
sure we can block your access but it doesn't help us in any way

#

because you might still be spamming like hell

#

and shit

vital anvil
#

Odd, @amber junco I'll check it out

sudden rampart
#

@cunning forum writing a ratelimiter is hard

cunning forum
#

Hmmm

long anvil
#

can an error in api repsonse be sent as JSON instead of html page?

dreamy rain
#

I think that's a cloudflare thing in this particular case

short forge
#

yep

sacred horizon
#

how can I catch a dbl connection error? every once in a while ill get a 521 error, and so nobody can use the voter command

reef apex
#

which language?

sacred horizon
#

discord.js

#

so javascript

#

🤦🏼

reef apex
#

try {} catch {}

sacred horizon
#

im dumb lol

reef apex
#

i guess

sacred horizon
#

yeah but it doesnt work

#

im doing this...

reef apex
#

then if (!r.response_code === 200) {console.log("Something went wrong")}

sacred horizon
#
try { 
  dbl.hasVoted('${id}').then((x) => {console.log(x)})
} catch (err) {}
reef apex
#

not sure if it is response code but it's a concept

sacred horizon
#

but it does not catch the error

#

um ok

#

where would I put that though?

reef apex
#

after the request?

sacred horizon
#

oh ok

#

ill try that..

reef apex
#

ooooh it's dbl library

#

welll

sacred horizon
#

yea

reef apex
#

that is a different story

sacred horizon
#

lol

reef apex
#

let me take a look

sacred horizon
#

this is the api chat lol

reef apex
#

oh wait do you have a link to js dbl client?

sacred horizon
#

hm?

reef apex
#

github

sacred horizon
#

idk

#

it is all correct tho

#

it just has connection issues some of the time

#

most of the time it works tho

reef apex
#

not the point

sacred horizon
#

oh

reef apex
#

you probably can't check for status codes

#

it's the library issue

#

so try pinging the dev

sacred horizon
#

@arctic arch could you help with this issue above?

reef apex
#

the dev not the owner xd

sacred horizon
#

who tf is the dev lol

reef apex
#

i take it back

inner venture
#

Js?

sacred horizon
#

yea

inner venture
#

Tonk made the js one

sacred horizon
#

ok so i'm right

reef apex
autumn hinge
#

hello

primal lark
arctic arch
#

how's it wrong?

primal lark
#

The code is completely wrong 😃

#

I notified the dev of the python api and he said he will change it. But that was one week ago 😕

amber junco
vital anvil
#

Yeah it's an mistake of mine :p

#

I'll fix it in a bit

amber junco
#

ok

#

😃

golden wind
#

@primal lark updated the readme, idk how long it'll take for the site to update (if it updates automatically)

primal lark
#

OK thx 👍 mmLol

inner venture
#

@golden wind I think they were manually pulled and made into the sites style

golden wind
#

👀

vital anvil
#

@amber junco Uploading now, give it ~30 minutes to show

amber junco
#

ok

vital anvil
#

Also, if you're using Discord.Net, I'm uploading the first release of the adapter project

#

which allows you to do

Discord.DiscordSocketClient.CreateDblApi(token);

and some extra routes for ease of use.

amber junco
#

i'll have to mess with that when it comes out because i use discord.net

vital anvil
#

It's a seperate nuget package, to avoid dependency hell in the main package

#

It should pop up with DiscordBotsList.Api

sacred horizon
#

ok so how do you catch an error, uploading to dbl using the api

#

no, try catch does not work

restive otter
#

can the webhook post without a vote happening? like for a test

inner venture
#

@sacred horizon what lang

#

java?

sacred horizon
#

javascript

robust olive
#

just upvote the bot yourself to test thankang

restive otter
#

wow i'm smart

inner venture
sacred horizon
#

can I get some help please?

sacred horizon
amber junco
#

@vital anvil I still can't install it

#

it needs something on there that says its compatable with net framework4.6+

bitter shard
#

.

arctic arch
#

@sacred horizon .catch

vital anvil
#

@amber junco move to 4.6.1

#

It's the minimum framework requirements

strange silo
#

Can I make a bot dm a user and have the user reply to the bot

#

???

tough stream
#

users can dm bots and they can chat in dm

calm torrent
amber junco
#

my bot uses 4.6.1 and I can't download it because it isn't specified as a requirement on the nuget page still @vital anvil

vital anvil
amber junco
#

the only issue is that I can't install it because net framework 4.6.1 isn't part of the requirements. my bot is based solely on the main net framework api and not any net standard or core apis

twin dirge
#

Will the webhook fire multiple times if a user votes/unvotes and repeats?

snow fiber
#

Does DBL always use the same IP to post to the web hook?

sudden rampart
#

from what i've seen yes

#

the Cf-Connecting-Ip is always the same ip for me

snow fiber
#

Ah thanks, I want to make sure that users could not fake a vote by posting to my web server

arctic arch
#

it does for now but possibly not in the future

snow fiber
#

In that case, will it be possible to add something like an authorization code, which in this case we devs can set?

short forge
#

posting this ss in case someone can help

twin dirge
#

@snow fiber Didn't think of that. Heh.

amber junco
#

@vital anvil .NET Framework 4.6.1 implements .NET Standard 1.4 apparently. is there a way to backport the api to that?

vital anvil
#

That seems weird

#

I'd prefer to keep it on a more modern version to make sure people keep out of dotnet 1.x versions :shudder: that was hell

#

1.6 should do, just update to a more recent .Net framework, nothing bad will happen to your code other than having either more language features or performance improvements 👍

#

I'd also highly recommend dotnet core for bots, as it is designed for lasting microservices instead of desktop clients

snow fiber
#

Hmm would be neater tho to have DBL send it as a header

snow fiber
#

How often is /bots/id/votes updated btw?

vital anvil
#

No other webhook does that I guess

#

As their function is to send from server to server

#

🤔

#

No idea about the update

#

As long as it is not every request

ashen hull
#

What is the value "legacy" in getting information on a bot?

inner venture
#

@azure pollen do you have any idea

#

or do we haev to ask tonkku

azure pollen
#

tonkker does the API sorry fren

inner venture
#

reee

sick temple
#

Does the API ever in any case send anything with any "expires" tag?

restive otter
#

how do i show servercount

tawdry spindle
restive otter
#

yeah i dont understand

#

x

#

d

inner venture
#

What language are you uding

restive otter
#

js

inner venture
#

Try the js lib :p

restive otter
#

k

half delta
#

Does this channel also count bugs with the API docs website?

junior goblet
#

yes

half delta
#

Okay.

junior goblet
#

actually if its a bug on the docs page itself i'd put it in #267327844357636097 because i think by "SUGGESTIONS/HELP/BUGS" in the topic it means bugs with the api itself

half delta
#

👌

#

well

#

it does say "AND API DOCS"

junior goblet
#

it does but oliy told someone to put a bug within the docs page on #267327844357636097 so ¯_(ツ)_/¯

#

i suppose it doesn't really matter

half delta
#

idk

sudden rampart
#

@ashen hull legacy: true if hasn't edited since beta was announced may disappear at some point

golden wind
#

or since 31st Dec 2017

#

(oliy gave me that)

clever viper
#

@short forge Little late, but if you still have the json issue, ' isn't a valid character, it must be "

restive otter
#

Can someone give me an example of discord.js dbl

normal sleet
#

look on the api docs

restive otter
#

I made the const, what to do next

#

@normal sleet I have seen it

normal sleet
#

it has everything there

restive otter
#

I couldn't find there

normal sleet
#

did you look in the js section

restive otter
#

I did

#

but I couldn't find anything

normal sleet
#

are you trying to get dbl server count with the api?

#

because if so it's in there

restive otter
#

@normal sleet Yup

#

@cobalt ruin I want to server count with teh api, I have done making const but after I am not getting help from api.

queen nimbus
#

true if hasn't edited since beta was announced may disappear at some point

sick temple
#

again, Does the API ever in any case send anything with any "expires" tag?

#

i really need that information

vagrant kayak
#

It doesn't because fuck CloudFlare

sick temple
#

? because ONLY when sending stuff to the list, it does not work. i dont have the exact error, but i remember it being about some "expires" tag being unknown

vagrant kayak
#

Well if anything is weird you can blame CloudFlare in all honesty

#

Unless you mean a different type of "Expires" (not Ratelimit) then it might be the cache

sick temple
#

why cloudflare, if its being hated?

golden wind
#

because it allows dbl to not be ddosed and prevent access to certain sensitive data

#

more easily than if oliy were to code it himself

cobalt ruin
#

we are hoping to move away from cloudflare for our ratelimiting service soon.

humble bison
#

hey guys, why is this happening when i try updating my server count?

0|givaway  | { Error: Cannot find module 'discordbots-api'
0|givaway  |     at Function.Module._resolveFilename (module.js:538:15)
0|givaway  |     at Function.Module._load (module.js:468:25)
0|givaway  |     at Module.require (module.js:587:17)
0|givaway  |     at require (internal/module.js:11:18)
0|givaway  |     at Object.exports.run (/home/tony/Givaway/commands/usc.js:8:33)
0|givaway  |     at Client.client.on.message (/home/tony/Givaway/givaway.js:22:17)
0|givaway  |     at emitOne (events.js:116:13)
0|givaway  |     at Client.emit (events.js:211:7)
0|givaway  |     at MessageCreateHandler.handle (/home/tony/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
0|givaway  |     at WebSocketPacketManager.handle (/home/tony/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65) code: 'MODULE_NOT_FOUND' }
cobalt ruin
humble bison
#

alright, i'll switch over

cobalt ruin
humble bison
#

changed over now, i got another error haha but i'll put it in #development since its a handler error, thanks though blobsmile

short forge
#

@clever viper yep, perfect

#

ty

humble bison
#

i've ended up manually updating my count for now ^^

tame kindle
#

@humble bison that's my npm package 3Deyes

humble bison
#

oh

plain timber
#

for the js api, since it returns true or false in the promise, how do I check whether it is true or false?

#

for hasvoted

uncut crystal
#

await is a thing

sudden rampart
#

(async()=>{await thing()})()

tame kindle
#

@sudden rampart no async function your() {}

#

or that.

restive otter
#

Is there a python API

spiral crypt
#

prob

junior goblet
golden wind
#

@restive otter the documentation on the dbl site is wrong, use the documentation on github

#

@arctic arch pls update kthnx ❤

arctic arch
#

uhh

#

pls