#topgg-api

1 messages · Page 108 of 1

remote hollow
#

this doesn't have to be just about websites just easier to explain it with websites where you are the client and the website's server is the server

#

the data i requested from a website was fetching finical information from the server to then load on the webpage to display more dynamic content

crude token
#

basically its portal that integrated your app with another app

wintry oracle
#

oh ok

#

so do we put the api into the bot?

crude token
#

yep if u want to integrate ur bot to another app

crude token
#

ok i got an err

#

my bot keeping says "dblapi.js is not found"

#

but im sure installed

#

anyone can help me

#

???

keen mesa
#

use requests instead of dblapi.js if you wan't post stats

#

Or try remove and install it again

frigid basin
#

is there a ratelimit on the https://top.gg/api/bots/722088096195149874/check?userId= endpoint?

crude token
#

@keen mesa i did reinstall for 4 times,

#

but when i run it locally there is no problem comes

keen mesa
#

Where you hosting your bot?

#

@crude token

crude token
#

heroku

keen mesa
#

Hmm, everything should be ok

crude token
#

lel it solved

#

i forget remove package.json in my .gitignore

#

when i deploy from git, "dblapi.js" isn't include in package.json

#

@keen mesa thx

slow copper
opaque jetty
#

please stop

south sparrow
#

this is proly a stupid question but in my index.js where would i put this code
client.user.setActivity('-user_invite', { type: 'PLAYING' }).catch(console.error);
here is the code

plucky haven
#

how the hell do i integrate webhooks into my bot using discord.py

#

how do i connect with the API

austere swallow
#

you need an approved bot to be able to get your api token for top.gg

#

if I recall correctly

sullen nymph
#

That's the wrong fucking website

#

-api

abstract mothBOT
#

TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs

austere swallow
#

oh oops my bad

restive otter
restive otter
#

You have to wait your bot be approved before access the api token

sullen nymph
#

I might just make the examples non-cog

regal harbor
#

the webhook api create a server if i not specify it? or i need to specify server

teal kiln
#
client.on('ready', () => {
    setInterval(() => {
        dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
    }, 1800000);
});

That doesnt work with the newest version, how do i set the shard things

#

Ping me please if you got an awnser

paper grotto
#
const DBL = require('dblapi.js');
const dbl = new DBL('my dbl token', { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});
```Hello, when I vote for my bot, it doesn't send anything to the console, can you help me please? ping me
#

🤔

dusk trail
#

Are you missing some part of the code here? What you sent would result in a syntax error - dbl.webhook.on('ready', hook => {.

paper grotto
#

I sent you all the code related to DBL, and when I vote, there is no error

#

@dusk trail

dusk trail
#

Ah, I see it's edited now.

paper grotto
#

Yes

dusk trail
#

Well, does this log anything in console?

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
paper grotto
#

i forgot to send the good part

#

it's change something ?

dusk trail
#

Does the on ready event trigger?

paper grotto
#

I did not put it

#

but i try

dusk trail
#

Well try putting it, see does the webhook even run? Maybe the port is closed?

paper grotto
#

the ready event say : [ .........] \ prepare:container: timing audit body Completed in 1ms Webhook running at http://0.0.0.0:5000/dblwebhook

dusk trail
#

I don't use upvote webhooks myself, just giving you some clues that I could find.

paper grotto
#

okay

#

the ready event say : [ .........] \ prepare:container: timing audit body Completed in 1ms Webhook running at http://0.0.0.0:5000/dblwebhook
@paper grotto if i click on the link, it's doesn't works

dusk trail
#

Well the IP is 0.0.0.0, where is your bot hosted?

paper grotto
dusk trail
#

Bruh, it's 0.0.0.0 when I try it as well.

paper grotto
#

why it doesnt work ? @dusk trail

#

someone can help me please

sullen nymph
#

Replace the 0.0.0.0 with your public IP address when pasting it anywhere

#

0.0.0.0 is just a placeholder

paper grotto
#

Ok, but it doesnt change the event vote who doesnt work

#

shivacionian

sullen nymph
#

Are you sure the port is open and none of your firewalls are blocking the requests

dusk trail
#

Replace the 0.0.0.0 with your public IP address when pasting it anywhere
@sullen nymph I thought the library would get the IP address by itself, why isn't IP setting mentioned anywhere in the docs?

#

Just port and auth.

paper grotto
#

i don't change the port

sullen nymph
#

Because 0.0.0.0 is a placeholder used by the library dblapi.js uses to create the webhook

dusk trail
#

@paper grotto Well is the port open in your firewall? And do you have any other stuff running on the same port?

sullen nymph
#

To get the actual public IP address is up to you, but 0.0.0.0 means "accessible on all available IP addresses"

paper grotto
#

@paper grotto Well is the port open in your firewall? And do you have any other stuff running on the same port?
@dusk trail where i can see ?

#

Replace the 0.0.0.0 with your public IP address when pasting it anywhere
@sullen nymph where i can see ?

dusk trail
#

@paper grotto I'm not sure about your hosting. I'm running a CentOS server and I open ports with iptables via SSH or via a control panel like CWP.

sullen nymph
#

The IP you use to connect to your VPS

paper grotto
#

I never touched the port, I don't even know what it is

#

ok

#

@sullen nymph

#

just look

sullen nymph
#

Try that IP

paper grotto
#

and the port ?

sullen nymph
#

well you use 5000 so try it

restive otter
#

???

paper grotto
#

I try 5000 or 10101 ?

paper grotto
#

@sullen nymph

sullen nymph
#

5000

#

whatever you have set as webhookPort

paper grotto
#

Okay

#

I taste tomorow

#

Thanks

night fern
#

taste 👀

dusk trail
#

yummy webhooks

paper grotto
#

try*

blissful belfry
#

self.token = '' # set this to your DBL token

#

what is DBL token ?

sullen nymph
runic pawn
#

ok, I am very much so a newbie to webhooks so please don't slam me for not understanding basic stuff

I'm trying to send test webhooks to my bot and recieving nothing in my log. other prints are working but the test is not recieving. Here is the info I can give:

  • I'm hosting this locally
  • I'm using the template listed at https://top.gg/api/docs under python under Example with manual server count and webhook
  • For the webhook URL I put http://[ip]/dblwebhook (my IP of course in the place where [ip] is)
    I don't know how much else I can share without leaking important info...
#

I'm using on_dbl_test btw

    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        logger.info('Received a test upvote')
        print(data)
        print("E\n"*100)```

No errors outputted, it's just no output
blissful belfry
#

nothing is happening ?

sullen nymph
#

@runic pawn what value did you set for webhook_port?

runic pawn
#

5000, just realized that's an important thing I forgot to mention

blissful belfry
runic pawn
#

http://[ip]:5000/dblwebhook is what I actually have

sullen nymph
#

Getting any output now?

#

Make sure port 5000 is not blocked by a firewall and is forwarded to your machine

runic pawn
#

uh, how would I do that?

#

and no output still

sullen nymph
#

Port forwarding is done via your router's settings, port blocking - a firewall on your PC

blissful belfry
#

and me

#

i have copied token

#

and run with token(cached)

jaunty plank
grim anchor
#

thanks

normal trail
#

Hello

#

What is this ? Please help me too.

willow spindle
#

wdym by "this"

long elm
#

hm

normal trail
#

