#topgg-api

1 messages · Page 30 of 1

restive otter
#

unless it's somehow related to dbl api

radiant summit
#

Idk why my webhook don't detect vote event

#
dbl.webhook.on('vote', vote => {
        console.log(vote);
      });
#

don't work

arctic arch
#

have you

  • saved your webhook details
  • checked that the url is valid
  • made sure the port is open to the public
radiant summit
#

Idk for the 2 last

#

"- checked that the url is valid" i put the url given by discord

arctic arch
#

I see
that's wrong

#

its not a discord webhook

radiant summit
#

also what need i to do ?

arctic arch
#

you need the url to point to the machine your bot is running on

radiant summit
#

with the port 5000 ?

arctic arch
#

yes

radiant summit
#

okay

arctic arch
#

or whichever port you choose

radiant summit
#

i'll test

arctic arch
#

yeah, you just need to replace the 0.0.0.0 with your public ip

long spade
#

Until today, my vote check command worked perfectly, but it isn't working anymore. Were there API changes?

restive otter
#

does this kill you

restive otter
#

yes everytime

proper umbra
#

So could I get an ELI5 on what exactly webhooks are for Discord?

lean wave
#

You can post messages to a discord server with http requests

proper umbra
#

Can people use them to post other servers?

lean wave
#

Webhooks are for a specific channel in a specific server

#

So no

shut ibex
#

you can use ifttt for webhooks and discord

lean wave
#

I didn’t know what that was before but that’s pretty legit

proper umbra
#

So you cannot use webhooks to post links for other servers? I just want to make sure I'm understanding correctly.

lean wave
#

You can use them to post links yes. They can pretty much post whatever a bot can post. You can’t post in other servers

tidal burrow
#

a webhook doesn't have a target channel or server, it will post only to a specific channel where the webhook's url leads to

lean wave
#

Yes

#

^^

tidal burrow
#

which is the channel where the webhook was created by having manage webhooks permission in the server

proper umbra
#

Okay

#

Thank you

pseudo patrol
#

thonk is it just me or the webhook is stucc

#

postman can post to it fine as dbl has been stucc for 5 hours since last post recieved

hollow wraith
#

yeah ive gotten 3 reports of broken webhooks

tidal burrow
#

what does {bot.id?} mean? I mean the ? at the end

sudden rampart
#

optional

tidal burrow
#

so I can just do /bots/stats and it will work?

light crag
#

it probs uses your token to get bot

tidal burrow
#

yes, but I need to know if bots/stats is what I should use then

sudden rampart
#

you can do either

timid nexus
#

Webhooks are dead right?

charred portal
#

So I am a little confused about how the webhooks work. And by little I mean very.
I am using the example give by Tonkku in pinned messages but I am having no luck.

const config = require('./config.json');
const DBL = require('dblapi.js');
const dbl = new DBL(config.webhook_secret, { webhookPort: 5000, webhookAuth: 'Not_For_Your_Eyes' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(vote);
  // Do what you need to do
});

I got it to log the running part, but when someone votes, it doesn't log it in the console. Any ideas?

P.S. I am new to this webhook stuff and google isn't helping.

arctic arch
#

there seem to be problems with webhooks on our side again right now

charred portal
#

Okay. Thank you.

timid nexus
#

Hoe Lee Fuk

#

Webhooks are working again by the looks of it

shut ibex
#

finally

arctic arch
#

👍🏻

charred portal
#

To my understanding, lets say I want to use a Discord Webhook to send whoever voted for my bot into a channel, the URL option on DBL would be the discord webhook, correct?

vagrant kayak
#

no

#

DBL webhook != Discord webhook compatible

mystic wing
#

If you are still having problems

charred portal
#

Thank you Saddy.

#

yourhostname I have a friend who is hosting my bot sooo what would this be?

vagrant kayak
#

an IP

#

well specifically theirs or a domain that points to their IP

charred portal
#

So what kind of IP. The IPv4 or the IPv6?

arctic arch
#

either one should be fine

#

I haven't tested any IPv6 tho

charred portal
#

And it would go to the url field of the webhook settings?

shut ibex
#

yes

charred portal
#

So the entire webhook url would be someiphere/dblwebhook?

arctic arch
#

dont forget http(s)

#

and :port

charred portal
#

So what would the port be? So sorry if I sound noobish

arctic arch
#

what you set it to

charred portal
#

So the port can be anything, as long as it matches in the code?

loud gulch
#

i guess

#

any open port

charred portal
#

Okay. In my url I have the following:http://IPv4Address:port/dblwebhook
And as dbl in my code, I have: const dbl = new DBL(client.config.dbltoken, { webhookPort: 25300, webhookAuth: 'lolno' });
And when the bot starts, it says Connected to http://0.0.0.0:port/dblwebhook
Here is the code:

#

fffs

#
const DBL = require('dblapi.js');
module.exports = client => {
    const dbl = new DBL(client.config.dbltoken, { webhookPort: 25300, webhookAuth: 'lolno' });
    dbl.webhook.on('ready', hook => {
      console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
    });
    dbl.webhook.on('vote', vote => {
      console.log(vote);
    });
}
mystic wing
#

It says that for some reason

#

Try testing it to see if it sends

#

Also make sure the port is enabled

charred portal
#

It doesn't log anything within the console

hollow wraith
#

Anyone having issues with discord webhooks, dm me

uncut crystal
#

@hollow wraith you fr

hollow wraith
#

Wym?

uncut crystal
#

this is a public channel for a reason

#

smh

hollow wraith
#

I get shamed for trying to help people get upvote webhooks for discord working until they can get their own server set up.

#

So instead of having a 10 minute fight with turtle, if they are having trouble they can dm me if theyd like

uncut crystal
#

We've made our stance on your "solution" clear in the past. "anyone having issues DM me" isn't how things work or how they will work

hollow wraith
#

K and so when turtle starts a fit over me posting, only when people ask about discord webhooks, i should..?

uncut crystal
#

We've talked about this. If someone explicitly asks for what your service does, post webhooks to a Discord textchannel, you can tell them about it.

#

Turtle "starting a fit" is a different matter

hollow wraith
#

Understood

charred portal
#

Welp, aside from all of this. Anyone know what the issue is with my inquiry?

uncut crystal
#

👍

#

@charred portal What do you have port listed as?

charred portal
#

The default 5000

#

I'm not too sure on how the whole ip and port work

uncut crystal
#

well if you're sending your webhooks to 5000 and listening to 25300, you won't get anything

#

it has to be the same value

charred portal
#

Okay. And also to confirm, I should be using the IPv4 Address?

uncut crystal
#

Yes

#

the IP address of your machine

charred portal
#

Do I have to enable port forwarding?

uncut crystal
#

if you're hosting on a home computer, probably

#

if you're hosting on a cloud machine and you pick a free port, no need

charred portal
#

Well, its a friend's server. So not sure.

uncut crystal
#

if it's a cloud server you're probably good, yeah

charred portal
#

Okay. I'll ask him about that. And the port can be any number, is what I am understanding. As long as they match

uncut crystal
#

aside from occupied ports, yeah

#

setting it to 80 is a bad idea, for example

charred portal
#

So how do I know if it is occupied or not?

hollow wraith
#