@willow spindle above nessages

#

Those images

thorny prism
#

webhook still not fixed?

paper grotto
#
const DBL = require('dblapi.js');
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!`);
});
```So I set my port to 500, I replace password by my authorization, and i replace yourDBLtokenhere by my token dbl ?
#

and it could work ?

dark spire
#

hello Im trying to publish my bot into top.gg can anyone help me?

austere swallow
paper grotto
#

i have to put / between port and webhooks ?

sullen nymph
#

http://ip:port/YourWebhookPathHere

paper grotto
#

http://ip:port/YourWebhookPathHere
@sullen nymph I replace YourWebhookPathHere by My webhook url ?

sullen nymph
#

Whatever your webhookPath is set to in the webhook settings

#

since it's nothing, it's /dblwebhook

paper grotto
#

Whatever your webhookPath is set to in the webhook settings
@sullen nymph I don't have to tou this ?

sullen nymph
#

......

#

No, you don't use a Discord webhook

paper grotto
#

ahh okay

#

No, you don't use a Discord webhook
@sullen nymph can i send you my link for you to check if it's good?

#

please

sullen nymph
#

Send requests to it manually via postman or reqbin

paper grotto
#

Sorry I don't understand, i'm french and i don't speak english very well

sullen nymph
#

Try it

#

And for the love of God don't send your IP address in this server

paper grotto
#

but at the end of the link, it must be http://ip:port/dblwebhook ?

sullen nymph
#

what do you mean "at the end of the link"

paper grotto
#

the last word

#

dblwebhook

sullen nymph
#

yes

paper grotto
#

okay

#

so i try it thanks

#
const DBL = require('dblapi.js');
const dbl = new DBL('my dbl token', { webhookPort: 5000, webhookAuth: 'my dbl password ' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://ip:port/dblwebhook`);
});
dbl.webhook.on('vote', vote => {
  console.log(vote);
});
```it doesn't work
sullen nymph
#

Send me in DMs the URL and authorization key you use

paper grotto
#

can you open your dm please

#

Your dms ar close @sullen nymph

hollow temple
#

How can I check faster if a user has voted?
I don't want to use the dblapi.js module.

dense basalt
#

If you don't want to use the API provided by us, then you need to use something else that others or yourself made

restive otter
#

or just use DSL vote listener by matt

hollow temple
#

I don't know where to start.

restive otter
#

I don't know where to start.
@hollow temple by reading the API docs

#

it's pretty simple you just need an HTTP server on your bot code (I'd suggest express.js) listening for POST requests to a specified path then put the ip:port/path on the webhook URL and finally just read the docs

frosty quail
#

What do I put in the link for the port and IP and path?

jagged pine
whole wind
#

How does the bot (webhook) send who has voted.

rapid kettle
#

what do you mean?

whole wind
#

When someone votes that the bot sends that.

rapid kettle
#

do you have the top.gg webhook working

whole wind
#

what do you mean?

rocky dove
#

.

blissful belfry
#

they are tuto for python ?

rapid zealot
#

someone's got to give me a few lines of code to DM the person who just voted, since what ive been doing up until now is js setInterval(() => { dbl.getVotes().then(votes => { if (votes.message.send('Thank you so much for voting! ^^.')); }); }, 2000);

#

which isn't working

#

of course

grave sundial
#

a little confused with getVotes, i logged what i have and it seemed to show 18 of me and no one else, which seems normal. i'm just confused with the actual intent of getVotes

#

because it includes repeats, but doesn't include weekend multiplier

rapid kettle
#

Token doesn’t matter

#

but changing pfp is done by editing the bot and not changing anything

#

Do keep in mind this is for top.gg api support — not regular top.gg support.

whole wind
#
@commands.Cog.listener()
async def on_dbl_vote(self, data):
    print("Received an upvote!")
    print(data)

Why is this not working?

dire bloom
#

How do I connect a webhook to the voting api

rough plover
#

Does anyone have a guide for the api to get the server count for my bots profile?

patent lintel
#

read through it, it shows how to do it

lament smelt
#

how do I do a webhook?

timber orbit
#

my bot's server count stopped updating and im getting an error 400 on the dbl API that's been working until recently, were there any recent changes to it?

rapid kettle
#

hi

#

what are you posting?

#

like what is the type of the thing you're posting

#

it needs to be a number, double check if it is

timber orbit
#

alright, i'll make sure

grave sundial
#

not too sure how to google this but how can i create the source of a webhook like the api does

#

i know how to receive data from top.gg api webhook

#

but how can i create my own, for data to send from one server to another

rocky bough
grave sundial
#

thanks!

rapid zealot
#

when testing my webhook with js console.log(`Body: ${request}`) I receive Body: [object Object] in my terminal

#

is that normal?

rapid kettle
#

Yes because you stringified it

unreal marlin
#

SKIP

fluid rock
#

Hey i have this probleme

restive otter
#

.

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

fair herald
#

Error?

jaunty plank
#

Did you put your webhook url on the site?

#

With the correct auth, port, ip, path

#

Your bots edit page, in the webhook section

grave sundial
#

no

#

it's naturally 0.0.0.0:port

fair herald
#

Your ip

grave sundial
#

in top.gg post http:ip:port/dblwebhook

fair herald
#

0.0.0.0 is localhost

#

Yes

grave sundial
#

i got a question about the dbl.getvotes, for some reason, every once in a while it will show like 600 users that have never voted for my bot

fair herald
#

Possibly might need to do some router port forwarding but Else it should work easy if on VPS

sullen nymph
#

@grave sundial they possibly have, just not in the past 12 hours

grave sundial
#

no i dont think so

#

it's a hella long list

#

my botinfo.points is 135 or so

#

the dbl.getVotes said at least 200

#

unique votes

fair herald
#

Oh, just one more question, is the port TCP or UDP ?
@verbal venture TCP i would guess

sullen nymph
#

Oh, just one more question, is the port TCP or UDP ?
@verbal venture send me in DMs your code and what you entered on the top.gg page

restive otter
#

Hello !

I wanted to know what the Discord Server List (Webhook) API is for.

Can I detect votes with this?

#

Thanks !

#

Cool

#

Is that all it's for?

#

discord.js

#

But I want to go through Express, to detect who votes for my server.

#

no no

#

but it's only for bots, no ?

grave sundial
#

getVotes is still broken for me, i can share my code if needed

#

it has improper names as well i can gurantee it

#

i have a feeling it's because of a token issue on top.gg's side and reusing tokens

#

when i regen token the first 3/5 of the token is the same lool

restive otter
#
const express = require("express");
const bodyParser = require("body-parser");
const app = express();

app.use(bodyParser.json());

app.post("/webhooks", function(request, response) {
  
response.sendStatus(200);
    
    if (request.headers.authorization === "my super token") {
      const webhook = request.body;
      console.log(webhook);
    }
  });

  app.listen(80, function() {
    console.log("Online!");
  });
#

@grave sundial

grave sundial
#

i have

#

im saying the getVotes is broken

#

just reset my token and auth and when i run getVotes it shows a bunch of people who are not me or another friend it showed last night

grave sundial
#

i feel like the api tokens are reused because of what i'm seeing

grave sundial
sullen nymph
#

there ain't one but webhook data format is pinned in this channel

random kindle
#

how do i change 0.0.0.0?

#

i am using heroku

sullen nymph
#

You don't change it

#

You simply treat it as a placeholder and replace it with your actual IP or domain whenever entering the link somewhere

random kindle
#

nvm

#

i am inside dblapi.js's node module

#

i can change it!!!

#

wait, but if i did change it, do I add https prefix?

gentle hawk
#

i there a listener of on vote, Java?

sullen nymph
#

Not if you somehow have SSL certificate attached to the server that handles your requests @random kindle

#

@gentle hawk Something tells me no

random kindle
#

i have heroku ssl

sullen nymph
#

Ah yes then use https

random kindle
#

thanks

grave sundial
#

dbl.getVotes sometimes shows other users who may have voted for another bot, are tokens reused? when i generate new ones, most of the token is the same as all past tokens

sullen nymph
#

Are you only looking at the first the part of the token

grave sundial
#

i’m taking the whole token, it’s just about 2 thirds of the tokens i generate have the same beginning

#

i promise you no one else has voted for my bot this month besides two friends (sad), but sometimes getVotes displays at least a hundred users that i have never heard of, and i’m not in the array either

sullen nymph
#

Bot's ID please

#

I'll take a look tomorrow

grave sundial
#

thank you

rare shadow
#

@jovial kiln sorry for mentioning. regarding the token needed, do i need to apply a bot first to top.gg before i can use the webhook? (and obviously, get the token)

jovial kiln
#

Bot needs to be approved to top gg

rare shadow
#

so.. in short, i couldnt get myself a token for the webhook without having a bot approved to top gg?

sweet sandal
#

yes

rare shadow
#

alrighty, thanks!

sweet sandal
rare shadow
#

well, this bot is only for one server with 10k+ member
am i still able to submit my bot there?

#

since it's actually only for one server

sullen nymph
#

If it's not for public use, then no you can't

grave sundial
#

you can submit your server though and do webhooks through there

#

if the server is for public

rare shadow
#

server is for public but i kinda confused with the configurations

grave sundial
#

wym configurations

rare shadow
#

the webhook URL, etc

#

i got the webhook URL already

grave sundial
#

so what’s “etc”

rare shadow
#

sec

#

that "auth"

#

i copied the webhook URL, and pasted there
then idk what to do with the auth stuff
when i clicked test webhook, nothing happens

patent lintel
#

the auth is what you can use the verify that the requests are coming from top.gg and nowhere else, so that if someone else sends a request to your webhook, it will not accept it.

#

And it should work when u press test, show me your code @rare shadow

#

show your code for the webhook, what language you using @rare shadow ?

rare shadow
#

im using nodejs

patent lintel
#

oh ask someone else I dont know nodejs very well

#

someone else pls respond to his question

hallow cargo
#

Hey sorry I posted this in the other channel but am getting not response I cannot get the bot to return a list of members for a channel using the code:

#

channel = ctx.channel
for member in channel.members:
print(channel.members)
memberIDs.append(member.id)

sullen nymph
#

-api

abstract mothBOT
#

TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs

hallow cargo
#

my bad

rare shadow
#

im just trying to figure out which token is this docs talking about x.x

patent lintel
#

i don't have this yourDBLTokenHere yet
that's why im here
@rare shadow Go to https://top.gg/api/docs#mybots and click your bot, then it will show the token

#

idk if it shows for unverified tho

rare shadow
#

yeah, that means i need to submit my bot first

sullen nymph
#

You don't need it

#

dblapi.js doesn't support server webhooks, you need to host your own one separately

rare shadow
patent lintel
#

@rare shadow sorry for confusing you.

rare shadow
#

@patent lintel no no, thanks for answering! really appreciate it

patent lintel
#

@rare shadow that will post the server count on the webpage, but I dont think it has anything to do with webhooks

#

you need to host like your own thing

#

search up "How to listen for webhooks in js" or something, because I mainly code in python, sorry :(

sullen nymph
#

use express

rare shadow
#

do i make express listen to the webhook URL or?

patent lintel
#

oops sorry for sending twice

#

my device glitched

rare shadow
#

wow, thank you very much!
i'll check it out
much ❤️

patent lintel
#

:)

#

and for putting it on dbl, u need ur ip: ip:PORT and replace PORT with your port obviously

#

like in that tutorial, it is 3000

restive otter
#

Hello !

I would like to know if it is possible to know the number of votes of a user without going through a database.

#

If it's not possible, I wouldn't pass a database

#

ping me if you have the solution

sweet sandal
#

is there a way to send a message when someone upvotes your server in a channel?

jovial kiln
#

API broken?

silver kelp
#

probably

late jacinth
#

I'm trying to create voting rewards but when I put the log voting code in my bot(main's bot assistant) it doesn't do anything even though I have everything setup correctly, i think. Please ping if u see this

const dbl = new DBL('dbl token', {webhookPort: 1204, webhookPass: "dbl pass"});

dbl.webhook.on('ready', hook => {
  console.log(`Webhook Running At: http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