Savitar. If you dont get it figured out, i have a service for the discord webhooks u mentioned. Ping me if u try all u can

uncut crystal
#

that's.. no.

#

not what he asked

charred portal
#

Dude you gonna get banned.

hollow wraith
#

?

#

To my understanding, lets say I want to use a Discord Webhook to send whoever voted for my bot into a channel, the URL option on DBL would be the discord webhook, correct?

dapper copper
#

he didnt ask for specific Webhook setup help

uncut crystal
#

he doesn't want to send it into a channel

dapper copper
#

he wanted help setting up the url/port

charred portal
#

^^

shut ibex
#

i have been mentioned

uncut crystal
#

Consider it your last warning, I've had enough of it @hollow wraith

#

unless someone EXPLICITLY asks for a service to send vote webhooks into a DISCORD TEXTCHANNEL

#

you don't have to shill it

#

@charred portal in your code, if you specify an occupied port it'll throw an error

#

at least it should

#

it'll probably throw an EADDRINUSE

shut ibex
#

I like how no one understands what i mean but k

#

¯_(ツ)_/¯

#

i aint gonan start it

charred portal
#

Okay. Here is what I know:

The URL field needs to be http://IPv4Address:port/dblwebhook
The Authorization can be like a optional password, and has to match the code with webhookAuth
Port can be any series of numbers, as long as they match and are available.
Port Forwarding may have to be enabled.

Now, my final question: Where would the dbl code go? In my app file or under the ready event?

dapper copper
#

i dont think it has to be /dblwebhook

restive otter
#

the dbl code goes in your app file

#

there are seperate events

mystic wing
#

@dapper copper that is the default defined in the bot edit page

restive otter
#

some dbl code goes into ready

charred portal
#

Okay. Thank you all!

restive otter
#

cool

#

thx @arctic arch for pinning the webhook example

sullen raptor
#

-bots @scenic trail

abstract mothBOT
#
xXBuilderBXx#8265
Bots <:dblCertifiedDev:401725450470031362>

@wary dove dblCertified
@daring citrus
@plush echo
@eternal egret
@thorn oracle

scenic trail
sullen raptor
#

I couldn't think of a better channel lmao

scenic trail
#

You're a bot dev man GWmythiFeelsBadMan

sullen raptor
#

oh

#

didnt think of that

#

._.

#

oof

blissful lake
#

-bots @blissful lake

abstract mothBOT
#
TehPig ✅#9063
Bots

@unkempt kiln
@shell galleon

pseudo patrol
#

@blissful lake

reef goblet
#

are there any auto role bots??

#

cause i cant find any

arctic arch
reef goblet
#

thx

arctic arch
#

this is for the api

green kayak
#

photoblobsù

charred portal
#

URL Field: Check
Authorization same: Check
Port the same and open: check
Port Forwarding enabled: check

Still not working

restive otter
#

How do you generate a token for the bot on the site? ^^ '

proud sphinx
#

you go to bot -> edit -> go to webhook section

#

the token is there

restive otter
#

Oki thank you :3

proud sphinx
#

np

charred portal
restive otter
#

I do not understand ;-;bay Une exception s'est produite : Error SyntaxError: Unexpected identifier c:\Users\Sarah\node_modules\dblapi.js\src\index.js:79 async postStats(serverCount, shardId, shardCount) { ^^^^^^^^^ SyntaxError: Unexpected identifier at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object.<anonymous> (c:\Users\Sarah\node_modules\dblapi.js\index.js:1:80)

shut ibex
#

show code

restive otter
#
const Discord = require('discord.js');
const fs = require("fs");
const Client = new Discord.Client();
const experience = new Set();
const DBL = require("dblapi.js");
const dbl = new DBL('token', client);
// ...
#

@restive otter the error means your code is baaaaaad

#

Xd Jk

#

;-;

shut ibex
#

@arctic arch ^

restive otter
#

it met me this error when I add that js const DBL = require("dblapi.js"); const dbl = new DBL('token', client);

arctic arch
#

update node to version 8 or higher

restive otter
#

how ? ;-;

charred portal
restive otter
#

Oh

#

It's good, I'm idiot ^^ '

signal kelp
#

.

hollow wraith
#

Savitar, you get helped?

charred portal
#

Its not even working with the test

hollow wraith
#

how is hook defined in that code? that lib just knows the webhook is a vote?

charred portal
#

its defined in the webhook.on event

#

It logs everything and such. But when I test it, it doesnt log

hollow wraith
#

not even an incoming request.. perhaps a firewall issue?

charred portal
#

Port forwarding is open

hollow wraith
#

when i ran my webserver, i have to do portforwarding through my router and allow it through my firewall seperately

#

tried all of that for these webhooks and never worked. but its worth a shot for you

charred portal
#

Okay, how would i go about doing that? Windows 10 computer that is

hollow wraith
#

any firewalls other than default windows firewall?

charred portal
#

Nope

hollow wraith
#

ofc do port 5000 instead.. iirc u used 5000 yesterday

charred portal
#

It changed but nonetheless

#

So lets say my bot is running through visual studio code, what would be the app to allow through the firewall

hollow wraith
#

should just be an inbound TCP rule for port xxxx

charred portal
#

Aha. So it should be TCP instead of both.

hollow wraith
#

both may not hurt, if u have that option. mine only lets me select either or

hollow wraith
#

hmm no.. i confused myself.. wouldnt a webhook be coming from port 80 or 8080?

arctic arch
#

doesn't matter what port

hollow wraith
#

how does the webhook know to use the port specified by your server

arctic arch
#

in the url

#

ip:port

#

or domain:port

hollow wraith
#

oh i see, so you dont even need portforwarding just make sure that port is open

sudden rampart
#

if you're behind cloudflare you need to use a supported port

arctic arch
#

port forwarding opens the port

hollow wraith
#

just specified port to specified port though

restive otter
#

How do I do with the API to get the number of votes my bot has on the site?

#

Please

#

I have a lot of trouble with the API ^^'

sudden rampart
#

GET /api/bots/:ID

#

parse the json

#

get the "points" field

restive otter
#

I do not understand

#

Sorry I'm French and I'm bad with that

#

I do not know if it's possible but I would like to put on my bot the number of votes he has on the site. My bot is in js.

#

And I do not understand anything at the API

#

D:

hollow wraith
#

The api wont post the stats i dont think.. seems people have been using snekfetch to send requests

loud gulch
#

i use the library

#

which uses snekfetch

clever rock
#

is there something on dbl api that lets u fetch the user id of votes instead of has voted

hollow wraith
#

Most people use webhooks for that

#

I think the 2 methods in the api for upvotes are depreciated, well 1 is, and the other is supposed to get all votes in the last 24 hours. But it doesnt clear after 24 hours.

#

@clever rock what language are you writing kn

#

In*

clever rock
#

js

hollow wraith
#

Tonkku pinned a webhook listener example in this channel, id would recommend going that route

clever rock
#

clarification do webhook need a 3rd party server or nope? cause Im pretty still confused on it

#

is it like a a websocket or not really

hollow wraith
#

It would be running along side your bot

#

So your bot code would technically be the server

clever rock
#

will that not cause issues? on sharded bot?

raven zinc
#

actually that would

#

you'd have to start the server from the master process

#

so you don't start multiple servers on the same port

clever rock
#

so inshort, in the sharding file itself? the one that manages the shards

raven zinc
#

yes and then you'd need to communicate to the shards the data of the webhooks from the master

#

if you're using d.js

#

(actually d.js v12 has internal sharding though so it's not neccessary)

clever rock
#

yep d.js so I need to pass the data to shards or just specify the port per shard to listen

raven zinc
#

it would be better to only start one server

hollow wraith
#

That wouldnt work. Because you can only put one link into dbl.. right?

raven zinc
#

oh

hollow wraith
#

What are u planning to do with the user id Saya?

clever rock
#

imitate the has voted

light crag
#

why

clever rock
#

w/o the use of api req

light crag
#

o

#

receive the data of userid

#

check if any of the shards has access to that user

#

well

#

idk

hollow wraith
#

But like. U want to dm them? Or just give them something? Is it something that can be handled in a database?

#

Im not familiar with sharding, so i may not be the best person to answer. I set the user id in my database with a bool of hasVoted and a time stamp of when it was recieved, then check their hasVoted status vs any commands available to users whove voted

raven zinc
#

using a database would work

clever rock
#

just give them stuff

raven zinc
#

if the database supports multiple connections that is

clever rock
#

I plan to use a map for it

#

or an enmap if persistent

sudden rampart
#

i use a webhook and redis

#

set votes:<ID> to 1

#

and expire in ~36h

simple salmon
#

02

feral cipher
#
@bot.command(pass_context=True)
async def serverinvite(ctx):
    invitelinknew = await bot.create_invite(destination = ctx.message.channel, xkcd = True, max_uses = 100)
    await bot.send_message(ctx.message.channel , "Here is a Invite Link For {}\nMax Uses 100\n{}".format(ctx.message.server.name , invitelinknew))

        
#

why not work

#

-Python-

sullen nymph
#

Any errors?

#

Maybe try removing the xkcd = True in defining invitelinknew?

#

And in send_message, use invitelinknew.xkcd.

calm torrent
#

why not juzt use await bot.say , destination is also not defined

sullen nymph
calm torrent
proud sphinx
#

Xkcd GWqlabsKek

finite halo
#

List<String> voterIds = api.getVoterIds("bot id");
Has been giving me an error [JDA MainWS-ReadThread] ERROR org.discordbots.api.client.retrofit.GenericCallAdapterFactory - Error while executing request to https://discordbots.org/api/bots/mybotsID/votes?onlyids=true is there something i did wrong?

rustic acorn
hollow wraith
#

yes 0.0.0.0 would be changed to your VPS IP public ip address

#

@finite halo that may be the method with a depreciated endpoint

rustic acorn
#

Thank you

finite halo
#

@hollow wraith well I was using the example from the docs

hollow wraith
#

Yeah i did too. One of them is depreciated, the other doesnt work as it should. Webhooks are you best option for detecting upvotes @finite halo

dull viper
#

Hey, I'm on mobile and I don't know how to get bots onto my server

idle berry
#

same way you do on a computer @Dispatch#4169
just not a very fun process on a phone

#

o rip

viscid sphinx
#

Do we need some kind of auth on this?

restive otter
#

For some, you use your a token provided on the My bots section on the discord bot list api docs

restive otter
#

so i am trying to use the webhook option on discord bot list and its sending to dblwebhook how do i send to the webhook i have provided?

full socket
#

@restive otter can you elaborate more?

restive otter
#

@full socket

full socket
#

@restive otter the webhook format is not compatible with discord's webhooks

#

You need to make your own webhook receiver

restive otter
#

hmmm you mean in my coding?

light crag
#

You need to host a webserver that can handle post requests

restive otter
#

is there doc that i can read to understand that more i have never used webhook with js before

light crag
#

Have you ever used expressjs?

restive otter
#

no

light crag
#

o

#

Search up how to use that

restive otter
#

ok will do thanks

restive otter
sudden rampart
#

it'll show after 1 hour

restive otter
#

^

#

ok

#

thx

sudden rampart
restive otter
#

do you also know what setInterval does?

mystic wing
#

or also put it without the interval in the ready event @restive otter

full socket
#

@mystic wing nah not the ready event. That is only called once. The guildcreated event is more like it

#

And guilddeleted

#

or w/e they're both called

light crag
#

that is why he has an interval

mystic wing
#

I mean for the start (so he can tell if it is working)

oblique karma
uncut crystal
#

see channel topic

distant flare
#

If posting to the stats domain return a 403 this host is not accessible, what does it mean

shut ibex
#

403 is forbidden error

#

which means you didnt provide the proper credentials

distant flare
#

Someone is getting this js 0|main | { Error: 403 This host is not accessible. 0|main | at _response.transport.request.then (/root/forbidden-bot/node_modules/snekfetch/src/index.js:182:21) 0|main | at <anonymous> 0|main | at process._tickDomainCallback (internal/process/next_tick.js:228:7) 0|main | request: undefined, 0|main | body: <Buffer 3c 21 44 4f 43 54 59 50 45 20 68 74 6d 6c 3e 0a 3c 68 74 6d 6c 3e 0a 20 20 3c 68 65 61 64 3e 0a 20 20 20 20 3c 74 69 74 6c 65 3e 34 30 33 20 54 68 69 ... >, 0|main | raw: <Buffer 3c 21 44 4f 43 54 59 50 45 20 68 74 6d 6c 3e 0a 3c 68 74 6d 6c 3e 0a 20 20 3c 68 65 61 64 3e 0a 20 20 20 20 3c 74 69 74 6c 65 3e 34 30 33 20 54 68 69 ... >, 0|main | ok: false, 0|main | headers: 0|main | { date: 'Mon, 28 May 2018 22:30:53 GMT', 0|main | 'content-type': 'text/html; charset=utf-8', 0|main | 'transfer-encoding': 'chunked', 0|main | connection: 'close', 0|main | 'set-cookie': 0|main | [ '__cfduid=d2ee95068d9f5dd471c88fc83e8c3668a1527546653; expires=Tue, 28-May-19 22:30:53 GMT; path=/; domain=.discordbots.org; HttpOnly; Secure' ], 0|main | 'x-varnish': '872153839', 0|main | 'retry-after': '5', 0|main | 'strict-transport-security': 'max-age=15552000; includeSubDomains; preload', 0|main | 'x-content-type-options': 'nosniff', 0|main | 'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 0|main | server: 'cloudflare', 0|main | 'cf-ray': '42242b184fdd91ac-EWR', 0|main | 'content-encoding': 'gzip' }, 0|main | statusCode: 403, 0|main | statusText: 'This host is not accessible.' }

shut ibex
#

what url

#

like what are you trying to access

distant flare
shut ibex
#

did you set your token in the header

distant flare
#

Always do

shut ibex
#

are you posting?

vagrant kayak
#

The host isn't accessible, nothing related to their headers

#

CloudFlare is the returning server

distant flare
#

Yes Jam

restive otter
#

But it's not just that url that doesn't work. Every url I enter into snekfetch doesn't work.

vagrant kayak
#

wait what

pure kernel
#

@restive otter

winter sequoia
#

how do i do this?

#

How do I check if a user votes?

proud sphinx
winter sequoia
#

my brain is burned

#

Would you show me a sample command?

restive otter
#

look at the docs. it’s there

restive otter
#

is it if (message.content.startsWithprefix + "invite"); or if (message.content.startsWith(prefix + "invite"); ?

viscid sphinx
#

Second one.

#

Actually, neither.

restive otter
#

Ok

loud gulch
#

how does this relate to the dbl api?

fickle flicker
#

wrong channel

#

kek

restive otter
#

I'm getting this error when I run a command that checks if a user has voted for the bot.

#

The code is something like

if (message.content.startsWith(prefix + "store")){
  const { body } = await snekfetch.get(`https://discordbots.org/api/bots/430775188448083988/check?userId=${message.author.id}`)
    .set({ Authorization: "myToken"})
  if (`${body.voted}` !== "1"){
    return message.channel.send("vote for the bot noob").then(message => message.delete(300000))
  }
  console.log('worked')
  return undefined;
}```
elfin solstice
#

@restive otter your token might be wrong

restive otter
#

that's what i thought but i just compared it and it's the same token

elfin solstice
#

try to regenerate it

#

on the dbl api site

restive otter
#

alright

arctic arch
#

the this host is not acceptable part is bothering me

#

it should be saying 403 forbidden, but what is this

uncut crystal
#

snekfetch memes

arctic arch
#

afaik snekfetch never says that

shut ibex
#

it does

#

snekfetch says it sometimes

arctic arch
#

it should have forbidden for 403

restive otter
#

it was working fine all of yesterday and i just ran the command today without any code changes

#

and im getting that error

elfin solstice
#

Tonnku im sure snekfetch is just showing the responded status code Thonk pretty sure thats not snekfetch and rather than the DBL API

arctic arch
#

this host is not accessible is not a status code tho

elfin solstice
arctic arch
#

when did that error change

#

it was 403 forbidden the last time ive got a 403 myself

restive otter
#

sooooooooo should i work around that issue or is someone going to get back to me on that

violet crane
#

can I get the amount of servers a bot is in from the API?

#

nvm

hearty lintel
#

Would it be possible to display stats on my website by taking them from DBL?

snow fiber
restive otter
#

or use window.fetch

hearty lintel
#

server_count = xmlHttp.responseXML()

#

I have this and it responds with the xml yada yada

#

But How would i grab specifically server_count?

violet crane
#

use the key?

#

Umm all of a sudden my bot's server count shows five in the api even though my bot still says 47?

#

nvm

#

just fixed itself

#

but it's only fixed in the api

#

not on the actual page?

restive otter
#

could be cache error, CTRL + F5

plain timber
#

does anyone still have a keyboard with actual function keys

uncut crystal
#

yes

plain timber
#

they arent used for anything else?

uncut crystal
#

they're dedicated buttons, yes

plain timber
#

true

clever rock
#

something is bothering me with webhooks. how can we sync the time that the user voted on webhooks?

shut ibex
#

What do you mean by that

snow fiber
shut ibex
#

The webhook take a min or two to send so I believe the timestamp is when the webhook was sent

cunning forum
#

I still dont get why webhooks aren't instantly sent

#

That doesn't seem like much of a challenge

shut ibex
#

Tonk said it's because of caching

arctic arch
#

did I

#

there's a queue

#

it happens instantly if there's no line waiting

dull thunder
#

will you send an email to me when u decline my mod application ??

robust hinge
#

this is with my id and i upvoted

proud sphinx
#

It isn't?

#

It does for me

surreal junco
robust hinge
#

hmmm

proud sphinx
#

Read the response

#

You need to add authorization header

surreal junco
#

^

robust hinge
#

hmmm wdym?

#

i need to do it with my api token?

proud sphinx
#

Read the docs, basically you need to add your token

#

In a header

robust hinge
#

ok

#

somlike post server count

#

just with GET?

#

so like*

proud sphinx
#

POST server count

robust hinge
#

wow

#

caps

tidal burrow
robust hinge
#

?/

tidal burrow
#

optional

robust hinge
#

i know how to post server count?

#

yes, ik

tidal burrow
#

o wait

robust hinge
#
const superagent = require('superagent')

superagent.get('https://discordbots.org/api/bots/365958655926992896/check')
  .set('Authorization', 'BOT_TOEKN')
  .query({ userId: '231733082804322304' })
#

how do I store the result?

#

like, store "Voted"?

arctic arch
robust hinge
#

yes, but this is question about the api?

#

api related thing

arctic arch
#

you're asking how to store the response from a http request and that is no longer related to our api

robust hinge
#

hmm

#

ok

#

fair enough

winter sequoia
#

How do I do the dbl event?

#

if someone give votes

hollow wraith
#

Webhooks are your best bet

winter sequoia
#

thanks

hollow wraith
#

Are you using JS for your bot?

restive otter
#

Is there documentation on how to setup my bot to see who has upvoted?

viscid sphinx
restive otter
#

Thank you

restive otter
#

where is the webhook being sent if it isnt sending to the channel i specified?

arctic arch
#

it's not a discord webhook

restive otter
#

oh what is it exactly then?

arctic arch
#

you're supposed to listen to it in your bot and receive the vote events

restive otter
#

thats not coming through either looks like i need to do some more reading

arctic arch
#

what language are you using

restive otter
#

dbl.webhook.on('vote', vote => {
console.log(User with ID ${vote.user} just voted!);
});

vast junco
#

is that all u have

#

or is it just erroring there

loud gulch
#

do you even need a webhook Thonk

restive otter
#

i dont have error

vast junco
#

because the eg webhook should still work

restive otter
#

wait

loud gulch
#

how much votes do you even get a month

restive otter
#
  console.log(`User with ID ${vote.user} just voted!`);
    client.channels.get('275047183055847439').send({embed: {
        color: 3447003,
        author: {
          name: client.user.username,
          icon_url: client.user.avatarURL
        },
        description: `**${vote.user}** Oy Verdi!\n Botumuzu Desteklediğin İçin Teşekkürler!\nSende Destekelemek İçin\nhttps://discordbots.org/bot/412522145458159618/vote`,
        timestamp: new Date(),
        footer: {
          icon_url: client.user.avatarURL,
          text: "© Mcadventuretime.com"
        }
      }});
});
loud gulch
#