let tyforvoting = new Discord.MessageEmbed()
.setColor("#a581e7")
.setTitle(`${vote.username} has voted on top.gg!`)
.setDescription(`:wumpus_luv: Thank you for voting, ${vote.user.tag}! You have received a role and a cool badge on your ReCreate profile. Remember to vote every 12 hours so you can keep that sweet badge!`)
.setFooter("Thank You For Supporting ReCreate!")
bot.channels.cache.get("767103210539188286").send(tyforvoting);
let role = message.guild.roles.cache.find(r => r.name === "Voted");
vote.roles.add(role);
});```
grave sundial
#

@late jacinth webhookPass is incorrect

#

i'm pretty sure only webhookAuth works

late jacinth
#

oh

#

@grave sundial what would be my webhookauth?

grave sundial
#

whatever you put in the top.gg page for authorization

#

you create your own password

#

then put it in for webhookAuth

late jacinth
#

so

#

replace webhookpass with webhookauth?

grave sundial
#

what do you have for the URL as well?

#

yes

#

capital A

late jacinth
grave sundial
#

good good

#

and port?

#

ip:port/dblwebhook?

late jacinth
#

oh

#

i just put the port number

grave sundial
#

yes

#

port number

#

http://123.456.7.8:25565/dblwebhook

late jacinth
#

um

grave sundial
#

?

late jacinth
#

not sure what ur sending

grave sundial
#

for the URL

late jacinth
#

oh

grave sundial
#

you have your IP and port written?

#

for example

#

i wasn't sure if you had the port in the URL as well

#

that's why im saying this

#

let me know if it works

late jacinth
#

so its ip then port in the webhook url

grave sundial
#

yes

#

with http:// at beginning

#

and /dblwebhook at the end

late jacinth
#

ok

#

imma test it out

#

dont think it worked

#

i voted

#

and it didnt do anything @grave sundial

#

changed the webhookurl on top.gg to https:// ip:port/dblwebhook and changed webhookPass to webhookAuth

#

Webhook Running At: http:// 0.0.0.0:port/dblwebhook

#

when i restarted the bot

grave sundial
#

running 0.0.0.0 is normal

late jacinth
#

oh

grave sundial
#

can you send me your full code again

#

with dbl.

late jacinth
#

dbl.?

grave sundial
#

like the dbl.webhook

#

the code you're trying to use

late jacinth
#
const dbl = new DBL('token', {webhookPort: 1204, webhookAuth: "pass"});

dbl.webhook.on('ready', hook => {
  console.log(`Webhook Running At: http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