you dont need a webhook until you get lots of votes a month

#

1k i think

#

or more idk

vast junco
#

what

loud gulch
#

meh

vast junco
#

ok

restive otter
#

hmm

#

i have 22 vote

#

now

#

what can i do

light crag
#

Where are you hosting?

blazing mantle
#

hi

blazing mantle
#

cya

spiral isle
#

is https://discordbots.org/api/bots/id/check?userId= only for bots with < 1000 votes?

proud sphinx
#

No

#

Check is for everyone to use

shut ibex
#

But check only returns whether the user voted in the last 24 hours

restive otter
#

How ı get api key

#

you need a bot on here

#

Okey ı add my bot

#

Tjx

#

Thx

finite halo
nimble mortar
#

would it be against api rules to give users say 50 coins in my bots currency if they upvoted every 24 hrs?

restive otter
#

as long as you can get coins without voting, sure

nimble mortar
#

yeah you can get upto 100 coins every 5 min from a usual cmd

#

so its not abuse, thx 😛

#

i'll add that feature when i add my bot

sudden rampart
#

@finite halo i wouldn't recomment using unirest

#

it's really badly designed + doesn't follow the http spec properly

nimble mortar
#

rip the dbl api

restive otter
#

@arctic arch javascript is my language I am using

#

sorry just seen you replyed

blazing mantle
#

heiii

sand hazel
#

POST bots/stats adds up all the shard's guilds size?

arctic arch
#

@restive otter then I recommend dblapi.js

finite halo
#

@sudden rampart its currently working how else would i do it?

dreamy rain
#

okhttp is generally accepted as the standard http lib right now

hollow wraith
#

does it take a bit sometimes after a person upvotes to check the /check/ endpoint?

#

ah took about 3 minutes.. nm

arctic arch
#

an old result can be cached

surreal junco
#

^ if you do the requests in your browser you will see that it is instant

long spade
#

If you have problem with caching of the result (e.g. user used command to check for vote but didn't vote and now used it again after he voted but still shows he didn't vote), add a random number as a parameter. ?anticache=181818171716616 (you should use a libary for generating it)

arctic arch
#

that wont help

#

it's a cache on our servers

restive otter
#

Hello, can you please help me for the webhook, I do not understand how to make it work ^^'

arctic arch
#

how far are you so far

restive otter
#

and I installed the API

arctic arch
#

or a link to your bot's ip?

restive otter
#

I have put a discordapp link

#

@arctic arch

arctic arch
#

it doesn't send messages to discord channels, it's used to send data to your bot directly

restive otter
#

I do not understand too much, would you give me an example please?

arctic arch
#

there's the example in pins for the code
the url should be something similar to http://12.345.678.910:5000/dblwebhook but with the IP to your bot

Are you hosting on your PC or on a VPS

restive otter
#

on my computeur

sudden rampart
#

you'll (probably) need to open the port as well then

#

(if it isn't already open)

restive otter
#

I'm sorry to waste your time ... I do not understand, I'm too bad, sorry

#

I put that js const DBL = require('dblapi.js'); const dbl = new DBL("token", { webhookPort: 5000, webhookAuth: 'password' }); dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); }); dbl.webhook.on('vote', vote => { console.log(`User with ID ${vote.user} just voted!`); });

#

Webhook running at http://0.0.0.0:5000/dblwebhook
#

But I do not know what to do next

hollow wraith
#

@restive otter the hostname has to be your public ip address

#

if youre running it on a local machine, u will probably have to set up port forwarding in youre routers configuration

deft fable
#

with identifying with discord about your bot shards, is it alright to have the first shard send [0,1] then have the next shard which gets connected correct to [1,3] or would it invalidate the previous shard?

clever rock
#

is the webhook only capable of receiving votes?

calm torrent
#

not a discord webhook

hollow wraith
#

The webhook section in the bot edit page on DBL is for receiving upvotes yes

#

You can make a webhook server to listen for hook in your code for your bot. Or there are other ways. You can set up a webpage and use php to redirect dbl webhook to discord

flat folio
#

I seem to be getting 401: Unauthorized, i didn't change my token, didn't regen etc. Just restarted my bot and this starts happening

#

The post works on startup, but doesnt on a JoinedGuild or LeftGuild event

#

Does this have to do with my code or has this problem happened before?

flat folio
#

Nevermind, my code.

restive otter
#

So i am trying to set up a command but before use i want it to check if they have voted how would i do this? I'm on the javascript library if anyone could help it would greatly be appreciated

nimble mortar
#

check the api docs and the dblapi.js npm package

#

it has a vote thing

restive otter
#

I have but I'm not understanding the documentation is there an example of it anywhere?

nimble mortar
restive otter
#

I have that in my code already

nimble mortar
#

well thats how you'd check if a user has voted

#
if (command === 'voted') {
    dbl.hasVoted("95579865788456960").then(voted => {
           if (voted) return msg.reply(`User has voted!`);
    });
}

idk thats how i'd do it roughly

restive otter
#

you could use a webhook then insert into a database GWcmeisterPeepoShrug

#

because if you get 1000+ you’re going to need to use a webhook

hollow wraith
#

Or make a get request to the check endpoint

frosty gale
#

hey boiiiii my bot was approved but its not on my list

restive otter
#

@frosty gale you don't appear to have any approved bots, you sure?

sand hazel
#

If I pass an array with each shard's guilds size to POST bots/stats, does it display the shard count (array.length)

frosty gale
#

its on the site

uncut crystal
#

@frosty gale your bot wasn't approved, lol

#

anyhow, not appropriate for #topgg-api, ask in DMs/other channels

sand hazel
#

Who can answer DBL API question?

restive otter
#

no one if you don't ask it

grizzled lake
#

Why doesn't log when someone upvotes

wet zenith
#

could there be a webhook for when someone adds the bot through dbl?

restive otter
wet zenith
#

i feel like id be yelled at but sure

sand hazel
#

@restive otter I asked it above, twice actually

#

No one replied, so I assume no one knew

calm torrent
#

you can use the "bot invite link" to your own website and redirect from there

short forge
#

ye

#

custom website link -> website has script for analytics -> you get report for "someone has added bot"

thorny parrot
#

JavaScript -- Can I get the total votes of my bot?

restive otter
#

it's provided by the /bots/botid endpoint, it returns total votes all time and total votes for the month

median cedar
#

is there any way for me to get a number of how many votes my bot has in the last month and overall?

#

oh w8

#

it's answered there

#

i'll take a look at that

#

that's exactly what i needed

past reef
#

Question: How does one get an API Key from DBL?

restive otter
past reef
#

Okay thank you

restive otter
#

how do i get how many servers have added my bot on my profile page?

#

api/bots/bot_id/stats

tidal burrow
#

A site can't know how many servers the bot is in, you have to post to the API manually, check the DBL API docs

restive otter
#

^

#

yeah i didn’t read it properly

#

ahh ok thats what that was for I was wondering sorry dumb moment

#

thanks though

sand hazel
#

Guess I'll ask again, If I pass an array with each shard's guilds size to POST bots/stats, does it display the shard count (array.length)

pliant valve
#

somebody helps me with the webhooks?

light crag
#

What do you need help with?

hollow wraith
#

@pliant valve what language

uncut crystal
#

@sand hazel I believe so, test it and make sure

sand hazel
#

@uncut crystal I'm currently passing in an array with a single item, but it does not display 1 shard

#

So I'm wondering if it's suppose to show something

uncut crystal
#

try passing two, we might just treat calls with 1 shard as normal calls

sand hazel
#

Hm I'll try 2

uncut crystal
#

technically all non-sharded bots are just 1 shard

sand hazel
#

@uncut crystal A payload of [ 217, 50 ] is shown as 217 and no shard on the website

#

I'm passing it through postStats in DBLAPI.js

#

Doc says @param {number|number[]} serverCount The server count of your bot.

#

So I'm assuming it handles array

uncut crystal
#

hmm, weird

#

I'll probably take a look at it when I'm near a PC again

sand hazel
#

Alright, ping me when you do

latent pebble
#

is there a ratelimit for the bot votes endpoint?

arctic arch
latent pebble
#