let tyforvoting = new Discord.MessageEmbed()
.setColor("#a581e7")
.setTitle(`${vote.username} has voted on top.gg!`)
.setDescription(`:wumpus_luv: Thank you for voting, ${vote.user.tag}! You have received a role and a cool badge on your ReCreate profile. Remember to vote every 12 hours so you can keep that sweet badge!`)
.setFooter("Thank You For Supporting ReCreate!")
bot.channels.cache.get("767103210539188286").send(tyforvoting);
let role = message.guild.roles.cache.find(r => r.name === "Voted");
vote.roles.add(role);
});```
grave sundial
#

port is the same port used in the URL on the webhooks page on top.gg?

late jacinth
#

yes

grave sundial
#

when you click the test button nothing happens right?

late jacinth
#

yea

grave sundial
#

first i don't believe :wumpus_luv: would work, you need to use the ID as well like <:wumpus_luv:idhere>

#

try this instead

#

you have app and express right?

late jacinth
#

no

grave sundial
#

install express

#

npm install express

late jacinth
#

ok

grave sundial
#

then at the top of your main file have something like this

#
const http = require('http');
const express = require('express');
const app = express();
const listener = app.listen(1204);
const server = http.createServer(app)```
#

then in the new DBL options

#

instead of webhookPort

#

have webhookServer: server

late jacinth
#

oh ok

#

should i try testing it on top.gg?

grave sundial
#

yes

#

just click the test button whenever

#

as long as the URL and auth are correct

late jacinth
#

um i tested and it didn't do anything, i realized that my ip was wrong so i fixed it and tested it again, nothing happen so i might wait until i can vote to see if the original code will work @grave sundial

#

thanks for the help

grave sundial
#

no problem!

#

if test button doesn't work, then voting won't work

late jacinth
#

rip

grave sundial
#

use the app.post method instead, it should work

late jacinth
#

ok thanks, goodnight

prime sable
#

Webhooks aren't sending?

slate knot
#

Hmmmmmmmmmm

jovial kiln
#

Keep the channel on topic please @slate knot

nova cedar
#

ya we're trying to discuss the failing webhook here

jovial kiln
#

Mine is failing aswell

#

hmm

magic star
#

the help channel in many large bot servers are flooded with complaints

#

about vote rewards not being distributed. something on top.gg end

magic star
#

any devs around to look into this or do we need to implement fallback redemption

jolly moth
#

I'll let the team know in case they aren't aware already

magic star
#

thank you

late jacinth
#

I tried everything and it still won’t work :/

jovial kiln
#

It won't

#

Hence why we are saying it is not working

late jacinth
#

Oh lol my bad

prime sable
#

It would be really nice if we could have an incidents channel / page so people can know that there is an issue

restive otter
#

agreed ^

long sail
#

so is webhook not working atm?

restive otter
#

can you use DBL API without the wrappers?

#

Ik we can do that for DSL but can you do that for DBL?

sullen nymph
#

Yeah?

prime sable
#

Is webhook fixed yet?

#

Can we get an official confirmation that webhooks are down and an estimate of when they will be fixed?

magic star
#

that'd be nice right?

long sail
#

they should

golden adder
#

To be honest just an announcement channel we can follow in our servers so top.gg api outages can get published to our support servers when it's offline.

mighty shuttle
#

To be honest just an announcement channel we can follow in our servers so top.gg api outages can get published to our support servers when it's offline.
@golden adder I've forwarded this to the other CM's for discussion

golden adder
#

Awesome. Thanks @mighty shuttle 😉

#

It would save all us developers having to come and figure out what's going on. Also, it happens when I'm asleep most of the time so my users aren't updated on the situation until I wake up.

jagged sky
#

Is the site under maintainance. Most users didnt recieve rewards for voting i.e it didnt sent any webhooks

prime sable
#

Seems like the webhooks all started coming

whole wind
#

No, nothing comes with me either.

prime sable
#

The votes that were missed all started rolling in for me

#

not sure why there are so many GETs though

whole wind
#

In which language do you code? @prime sable

prime sable
#

Python

whole wind
#

Okay, can you help me c:

prime sable
#

No

whole wind
#

:c

sullen nymph
#

Well, you can ignore the GET requests

#

I remember being sent like PATCH requests or something randomly

prime sable
#

I just 405 them but it's just weird that there are so many being sent

sullen nymph
#

aiohttp.web essentially kept bitching about invalid HTTP methods

#

Yeah

#

@whole wind sup

radiant peak
#

hey there, I have again problems with my webhook

i set my webhook url to
http://IP-OF-MY-SERVER:2510/dblwebhook
and created a auth code
this is my code