Thanks

restive otter
#

can't use snekfetch to update server count now, it says 403 access forbidden, so now my server count is wrong

#

what to do

#

show the code

#

it might be wrong url or not set authorization token GWfroggyWeSmart

calm torrent
#

or check ur token again

restive otter
#
.set("Authorization", settings.dbltok)
.send({server_count: bot.guilds.size})
.then(() => console.log(`Updated discordbots.org server count: ${bot.guilds.size}`))
.catch(e => console.log(`Error posting to discordbots.org: ${e.message}`));```
#

token is right

#

copy + pasted it 5 times

charred portal
#

Have you tried awaiting it?

restive otter
#

bot isn't async

#

await is async

#

did the DBLPoster way and I have an error

#

"You need to provide a client to bind to"

#

what does it mean by that?

arctic arch
#

how about dblapi.js 😉

restive otter
#

I got it

robust hinge
#

how do I do such thing?

severe mist
#

Webhook

pliant valve
#

@hollow wraith javascript

arctic arch
calm torrent
#

what are those lines below console.log though GWcfcThonk

arctic arch
#

eslint errors no-console

calm torrent
#

and i want that theme GWcfcThonk

#

oh cos its node?

arctic arch
#

cos I have eslint and a rule that says no console lol

calm torrent
#

o why tho

arctic arch
#

it's for the library, you'd want to get rid of debugging logs before releasing

proud sphinx
#

Tonkku proud of dblapi.js

arctic arch
#

yes very proud

#

I hope that connecting a webhook to an existing webserver will help someone

#

an express middleware probably won't be worth it?

calm torrent
#

ohh

wet zenith
#

hey are upvote webhooks not working or is it just me

surreal junco
#

@restive otter Are they working for you?

#

You answered in general okay then 😂

restive otter
#

Ye

#

They are

wet zenith
#

nvm

surreal junco
#

You're the only one I know using them so you were the only one I could ask xD

restive otter
proud sphinx
#

Tonkku uses webhooks

surreal junco
#

He probably has better stuff to do 😂

sand hazel
#

@arctic arch Ah while you are proud, mind looking at one of my issue, it's above, I talked with Timmy about it, but he wasn't sure

#

It's regarding dblapi

arctic arch
#

the array?

sand hazel
#

Yes, the shards array

arctic arch
#

it should work

#

are you sure the bot page wasn't an old cached version when you loaded it up

sand hazel
#

i'm pretty sure

frosty gale
#

So i got my bot approved and I am looking to us the widget. So i got the id and everything but it dosent have the server count, I added the npm package and set it up but its still not showing servers

arctic arch
#

you haven't managed to post it properly

#

are you getting any errors?

frosty gale
#

no

#

its up

#

but not showing servers

arctic arch
#

show your code

frosty gale
#
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

and

#
    setInterval(() => {
        dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
    }, 1800000);
});```
arctic arch
#

so that's for webhooks when you want to receive votes

#

wait you're just copying and pasting examples from the module page

frosty gale
#

yea

#

but changing the token 😃

light crag
#

setInterval will wait 1800000ms before executing the first time

frosty gale
#

ohh true

arctic arch
#

have you actually placed the code in your bot

frosty gale
#

yes

#

lol

arctic arch
frosty gale
#

Who said pasting and changing wasnt ok?

arctic arch
#

no one

#

it was just weird when you pasted them here

#

anyway

#

those two lines at the bottom are pretty much all you'd need

frosty gale
#

yea

#

i pasted from site bc its on a cloud and didnt feel like getting code lol

#

forgot it had webhook thibng

hollow wraith
#

youre using your public ip yeah?

#

for the webhook listener

restive otter
#

If i am wanting to get if a user votes and connect it to another command to where they cant use that specific command unless they vote how would I do this?

calm torrent
#

query /check or db webhook

restive otter
#

I have tried the db webhook but doesn't return anything even in the console @calm torrent

hollow wraith
#

are you using js?

restive otter
#

Yes

hollow wraith
#

and using the example tonkku posted?

restive otter
#

Yes

mystic wing
#

Is the port forwarded?

restive otter
#

I connected my port forwarding to 5000

hollow wraith
#

yes, make sure to use Public IP address, and make sure portforwarding.. you may need to allow it through your firewall aswell

restive otter
#

How do i connect my ip to it?

hollow wraith
#

you just need the listener.. hook.hostname

#

hostname == your public ip in your code

#

and in dbl webhook url input

restive otter
#

Ahhh i see what you're saying thats what i did wrong

#

Thank you

hollow wraith
#

@restive otter get it sorted out?

restive otter
#

no looks like i got something in there wrong.. even in a test i dont get anything

hollow wraith
#

paste code for the listener

restive otter
#
            console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
            });
        dbl.webhook.on('vote', vote => {
            console.log(`User with ID ${vote.user} just voted!`);
            });```
hollow wraith
#

you hosting locally?

restive otter
#

yes

hollow wraith
#

windows?

restive otter
#

yup

hollow wraith
#

u can try also making a rule in the windows firewall, if you dont have a 3rd party firewall

restive otter
#

I can try that then

hollow wraith
restive otter
#

lol this is so annoying.. Im kinda new to the whole discord.js stuff so Im getting kinda frustrated you could imagine

hollow wraith
#

yeah i went a completely differet route with my webhook

clever rock
#

dbl api get votes is the last 1k votes right? and that includes the user that voted again

restive otter
#

votes from this month

#

from the last month actually

clever rock
#

I mean is, do it always get the last 1k votes only?

restive otter
dull chasm
#

How to setup the webhook for votes, Discord.js?

surreal junco
#

There's an example at the bottom of that page

calm torrent
#

or pins

surreal junco
#

Yeah that too 😂

dull chasm
#

Discord Webhook?

#

Would that work?

junior goblet
#

you'd put the URL to your website

#

where you'd be listening for webhooks

#

it's not the same as a discord webhook

surreal junco
#

Do you even webhooks bruh

arctic arch
#

the amount of people thinking that it's a discord webhook because of the word webhook is way too high

surreal junco
#

Certainly 😂

reef apex
#

no your own webhook -> a http server written to take vote data from dbl

arctic arch
#

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 necessarily be affiliated with t...

#

lol

hollow wraith
#

Well discord recieves data from a POST and displays it. Doesnt a webhook do exactly that?

#

Sends a post request

arctic arch
#

yes but Discord expects certain data

#

I wonder how many other webhooks people have tried to link to discord that are not slack, github, or dbl

hollow wraith
#

A lot, that php thing i wrote gets used a lot. Even more so now that im not allowed to talk about it here anymore. A lot of people have bigger issues with portforwarding and firewall rules. Than just the coding portion.

calm torrent
#

put a disclaimer

arctic arch
#

I added a disclaimer when you actually put in a discord webhook

glass dust
#

so my vote webhook suddenly stopped working and dont know whats wrong, i'm using the javascript library of dbl but the requests just stopped coming trough. Yes i did port forward.

#

plz help

arctic arch
#

I'm not getting them either

#

let's see

glass dust
#

so im not the only one with the problem

arctic arch
#

requests should start flowing through soon

glass dust
#

so, i still dont get any requests, am i still supposed to wait and if so for how long excactly

arctic arch
#

depending on how long it was out, it might take a while

topaz chasm
#

I'm still not seeing vote webhook requests come through.

#

Did anything change in the request body?

glass dust
#

Jup still nothing

arctic arch
#

nothing changed

robust olive
#

haven't got any for about 6 hours blobthinkeyes

pseudo patrol
#

^^

loud gulch
#

are u sure about that?

tawny cargo
#

@thin nova wrong channel

loud gulch
#

stop this shit

tidal burrow
#

that's not an excuse to use a channel strictly for discord bot list api

loud gulch
#

stop the emoji and reaction spam

pseudo patrol
shut ibex
#

they dont tell

glass dust
#

So is the api gonna be fixed

arctic arch
#

yes of course

calm torrent
restive otter
#

*.discordapp.com/*

sand hazel
#

@uncut crystal Any chance you looked at it?

uncut crystal
#

nop

agile plover
#

.help

#

omg that spam though

#

i know, my messages are also considered spam here, sorry for that

glass dust
#

the dbl isn't sending any data to the webhooks, i set up a small server to see every request but none are made. why hasn't it still not been fixed

summer oracle
#

Same. Not receiving any webhooks.

dark pine
#

Hopefully they fix it soon

elder zodiac
#

yup its dependency on nadeko aswell n causing issues came here to say

#

guess u already know

slim reef
#

Same

charred pelican
#

any1 know how to make bots send dms about stuff?

calm torrent
pseudo patrol
#

Webhooks fixed when™

keen jasper
#

ağla

slow lark
#

how do I detect if someone has a specific role (After name, in Discord.JS)

keen jasper
#

daengineer romanmı yazdın kardeşim

slow lark
#

what??

tidal burrow
#

Both of you, wrong channel

glass dust
#

really its like 20 hours later and the webhook still isn't working, it can never be such a big problem that it takes this long to fix. i kinda really need it to be working

slim reef
#

Same people are whining and complaining that they aren’t getting anything from voting ha

glass dust
#

that is indeed the exact problem, now my bot is running on a quick unstable fix

calm torrent
#

just don't do a thing with votes, you won't have this issue

glass dust
#

votes are kinda important to get your bot higher up the rank, pokecord probably has a lot of angry users

tawny cargo
#

just don't use discord lol GWpingKanyeLUL

terse willow
#

Oh I saw that webhooks are oof

#

Or aren't they? Because I tried a test a couple times on 2 different domains and I don't see any request arriving to me

glass dust
#

jup, the webhooks still dont work

restive otter
#

Rip webhooks

sand hazel
#

Seems to be the case here as well, can one of the Web admins update us on this? @arctic arch

wise agate
#

Rip webhooks

glass dust
#

do they not care or something?

wise agate
#

I kinda like have a large feature based around upvotes so like

shut ibex
#

do they not care

#

They do

#

It's just he is doing other stuff

wise agate
#

They are probably just busy yeah

glass dust
#

what makes this less important

wise agate
#

Its a free service

shut ibex
#

Life

#

And oliys exams

#

And also what Kirb said

#

This is a free service

glass dust
#

ok exams is a good reason

wise agate
#

I can wait a bit if Im getting a 85% traffic boost among other things for free lol

glass dust
#

that shit important

dark pine
#

Any announcements on the webhook bug?

light crag
#

They will probs make an annoucement when they fix.

snow fiber
#

afaik there's a webhook queue

fickle flicker
#

fsr the iframe for my site isn't working

#
#

it's not iframing Thonk

arctic arch
#

what does that have to do with the api

fickle flicker
#

wait im in api

#

;-;

timid nexus
#

Are webhooks still fukked????

wise agate
#

@timid nexus Yeah...

#

I kinda hope they are fixed sometime soon - I was expecting a wait but not a 48h wait

timid nexus
#

It's bad timing for me, I released a big update last night and my bug-reports channel is full of ppl complaining about votes so it's more difficult to find the real bugs

glass dust
#

i needed to quickly create a workaround for this, just annoying

restive otter
#

How would I check if a user has voted using their ID?

#

Partner told me that I could do this ^^

glass dust
restive otter
#

Uhu i have

#

But i meant the coding lol

glass dust
#

what do you code your bot in?

restive otter
#

NodeJS

glass dust
restive otter
#

Ugh u aint helpin

glass dust
#

where do you get stuck

#

what have you tried until now

restive otter
#

On the cmd

#

Smart boy

#

Jesus christ

glass dust
#

Sorry, but im trying to help here, but you are just asking for a prefab solution which im not gonna give. Tell me what you have tried, share a snippet of code and what you think the problem may be.

restive otter
#

nah

#

U either dont speak english or have a brain tumor lol

glass dust
#

Well i'm not a native speaker

junior goblet
#

@restive otter if you're going to be an asshole to someone who's just trying to help you, you can leave.

dawn kernel
#

My webhook was working fine for about 20 days

#

Did something change ?

sullen nymph
#

Webhooks are currently down.

dawn kernel
#

oh rip

long anvil
#

what happened 😦

#

and when will they be back?

dawn kernel
restive otter
#

As soon as they want it to be fixed

grand cipher
#

Sorry for any possible ignorance on my part, but what's the endpoint to request to post bot statistics?

restive otter
#

/bots/{bot.id}/stats

tacit forge
#

Hey, so I'm trying to use the Java wrapper for the API, and when I try to get my votes, I get this error:

ERROR org.discordbots.api.client.retrofit.GenericCallAdapterFactory - Error while executing request to https://discordbots.org/api/bots/213151748855037953/votes?onlyids=true

copper stag
#

do you have more than 100 votes?

tacit forge
#

no lol

#

I've only just started attempting to make use of the new voting system

#

because as usual I'm late to all the new trends and stuff

copper stag
#

use webhooks

#

that endpoint is bad

tacit forge
#

I thought webhooks were broken too?

austere swallow
#

Webhooks should be working fine I suppose

glass dust
#

nope, still broke

dark pine
#

So I'm trying to make a workaround, because webhooks are broken right now
Does anyoneone know why this always gives me false?
I'm using NodeJS. And I have voted

dbl.hasVoted(msg.author.id).then(voted => {
    console.log(voted);
});
dark pine
#

Whoops nevermind, my dblapi package was outdated TeeHee

long anvil
#

@arctic arch any update on the webhook situation?

arctic arch
#

investigating

austere swallow
#

rip

spare axle
#

Still have no idea whats the purpose of webhooks

slim reef
#

Web hooks allow you to get messages from dbl instead of constantly checking for new votes (in a nutshell) @spare axle

spare axle
#

We hooks?

austere swallow
#

no webhooks

timid nexus
#

You got it wrong @slim reef

#

Web hooks ALLOWED you to get messages from dbl instead of constantly checking for new votes (in a nutshell)

sour olive
#

Problem with the API

  async postStats(serverCount, shardId, shardCount) {
        ^^^^^^^^^

SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)```

Code :
```bot.on('ready', () => {
    setInterval(() => {
        dbl.postStats(bot.guilds.size, bot.shards.Id, bot.shards.total);
    }, 1800000);
});```

Code redirected :
  ```async postStats(serverCount, shardId, shardCount) {```