class TopGG(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.token = 'My-Token' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/dblwebhook', webhook_auth='My_Auth', webhook_port=2510) # Autopost will post your guild count every 30 minutes

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print("Vote!")

    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        print("Vote Test!")

def setup(bot):
    bot.add_cog(TopGG(bot))```
prime sable
#

The webhooks seem to be having issues right now

#

They aren't being sent

radiant peak
#

ohh so its not caused by my code?

sullen nymph
#

Make sure your port is properly forwarded and no firewall is blocking the requests

radiant peak
#

Make sure your port is properly forwarded and no firewall is blocking the requests
@sullen nymph until now everything worked fine, just about 4 hours ago a member said to me that his vote didnt got recived

prime sable
#

Well your setup could be bad, but even if you everything up right webhooks might not be fine

radiant peak
#

and now its not working

prime sable
#

Yeah

radiant peak
#

k

prime sable
radiant peak
#

then ill just try later

#

ty 🙂

prime sable
#

Man I really hope those requests are the webhooks rolling in

whole wind
#

How do I create a webhook in python (e.g. that when someone votes)

prime sable
whole wind
#

Yes

radiant peak
#

hahaha a german nice

whole wind
#

But how do you do that with the URL?

radiant peak
#

u have a server right

whole wind
#

yes

radiant peak
#

where u host ur bot

#

then u use

#

some port is a port with 4 numbers

#

and ip is ur server ip

prime sable
#

Typo, and also make sure your firewall is properly configured

radiant peak
#

yeah

#

But I think that isnt a problem for me cause of it worked until now as I said 😄

whole wind
#

Ok, I'll test it out, thanks!

radiant peak
#

but be aware it probably wont work

prime sable
#

would probably recommend putting it under a reverse proxy if you know how to do it

#

Man the requests are still coming I really hope it's the webhooks working and not someone figuring out that I didn't verify the webhook secret

radiant peak
#

hmm? wdym

prime sable
#

They started working again?

radiant peak
#

oh

prime sable
#

Lots of people getting their rewards after hours

radiant peak
#

i can try

whole wind
radiant peak
#

no

#

does ur wifi work

#

?

prime sable
#

Connection refused so it's probably firewall

#

do you have ufw or something setup

radiant peak
#

but its on his pc

#

in the browser

#

not on the server

prime sable
#

It's on his pc?

#

man

radiant peak
#

yeah

whole wind
#

yes

radiant peak
#

its the website

#

but I can connect to it so try another website out

prime sable
#

What is he trying to access?

#

i thought he was testing his webhook or something

radiant peak
#

dont know could u tell us?

#

@whole wind which page of top.gg are u trying to access?

whole wind
#
class TopGG(commands.Cog):
    """Handles interactions with the top.gg API"""

    def __init__(self, bot):
        self.bot = bot
        self.token = 'token' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
        self.update_stats.start()# Your linter may say this is wrong, but your linter is wrong

    def cog_unload(self):
        self.update_stats.cancel() # Your linter may say this is wrong too, but again your linter is wrong

    # The decorator below will work only on discord.py 1.1.0+
    # In case your discord.py version is below that, you can use self.bot.loop.create_task(self.update_stats())


    @tasks.loop(minutes=30.0)
    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""
        logger.info('Attempting to post server count')
        try:
            await self.dblpy.post_guild_count()
            logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
            print("DBLPY - Count Posted")
        except Exception as e:
            logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        logger.info('Received an upvote')
        print(data)



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

I want who who votes that I get a message in the console.

radiant peak
#

yeah that should work but I think webhooks are still not working

#

mine is not working as well

#

and look if no firewall is blocking anything

whole wind
#

Sorry I don't understand anything :c

radiant peak
#

lets go to dms, i can explain it in german

whole wind
#

Okay thx c:

random kindle
#

i am trying to use webhooks for vote

#

it dosen't work

elder bay
#

@plush ore

olive turtle
#

@radiant peak Can you help me too?

crisp idol
#

Is the top.gg API where I can find out how to add how many servers my bot is in on the top.gg website?

crisp idol
oak spruce
#

this channel is for top.gg api help/suggestion, that issue is not related to the api, lets move to #development

crisp idol
#

I was told to come here in #support , I'm so confused lol.

sullen nymph
#

Well, you tried to install dblapi.js but npm isn't installed

#

It's more of a development issue than top.gg API

#

cc @jovial kiln I'll bonk you for this

jovial kiln
#

Wait-

#

I DIDNT PING BOTH

sweet sandal
#

@crisp idol it is npm i

jovial kiln
#

My b :(

#

Bonk me @sullen nymph

crisp idol
sweet sandal
#

o oops i read that wrong my b

crisp idol
#

llol

grave sundial
#

i'm a little confused how to get server information using webhooks

#

i was told it's in the docs but i dont see

#

like dbl.getServer

sweet sandal
frigid wren
#

i didn't understand

#

@sweet sandal

#

i just need a vote-logging channel

#

using any bot, for votes on top.gg

sweet sandal
#

it already has a logging channel?

restive otter
#

Bruh whats up with ur font

stoic path
#

how to use api with python plzzz?

rapid kettle
#

no and TOP.GG API ONLY!!! ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED - This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at https://top.gg/api/docs

grave sundial
signal hawk
#

this channel is fine for servers and bots

restive otter
#

how can I recognize the votes of those who voted for my bot for the yes of a reward

trail sigil
#

using webhooks

restive otter
#

ok

jaunty plank
fleet sky
#

Yes I posted on the wrong channel, sorry

nocturne quarry
#

How do I set up the webhook? I'm really confused.

potent basalt
#

why webhook stop working for me now?

dull jay
#

Where im can find my top.gg token?
||const dbl = new DBL('Your top.gg token', client)||

potent basalt
#

@dull jay
https://top.gg/bot/YOUR_BOT_ID/webhooks

dull jay
#

Thanks now im have another question
Where im can get my DBL token and webhook auth = my webhook?
|| const dbl2 = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); ||

potent basalt
#

const dbl2 = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'YOUR_PASS'});

dull jay
#

DBL token its again https://top.gg/bot/YOUR_BOT_ID/webhooks?

potent basalt
dull jay
#

Very very thanks

potent basalt
#

Np

dull jay
#

generate webhook

#

In ur discord server

dull jay
#

Yes

sullen nymph
#

What

#

What

#

What

#

@dull jay Are you telling them to enter a Discord webhook URL

dull jay
#

Ooof wait yes sorry my mistake

sullen nymph
#

@fickle lantern http://ip:port/dblwebhook
ip is your public IP address
port is 5000 as you set it as webhookPort

#

Sure, set webhookPath to '/mybot'

median badger
#

Where are you hosting it?

#

And if you go to ip:port/mybot what does it say

queen current
#

Hello, how can I link my bot to the discord bot list so that when a user votes for it, it tells me
Sorry for my bad English
I hope you understand what I want

kind hedge
#

Does anyone know how to make it so that my server gets a post when someone upvotes my server or bot?

dull jay
#

Guys in dbl.post stats 1800000 its seconds or what?

sullen nymph
#

Milliseconds

scarlet cobalt
#

One message removed from a suspended account.

rapid kettle
#

is it not by 1000 @scarlet cobalt

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

subtle wren
#

How can I get him to give a role when I vote for the bot?

sullen nymph
#

10000 milliseconds / 1000 = 10 seconds

tacit lichen
#

How can I get him to give a role when I vote for the bot?

urban cipher
#

Hi im using heroku to host my bot and i was wondering how to use the webhooks? I've never used webhooks b4 and im kinda confused. Im using Python btw

hollow lichen
#

How do I do the system that sends messages when someone votes without not using webhook?

#

or how to create a webhook?

rapid kettle
#

you can't not use a webhook

#

its just a POST request listener

tacit lichen
#

How can I get him to give a role when I vote for the bot?
@tacit lichen

restive otter
#

But i don't receive anything

#

I also did setup my webhook settings in website

#

but i did not used authorization

#

Is it the problem?

sullen nymph
#

What's your DBLClient like

restive otter
sullen nymph
#

Set Authorization to password

#

What URL did you enter on the website?

restive otter
sullen nymph
#

That your public IP in the URL?

restive otter
#

yes

#

I'm pretty sure the port is open and also disabled firewall for testing purposes

sullen nymph
#

Interesting

#

Try to send a manual request with reqbin

restive otter
#

ok

#

I get 405 (Method Not Allowed)

#

Oh yea i forgot that's post ^_^

#

well, now i get 401 (Unauthorized)

sullen nymph
#

Send Authorization header with password as value

restive otter
#

If I'm doing right, it still gives me 401

tacit lichen
#

How can I get him to give a role when I vote for the bot?
@tacit lichen

restive otter
#

@tacit lichen Although that's not even connected to top.gg api, but when you receive the data from top.gg, you can get the user id and depending on what library ur using, you can give that member a role.

#

If I'm doing right, it still gives me 401
@restive otter I appriciate any help cuz i'm really stuck rn and don't have any idea why it's happening. Is there any way to disable the webhook authentication?

#

** i ended up changing the port to 5005, and now, i get error 500 (Internal Server Error) ** lol
I checked the console and now it gives me nonsense logs which is about json and these stuff

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/dist-packages/dbl/client.py", line 440, in vote_handler
    data = await request.json()
  File "/usr/local/lib/python3.8/dist-packages/aiohttp/web_request.py", line 584, in json
    return loads(body)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
#

i guess that's the problem with library

#

usr/local/lib/python3.8/dist-packages/dbl/client.py"

sullen nymph
#

@restive otter ah yeah

#

I'd say don't worry, since dblpy is trying to access keys in the request body rendered as dictionary

#

which I assume you didn't send

restive otter
#

which I assume you didn't send
@sullen nymph Yes i thought but test in the website doesn't send anything

sullen nymph
#

The test actually does send fake data

#

Same format as real votes, just the type key being type and not upvote

#

..... right

#

Use on_dbl_test to handle test votes

restive otter
#

Ow ok so that's on_dbl_test

#

I thought it's like real one

sullen nymph
#

I've been thinking about just merging them and letting users handle the difference

restive otter
#

Yea that's better idea i think

sullen nymph
#

Might do it in next release, which will be 1.0.0

#

including breaking changes with webhooks!

next turtle
#

In the webhook what I put in the authorization

#

?

rapid zealot
#

The authorisation token you can find in the docs > my applications

rapid kettle
#

Nope.

#

thats just auth that's sent along with the request

prime sable
#

Webhooks dead again

restive otter
#

I have some problems with the webhook and the api, I don't know where to get the api

#

I have some problems with the webhook and the api, I don't know where to get the api
Which part exactly?

patent lintel
#

for some reason, top.gg just suddenly stopped sending any request to my webhook. When i vote, or i press "test webhook", it doesnt send any request. It isnt a problem with my code, because it isnt sending the request at all. It was working before, pls help

#

I have some problems with the webhook and the api, I don't know where to get the api
@restive otter the api docs is https://top.gg/api/docs

merry basalt
#

i can't help you srry ;-;

restive otter
#

They might be in maintenance cuz @prime sable also mentioned it's not working

patent lintel
#

oh ok

restive otter
#

Which part exactly?
@restive otter const dbl = new DBL('', {webhookAuth: '', webhookServer: '' });

#

Sorry haven't worked with js, if it was python I could help you out

#

ok

#

who can help me with js @restive otter ?

#

Idk really maybe official moderators.

#

ok

#

@signal hawk const dbl = new DBL('', {webhookAuth: '', webhookServer: '' });

prime sable
#

@jolly moth I don't want to be a bother, but can someone check in and make sure the team is aware that webhooks stopped working?

#

(again)

restive otter
#

I cannot request the API or the webhook I cannot find the API

prime sable
#

replace yourDBLTokenHere with your token

#

port 5000 is fine

#

set the webhookAuth to whatever password you want and you'll have to enter it in on the bot edit page

restive otter
#

Ok bro

subtle wren
#

How do I get him to send a message when I vote?

restive otter
#

Get him :/? You mena the bot?

#

Well, if I'm right, you have to listen to the voting event, and receive the data which is an json object, using that data you can get the user that voted and depending on what library you are using, you can send the message

subtle wren
#

Is this how I can get someone to message the channel when they vote? By the way, I'm using discord.js

restive otter
#

Yep that's how it works, which is called webhook

Here is docs you can get help depending on your programming language https://top.gg/api/docs

subtle wren
#

const DBL = require('dblapi.js');
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!);
});

#

What should I write in the password part

#

or where should I fill

restive otter
#

password is whatever you want, but you have to put that password (authorization) in the website too

#

That's for security that no one actually spoof or fake the voting

#

You can set your password here in this link:

https://top.gg/bot/{your bot id}/webhooks

subtle wren
#

okay. Is there any other place to fill?

restive otter
#

No, that's it

subtle wren
#

Thank you very much I love you <3

restive otter
#

Your welcome

dense jolt
#

!p ono moje baka prase

foggy cave
#

mm do you have a form to count the votes inside the bot code?

nocturne quarry
#

When every I try to go to the dblwebhook page it says I can't open it am I doing something wrong?

jaunty plank
#

like the docs?

restive otter
#

Anyone know why this doesn't work? It's old code and i'm only now going back to using vote logs, and wanted to see if it worked still. iirc on_dbl_test still returned the same as on_dbl_vote. I have checked to make sure the token, port, path, and auth are correct

Should also mention im using the py lib, if it wasn't apparent

restive otter
#

sound cloud

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

hidden wave
#

Guys does DBL accept Discord Webhook for the voting and such? If they don't then what do I use then

sullen nymph
#

@hidden wave a webserver hosted manually

hidden wave
#

Oh ok

sullen nymph
#

@restive otter _test is for test requests, _vote is for actual votes. Make sure your port is forwarded and no firewall is blocking the requests

drifting terrace
#

hi, I have a couple of questions about the api real quick

sullen nymph
#

Ask away

drifting terrace
#

so I am creating a reward system with my discord bot, the more someone votes the more rewards they will get by role. Is it possible to see how many times that person voted for an server?

#

Also, it is required to have my bot listed to start using the api?

sullen nymph
#
  1. Yes, you can use the webhook system to keep track of votes
  2. Yes, you need a listed bot to get an API key in order to use the API
royal pawn
#

When my bot will be done verified

drifting terrace
#

ok, thank you

#

under the topics one where it says webhooks right?

#

It looks like I can only see users who have voted for my bot and not a server

sullen nymph
#

@drifting terrace servers support webhooks too

#

Server page -> Edit

nova sierra
#

how do i know my webhook url if im hosting on my pi?

restive otter
nova sierra
#

ah ok ty

#

it doesnt really work

#

i got my ip machine on my pi with hostname -I and i typed that url into top.gg page and tried to test but i dont receive any info on the webhook

#

how do i do that

nova sierra
#

do i port forward to 5000? or other values

nova sierra
#

i still cant get my vote log to work

tacit lichen
#
dblhook.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
})
dblhook.webhook.on('vote', vote => {
      client.channels.get('769725160118550558').channel.createWebhook(vote.user.username, {
        avatar: vote.user.avatarURL({dynamic: true}),
    })
    .then(webhook => webhook.edit({
        name: vote.user.username,
        avatar: vote.user.avatarURL({dynamic:true})
    })
        .then(wb => {
            const hook = new Discord.WebhookClient(wb.id, wb.token)
            hook.send(`${vote.user.username} bota oy verdi!`)
            setTimeout(() => {
              hook.delete()
          }, 2500);
}))

          });```
#

did I do something wrong?

nova sierra
#
const dbl = new DBL(config.apitoken, { webhookPort: 5000, webhookAuth: 'My 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!`);
  console.log(vote.user);
});```

i did this but it doesnt log anything
royal geyser
#

@nova sierra how to use

#

Means how to setup it

#

In bot

#

Bot

#

@tacit lichen how to setup

#

It

#

@sullen nymph how to use js library api vote log

#

How to setup

nova sierra
#

?

#

i cant get it to work

tacit lichen
#
dblhook.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
})
dblhook.webhook.on('vote', vote => {
      client.channels.get('769725160118550558').channel.createWebhook(vote.user.username, {
        avatar: vote.user.avatarURL({dynamic: true}),
    })
    .then(webhook => webhook.edit({
        name: vote.user.username,
        avatar: vote.user.avatarURL({dynamic:true})
    })
        .then(wb => {
            const hook = new Discord.WebhookClient(wb.id, wb.token)
            hook.send(`${vote.user.username} bota oy verdi!`)
            setTimeout(() => {
              hook.delete()
          }, 2500);
}))

          });```
did I do something wrong?
stoic turret
#
class TopGG(commands.Cog):
    """Handles interactions with the top.gg API"""

    def __init__(self, client):
        self.client = client
        self.token = 'token' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.client, self.token, autopost=True) # Autopost will post your guild count every 30 minutes

    async def on_guild_post():
        print("Server count posted successfully")

def setup(client):
    client.add_cog(TopGG(client))

does it post shard count too along with guild count?

restive otter
#

Yes, autopost every 30 mins

nova sierra
#
const dbl = new DBL(config.apitoken, { webhookPort: 5000, webhookAuth: 'My 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!`);
  console.log(vote.user);
});```

i did this but it doesnt log anything

@nova sierra is someone able to help

uncut panther
#

i need some help I don't know how to get dbl token

restive sail
#

Hey guys, so it looks like that my bot shows the wrong amount of servers on the website. It shows the actual amout of server multiplied by the shards. Is there maybe anything I miss?

this.dbl.postStats(guildSize).then(r => Logger.info('Updated guild amount on top.gg', r))
this.dbl.on('error', e => {
    if (config.DEVELOPMENT !== true) {
        Logger.error('Error occurred while trying to update the server amount on top.gg!')
        console.error(e)
    }
})
// how I get the guild size

/**
 * Counting all guilds.
 * */
client.on('ready', async () => {
...
  setInterval(async () => {
    updater.updateTopGg(await this.guildCount())
  , 1800000);
}

exports.guildCount = async () => {
    return client.shard.fetchClientValues('guilds.cache.size')
        .then(res => {
            return res.reduce((prev, count) => prev + count, 0)
        }).catch(console.error)
}

#

Should I maybe run the update function on one shard only cause currently it runs multiple times (which I saw just now but before it runs perfectly fine)

nova sierra
#

why do i get error 404 for my api on my bot logs?

white onyx
#

is there an api endpoint for servers/guilds?

sinful apex
#

have

#

are

#

yu

restive otter
#

How to create a covid 19 tracker bot

sturdy moss
#

Hello

hollow forum
#

How to create a covid 19 tracker bot
@restive otter You code it KEKW

lament shell
#

#roles

restive otter
#

how can i get my top.gg bot token?

#

Nvm i got it

tacit lichen
#
dblhook.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
})
dblhook.webhook.on('vote', vote => {
      client.channels.get('769725160118550558').channel.createWebhook(vote.user.username, {
        avatar: vote.user.avatarURL({dynamic: true}),
    })
    .then(webhook => webhook.edit({
        name: vote.user.username,
        avatar: vote.user.avatarURL({dynamic:true})
    })
        .then(wb => {
            const hook = new Discord.WebhookClient(wb.id, wb.token)
            hook.send(`${vote.user.username} bota oy verdi!`)
            setTimeout(() => {
              hook.delete()
          }, 2500);
}))

          });```