Const's like this :
```const Discord = require('discord.js')
const bot = new Discord.Client()
const DBL = require("dblapi.js");
const dbl = new DBL('You have really think I give you my token ', bot);```
#

@arctic arch can you help me ? ^^"

arctic arch
#

update node to version 8 or newer

austere swallow
#

Yesh > v8 node

sour olive
#

ok

restive otter
#

I am trying to get dbl working on my Python bot. However i get this error :

Failed to post server count
Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Traceback (most recent call last):
  File "/srv/NekoBot_Py/modules/dbl.py", line 26, in update_stats
    await self.dblpy.post_server_count()
  File "/usr/local/lib/python3.6/dist-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 "/usr/local/lib/python3.6/dist-packages/dbl/http.py", line 189, in post_server_count
    await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload)
  File "/usr/local/lib/python3.6/dist-packages/dbl/http.py", line 160, in request
    raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}

Anyone any idea's what i am doing wrong here?

#

code:

import dbl
import discord
from discord.ext import commands

import aiohttp
import asyncio
import logging
import config as cfg


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

    def __init__(self, bot):
        self.bot = bot
        self.token = cfg.dbltoken  #  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))
            await asyncio.sleep(1800)


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

line 26 = await self.dblpy.post_server_count()

elfin solstice
#

did you try to reset your token and check if all variables are defined with the correct value?

#

👀

restive otter
#

Same result 😦

sullen nymph
#

@restive otter Does cfg.dbltoken return a string with token?

restive otter
#

yes

#

I seem to have found the issue...
Apperently this was being triggered before the bot had logged in completely.

#

After the 30min refresh the status was updated with no error.

sullen nymph
#

Using on_ready, ftw.

elfin solstice
#

yea you should make sure its ready when executing that code

#

on ready event as example

quick wedge
#

anyone can help me with the api , i'm a beginner with this api and i have this error when i try to get the list of perople who has voted

The Code
// will return a list of the user IDs
List<String> voterIds = api.getVoterIds("[id]");

The error
[JDA MainWS-ReadThread] ERROR org.discordbots.api.client.retrofit.GenericCallAdapterFactory - Error while executing request to https://discordbots.org/api/bots/[id]/votes?onlyids=true

mention me if you have an answer

versed hare
#

@quick wedge its trying to request [id}

#

whis is not an id

versed hare
#

i dont think your supplying the ids right

#

@quick wedge

quick wedge
#

i use the bot id as it's write on the website

#

that not good ?

#

@versed hare

versed hare
#

instead of [id] put your boi id

#

like 166228540214214657

quick wedge
#

yes

#

399115724926484490

#

that what i did

#

i'm going to restart my bot i will see if that time that's good

short forge
#

@ashen glen

#

hm

quick wedge
#

sorry if you see that like an advertise

i have always the same error :

[JDA MainWS-ReadThread] ERROR org.discordbots.api.client.retrofit.GenericCallAdapterFactory - Error while executing request to https://discordbots.org/api/bots/399115724926484490/votes?onlyids=true

But i see the bot return "null" when i print the list

Sorry for my english, it's not my main language !
ping me if you can help me i'm not connected now

hollow wraith
#

try... List<String> voters = new ArrayList();

#

voters = api.getVotersbyId();

sudden rampart
#

won't change anything

#

the ?onlyids query param is ignored now

#

and the wrapper isn't updated

restive otter
#

has webhooks been fixed yet?

shut ibex
#

no

#

tonk is investigating why

#

they aren't working

restive otter
#

ok thank you

restive otter
#

I am using dblapi.js and the webhook has just recently stopped working

#

I haven't changed a thing

snow fiber
#

Webhook is having issues I believe

glass dust
#

Indeed, webhooks dont work at the moment

restive otter
#

webhooks havent worked for a couple days now

#

Oh damn

timid nexus
#

Webhooks still fucked? Any news at all?

calm torrent
#

just be patient lmao... when it's fixed there'll definitely be a message

austere swallow
#

^ yup

fleet relic
#

-owner @alpine hatch

abstract mothBOT
shut ibex
austere swallow
#

👀

dense fjord
#

Is there a delay before you can use your api key?

light crag
#

Probably not.

#

It's just 60 requests per minute limit

dense fjord
#

hmmm got a 403 after I just created the key thought it might be that

light crag
#

What endpoint are you using?

dense fjord
#

Im using dbl.py 2018-06-09T15:45:13.103577+00:00 app[worker.1]: yield from dbl_client.post_server_count() 2018-06-09T15:45:13.103579+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/dbl/client.py", line 100, in post_server_count 2018-06-09T15:45:13.103580+00:00 app[worker.1]: await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no) 2018-06-09T15:45:13.103582+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/dbl/http.py", line 189, in post_server_count 2018-06-09T15:45:13.103583+00:00 app[worker.1]: await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload) 2018-06-09T15:45:13.103584+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/dbl/http.py", line 160, in request 2018-06-09T15:45:13.103586+00:00 app[worker.1]: raise Forbidden(resp, data) 2018-06-09T15:45:13.103588+00:00 app[worker.1]: dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"} think I've found the issue though

#

Nope still broken 😢

sullen nymph
#

Try resetting the token.

#

(You could also not copy the whole thing. retardsmile)

dense fjord
#

You want the whole log?

sullen nymph
#

I don't need the log, I need to know how many characters your token has. retardEyes

dense fjord
#

155

sullen nymph
#

Huh. Reset, then. thinkW

dense fjord
#

Already tryed that twice

calm torrent
#

send code hide token

dense fjord
#
@asyncio.coroutine
def dbl_api():
    logger = logging.getLogger('dbl_api')
    if KEY_DBL is not None:
        dbl_client = dbl.Client(client,KEY_DBL)
        logger.info('dbl updater started: {}'.format(KEY_DBL))
        yield from client.wait_until_ready()
        while not client.is_closed:
            try:
                yield from dbl_client.post_server_count(client.shard_count,client.shard_id)
                logger.info('Posted server count to dbl')
            except:
                error = traceback.format_exc()
                logger.error('Error posting server count: {}'.format(error))
            yield from asyncio.sleep(1800)
    else:
        logger.info('DBL api key not found')
calm torrent
#

umm... why not just use the example from the website..?

dense fjord
#

Its pretty much the same thing also I don't use cogs so I can't

calm torrent
#

no

#

its totally different

#

and i can help you convert it to non cogs

#

send it here

dense fjord
#

Send what here?

#

Its basically the same thing just not in a class ^

calm torrent
#

no

#

it's completely different, yours is pretty inefficient as well

#

send the website example :p

#

am on phone

dense fjord
#
import dbl
import discord
from discord.ext import commands

import aiohttp
import asyncio
import logging


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

    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())

    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))
            await asyncio.sleep(1800)


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

do you use commands.Bot or discord.Client?

#

what's your python version?

dense fjord
#

client , 3.6.5

calm torrent
#

what did you call the variable of your client instance

dense fjord
#

client

sullen nymph
dense fjord
#

Its about the api

calm torrent
#

description > help with official api lib

sullen nymph
#

Eh. Okie.

calm torrent
#

@sullen nymph async or rewrite

sullen nymph
#

who what

calm torrent
#
  • @dense fjord whoops
dense fjord
#

async