did I do something wrong?
rapid kettle
#

yes

#

vote.user returns an ID

maiden comet
#

Im experimenting with the top.gg api atm, and i cant find the on_dbl_vote event to be triggered

Heres my starting code:

@bot.event
async def on_dbl_vote(data):
print(1)
channel = bot.get_channel(769417504300466176)
await channel.send("Someone voted!")
print(data)

restive otter
sullen nymph
#

@maiden comet pressing Test or actually voting?

maiden comet
#

Actually voting

#

@sullen nymph

sullen nymph
#

Simplify life with on_dbl_test and the Test button

rapid kettle
#

Where are you hosting?

sullen nymph
#

Now for the solution, are you sure your port is forwarded and your firewall isn't blocking requests?

rapid kettle
#

@restive otter ^^

restive otter
#

hmm

rapid kettle
#

where are you hosting?

restive otter
#

heroku 🤔

rapid kettle
#

your heroku url

south yoke
#

how do I make it so top.gg shows how many servers my bot is in?

rapid kettle
#

POST it

south yoke
#

what

maiden comet
#

Simplify life with on_dbl_test and the Test button
@sullen nymph what do you mean

rapid kettle
#

send a POST http request

#

Or you could use a library

south yoke
#

matthew are you talking to me ill take that as a no

rapid kettle
#

dblapi.js for js, dblpy for py, and yes I am.

south yoke
#

oh

sullen nymph
#

@maiden comet ba da boom, on_dbl_test event fires when the test button is pressed on the website

#

Saves time and effort

south yoke
#

ok this might be kinda dumb but like

#

wtf is a webhook

maiden comet
#

I don’t get it why i should use on dbl test and not on dbl vote

rapid kettle
#

Not needed to post stats

south yoke
#

mk

#

I'm looking at the documentation now

#

so I think I'm good on this

rapid kettle
#

I don’t get it why i should use on dbl test and not on dbl vote
@maiden comet not for your actual vote thing, but for testing.

maiden comet
#

Ok, how do i do the testing on the website

rapid kettle
#

Test button on the edit page

maiden comet
#

Ok ill look for it

#

At general?

rapid kettle
#

Nope in webhooks

restive otter
#

your heroku url
you mean like https://<appname>.herokuapp.com/

#

?

rapid kettle
#

yes

restive otter
#

that gives an error

#

hmm

maiden comet
#

Wait do i need to set up a webhook to use the api @rapid kettle

rapid kettle
#

No

maiden comet
#

Ok its not working

#

Help

sullen nymph
#

@restive otter turn on the web dyno

restive otter
sullen nymph
#

See my message

maiden comet
#

Wow, your getting errors

#

xd

restive otter
#

ok let me see what i can do 🤔

maiden comet
#

I mean i dont

#

I tried it again nothing happened

restive otter
#

uh can someone help me with getting voting updates and sending them in a specific channel with discordjs?

jagged pine
#

You can follow this if you wanna get the votes send to a channel

restive otter
#

ok

maiden comet
#

Sth for python

#

Pls

#

A tutourial for python?

#

I gtg now ping pls thanks in advance and bye

restive otter
#

im not hosting on vps tho @jagged pine

rapid kettle
#

Where are you hosting

jagged pine
#

Then idk sry

restive otter
#

ok

rapid kettle
#

Where are you hosting
@rapid kettle

restive otter
#

heroku

sturdy moss
#

Puol

grave sundial
#

not sure if this is api or development just redirect me if so. does the “Give Role” on top.gg/servers webhooks give the role permanently?

#

or only for 12 hours since vote

restive otter
#

@restive otter u need web server

#

For webhooks

#

Dank memers web server open source and on their GitHub

sullen nymph
#

@grave sundial 13 hours

grave sundial
#

oh really?

#

it auto removes the role after 13?

#

:DDDDD

#

how often does the roles menu update, i just created a role and refreshed a few times and it won't appear

sullen nymph
#

Should be instant k3llyhmm

grave sundial
#

i checked role hiearchy

#

ah got it, the webiste is incorrect

#

"Can't see your role? Make sure it's below the bot's highest role
"

#

the bot's personal role was below the role

#

but it's highest role was above

#

wait weird

#

it has some above and some below

#

could be the perms of the role

jaunty cliff
#

hey, I want to create a command which only voted people can use!
can anyone help me with that

night fern
#

if u get help, tell me too

sullen nymph
#

Use webhooks, cache and/or user ID and then check if ID of a command invoker is in a list of a voters

jaunty cliff
#

using this : dbl.hasVoted

#

hope it works

sullen nymph
#

eh that works too but it's API requests

#

And that can get your bot ratelimited if not handled properly

night fern
jaunty cliff
#

And that can get your bot ratelimited if not handled properly
@sullen nymph ok

#

Use webhooks, cache and/or user ID and then check if ID of a command invoker is in a list of a voters
@sullen nymph how can i create a list of voters?

sullen nymph
#

Attach a custom property to your client object

jaunty cliff
#

sorry I am new to coding can you brief me a bit?

#

@sullen nymph

sullen nymph
#

client.voters = []

#

On vote, push user ID to that array

#

On command usage, check if ID is in the arrau

jaunty cliff
#

ok

#

client.voters = []
@sullen nymph but how to remove it after 12 hours?

sullen nymph
#

Hmm. You could run a timeout that deletes the ID from the array after 12 hours

#

Or instead store an array/map of user ID and a timestamp when they voted

#

And on command usage check if they voted within 12 hours

jaunty cliff
#

ok

#

thanks

drifting terrace
#

oh yeah and I almost forgot. Since I have to add my own bot to DSL to start using the api, if approved, can I have it hidden from the bot list? My bot is still very much being worked on, so currently I only want it in communities I am friends with

sullen nymph
#

What API

#

What are you trying to do k3llyhmm

hidden wave
#

oh yeah and I almost forgot. Since I have to add my own bot to DSL to start using the api, if approved, can I have it hidden from the bot list? My bot is still very much being worked on, so currently I only want it in communities I am friends with
@drifting terrace you're saying that you want your bot hidden from bot list? Or saying you want your api hidden from your bot list

drifting terrace
#

@hidden wave bot hidden from bot list

hidden wave
#

That's most likely impossible I think @drifting terrace

sullen nymph
#

Ok

drifting terrace
#

i see

nova sierra
#

how do i find out the username of the user that just voted? instead of vote.user which give me the id of the person

restive otter
#

using the id of the user, depending to your library that you are using, you have to get the user from its id

#

from the intents update, you may have to enable server members intents in order to not get None

restive otter
#

i wanted to know how to show the number of the server the bot is in top.gg

#

When i search my bot name in top.gg it doesn't show, why is that so ?

#

@restive otter _test is for test requests, _vote is for actual votes. Make sure your port is forwarded and no firewall is blocking the requests
@sullen nymph Sorry for the late response. After looking at it the port im using (5000) isn't forwarded

royal geyser
#

@sullen nymph how to set vote log

#

No one help me

sullen nymph
#

Set up a webhook

restive otter
#

@oblique sluice dms

royal geyser
#

@sullen nymph how

#

I dk know how to setup

#

I only here to ask that

nova sierra
#
const dbl = new DBL(config.apitoken, { webhookPort: , webhookAuth: });

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at https://${hook.hostname}:${hook.port}${hook.path}`);
});

dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
  console.log(vote.user);
  Account.findOne({ UserID: vote.user }, (err, account) => {
    if(!account) return;
    account.VotePoint++;
    account.VoteCoins++;
    account.save();
  })
});``` Im running this code on my pi but it doesnt seem to log the votes when i test them
#

im not sure if its the problem with port forwarding but i did port forward on my pi already

frank mulch
#

how can I do like this, I looked at the documentation but didn't really understand

vapid cape
#

You send a POST request to top.gg containing your server count and your top.gg api token

#

Or just use one of the official libraries from the tools section

livid hound
frank mulch
#
async def on_guild_post():
        pass
#

like that^

sullen nymph
#

who did you even send that to

restive otter
#

I hate Data bases, i have the code but It's not fucking working

restive otter
#

i wanted to know how to show the number of the server the bot is in top.gg
When i search my bot name in top.gg it doesn't show, why is that so ?

jaunty plank
#

search is a little broken currently

restive otter
#

oh

jaunty plank
#

dev team are looking for fixes

restive otter
#

oh k and what about

#

i wanted to know how to show the number of the server the bot is in top.gg

#

this

#

@jaunty plank

#

do u know about it ?

jaunty plank
#

The docs cover it

glass steeple
#

I hate Data bases, i have the code but It's not fucking working
@restive otter depends on what dbms you're trying to learn really, but they aren't that difficult

restive otter
#

I vaguely know SQLite3 but idk where i need to put the Db

rapid kettle
#

channel topic go brr

maiden comet
#

Is there some python example for dbl events

jaunty plank
jaunty plank
uncut granite
#

welp does someone actually knows how this works with .Net bcs the doc from top.gg isnt really clear :/

dense basalt
#

What is the part that you need help with

jaunty cliff
#

do i have to restart my bot to post stats again?

jaunty plank
#

no

#

you can post as much as you want(within reason, no need to post more than once every 30 minutes)

uncut granite
#

What is the part that you need help with
@dense basalt i just dont really get what to do, im kinda new with this :c

dense basalt
#

Do you want to post your stats or what do you want to do

uncut granite
#

i want to post the server stats

#

like the server counter

dense basalt
#

You need your token first though, you get that once your bot has been approved

uncut granite
#

alright

plucky haven
#

how do i set up a webhook url?

#

I'm new to this sort of networking stuff so forgive me if im a bit slow

jaunty plank
#

its just the url to your webhook server.
for example
http://ip:port/path

plucky haven
#

is there a guide to setting up a webhook server?

jaunty plank
#

most of the libraries will do that for you

kindred iron
#

hi - im getting these errors trying to npm i dblapi.js

npm ERR! errno SELF_SIGNED_CERT_IN_CHAIN
npm ERR! request to https://registry.npmjs.org/dblapi.js failed, reason: self signed certificate in certificate chain

npm ERR! A complete log of this run can be found in:```
what am i doing wrong, as in what is a self signed certificate in certificate chain
kindred iron
#

oh nvm

restive otter
#

The docs cover it
@jaunty plank i k but where should i put the commands

restive otter
#

I hate Data bases, i have the code but It's not fucking working
@restive otter you're blaming the database for your own fault

icy zealot
#

-bots

restive otter
#

-bots

heady epoch
#

-bots

median badger
celest latch
#

-bots

minor warren
#

-bot

#

-bots

restive otter
#

omg

restive otter
#

-bots

trail sigil
#

next person to use bot commands here will be muted

#

this clearly isn't the channel for it (check the description), commands should be kept in testing channels

midnight kite
#

What are the ratelimits on the API, if any?

#

Nvm I found it

restive otter
#

What happened?

#

It was working for weeks

sullen nymph
#

Install dblpy

restive otter
#

i did ages ago

#

but let me try again

knotty lark
#

Hi, im kind of new to webhooks... so where does one aquire the webhook URL that is requested on the settings page of the bot

restive otter
#

Hi

night fern
#

can anyone share their code to post guild count with python

jaunty plank
#

The docs have examples

junior tusk
#

can someone quickly show me an example of how the webhook URL should look like?

#

I can't get it working with a new hosting location

#

now it send the test thing but it didn't send it in 5 sec so I don't know which of the many tries was correct 😂

#

working

jaunty plank
#

http://ip:port/path

junior tusk
#

I don't have / in front of the : tho

jaunty plank
#

There is no / in front of a :

junior tusk
#

but you have in your message

rapid kettle
#

Discord auto puts it there

jaunty plank
#

Ah yeah, doesn't on mobile so I can't see it

#

Put it in `` so it doesn't add that anymore

blissful raptor
#

Haiii guys

knotty lark
#

I expect I need to open that port in my router for it to work?

dreamy skiff
#

im trying to post discord server count and i get a 404 not found, do i have to wait till my bot gets approved?