#topgg-api

1 messages Β· Page 84 of 1

dense basalt
cerulean monolith
#

Yea got it lol

restive otter
#

made a script
but
noooooo idea whatsoever
how to upload them to the bot

wild sundial
#

you run the token from your discord developer portal

golden adder
#

Quick question... I have a bot that's sharded. How can I post the total count to top.gg?

green mantle
#

in waht lib

golden adder
#

Js

dull lagoon
#

Which client should we pass into the js lib for it to eval across all shards? Does this matter? It seems top gg is only display 2/3 shards for guild count, but shows that there are 3 shards total

dull lagoon
#

@dapper copper Heres what I got:

        client.on('shardReady', (id) => {
            // some other code
            if (client.shard.id === client.shard.count - 1) {

                const dbl = new DBL(`${process.env.DBL_TOKEN}`, {
                    webhookPort: 00000,
                    webhookAuth: `${process.env.DBL_AUTH}`,
                    statsInterval: 900000
                }, client)

                dbl.on('posted', () => {
                    util.success('Top.gg Stats Posted');
                     // code
                })
                dbl.on('error', e => {
                       // code
                })
                dbl.webhook.on('ready', hook => {
                    // code
                });```
dapper copper
#

You need to have one central shard posting iirc, since if server_count is an array it'll combine them together and if server_count is just a number you can set shard_count instead

dull lagoon
#

On the site: It shows I have 3 shards, but only the ammount of guilds for one shard

dapper copper
#

meaning you have to use fetchClientValues to get all the the guild counts from the shards then get the sum

dull lagoon
#

Yeah I would have to do this, the JS lib dosn't do this by itself?

dapper copper
#

not iirc

dull lagoon
#

I assumed it would handle posting sharded stats

dapper copper
#

Its open source

dull lagoon
#

So should I just use the postStats method then?

dapper copper
#

yea

dull lagoon
#

Should I remove client then as well?

dapper copper
#

up to you

dull lagoon
#

Will it still post the other data?

deep fulcrum
#

what is with the site slowdowns rn

#

@mossy bay if you still have the problem try os.getenv instead of os.environ.get
and if that still doesn't work you might want to try python-dotenv

dull lagoon
#

Now that I'm using manual posting, the posted event is never fired... any ideas? @dapper copper

snow scroll
arctic arch
#

the posted event is only for the autoposter, resolve the promise for the output of postStats

#

the library should handle sharded bots

lofty saffron
#

Hello,

I am looking to use webhook to get votes. All is working great but I am little bit concerned my server privacy for letting everyone make request to webhook. So I am asking what IP addresses send request to my server so I can firewall them. btw I am already using strong authorization key for requests.

sullen nymph
#

Make a strong password and use it instead? catshrug

lofty saffron
#

Extra security layer. And I use strong authorization key.

Tldr; I am only asking list of IP address(es) where request are coming from.

sullen nymph
restive otter
#

i have this problem:

#

i use this code:

#
    console.log('Server count posted!');
  });

  dbl.on('error', e => {
   console.log(`Oops! ${e}`);
  })
  dbl.webhook.on('ready', hook => {
    console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
  });```
restive otter
#

Wow

#

?

gaunt steeple
#

Extra security layer. And I use strong authorization key.

Tldr; I am only asking list of IP address(es) where request are coming from.
@lofty saffron why not trigger several test webhooks and turn on apache logging to get the ip the request comes from?

restive otter
#

can someone help me up?

#

Voting not working?
My server isn't getting anything when someone votes

#

@gaunt steeple any ideas? (sorry for ping)

gaunt steeple
#

what are you using to capture the vote?

restive otter
#

or whatever it's called

#

it was working just fine 2 days ago

gaunt steeple
#

if you just point it at an apache server, does the request appear in your apache log?

#

whats changed?

restive otter
#

no idea

gaunt steeple
#

nothing in your code?

restive otter
#

voting isnt working for dank memer either i dont think

#

nah i've not changed any code

#

lemme get a snippet

#

wait it is working for dank memer

#

idk whats wrong with mine then

lofty saffron
#

@lofty saffron why not trigger several test webhooks and turn on apache logging to get the ip the request comes from?
Brain yeah I think that I need to do that. Do you know do top.gg use multiple ip addresses so I know how many request I need to send to get it?

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

    def __init__(self, bot):
        self.bot = bot
        self.token = 'that token' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='that password bich', webhook_port=33, autopost=True)

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

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        global cursor
        logger.info('Received an upvote')
        voter=bot.get_user(int(data["user"]))
        #the other code stuff```
#

and i've not gotten any errors in console

sullen nymph
#

Try to use on_dbl_test and use the Test button

restive otter
#

kk

#
    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        print("test")```
#

just like that?

gaunt steeple
#

@lofty saffron cant tell you if its multihomed as i dont know, i never put ip restrictions on my webhook just a long key πŸ™‚

sullen nymph
#

Yeah

restive otter
#

@sullen nymph I'm not getting anything from the test either

sullen nymph
restive otter
#

this hasn't happened to me before, i'm not sure why it would break now

lofty saffron
#

@lofty saffron cant tell you if its multihomed as i dont know, i never put ip restrictions on my webhook just a long key πŸ™‚
Brain ok thank you

restive otter
#

oop one moment

#

forgot to push the change

#

that might be why

#

nope still doesn't do anything

sullen nymph
#

Mind sending me the URL you are entering on the bot's Edit page?

restive otter
#

Sure

#

dms tho pls

#

:p

sullen nymph
#

No problem

split blaze
#

Hi all! I'm pretty new to working with API's, can someone give me a hand understanding some of the documentation? In the list of properties for a channel object, what do the question marks mean? I'm trying to get a list of recipients from a channel object but it's saying there's no property called "recipients"... Does the question mark mean I need to access it through a .get() or something?

true talon
#

read channel topic

split blaze
#

This help to do with the api docs though?

sullen nymph
#

-api

abstract mothBOT
sullen nymph
split blaze
#

Okay cool I'll repost there

late path
#

Hot to use member counter boT

true talon
#

read this

#

but you need your bot to get approved to get a api token

jaunty sable
#

How can I receive vote logs when someone voted in js

true talon
#

webhooks

restive otter
#

how can i get discord users' id who votes my bot ? nvm got it

#

what do i need to put here ?

sullen nymph
#

Anything

#

It's a password created by you

stuck wedge
#

how to set server count

#

bot page

sullen nymph
#

What's your library

stuck wedge
#

py

sullen nymph
#

You can use dblpy

stuck wedge
#

what??

#

how to get it using POST

#

@sullen nymph

bitter crag
#

Hey, why do I have error 401 even though I have everything right?

sullen nymph
#

And make sure you are pasting it properly

bitter crag
#

I regen my token but still the same :v

vapid cape
#

then you're using it wrong

#

show code

next pendant
#

Can someone tell me how to make a widget for my discord server on the description page?

#

to show discord users and a link

vapid sapphire
#

Go to your discord server go to settings go to widget and copy the one that says iFrame

#

Post it as HTML in your description

#

@next pendant

#

Though I don’t think this is an #topgg-api topic

next pendant
#

hm

vapid sapphire
#

On dbl website for getting guild count to post in the example it says to use bot.guilds.size Shouldn't I use bot.guilds.cache.size?

#

For discord.js v12

sullen nymph
#

You should

vapid sapphire
#

ok thx

restive otter
#

const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
Where can I get the password here?

vapid cape
#

you create it yourself, you can write anything there

restive otter
#

How

vapid cape
#

as long as you put the same thing in top.gg, under Authorization

restive otter
#

I want to vote log

#

@vapid cape

vapid cape
#

go to your top.gg bot edit page

#

go to webhooks

#

you will see token, URL and Authorization

spiral dawn
#

@restive otter

restive otter
#

I'm trying to send voters to a channel.
So I created a webhook for a channel in my Discord server, and pasted the url I get to 'Webhook URL' section in my bot's edit page and I get following error:

true talon
#

thats not how it works

#

dbl webhooks !== discord webhooks

#

no

restive otter
#

How to get a DBL webhook @true talon

true talon
#

you need to use the webhook example code you can find at https://top.gg/api/docs#jslib (assuming that you're using discordjs) and put it in your bot

#

the port should be most of the time process.env.PORt or 3000

#

the password is the same as you put in your bot's top.gg page

#

replace vpsip by your bot glitch project link

#

or your vps IP

restive otter
#

okey thx

true talon
#

if you have any problem/questipn feel free to ask!

restive otter
#

I've done everything you said, a friend of mine voted but nothing happened @true talon

stray crow
rotund smelt
#

Is the api slow for anyone else right now?

#

It seems to be taking like 10-15 seconds to pull info

#

Nevermind seems to be better now

vapid sapphire
#

So how do I get the total number of votes is that with dbl.getVotes()?

vapid sapphire
#

Hmm too quiet 🀫

orchid spire
#

@stray crow You do not have to put anything in the Authorization section if you don't want to.

#

Its not a requirement.

balmy hamlet
#

@stray crow you're still setting it wrong tho

#

discord webhooks !== dbl webhooks

#

you need a webserver

#

then you should catch every post request to that webserver

#

and filter out the ones that aren't from dbl

#

if you don't know how to do that there's this thing called youtube

full charm
#

i need yt api key 2015 😦

sullen nymph
#

-api

abstract mothBOT
junior tusk
#

I wondered: is it possible for other people to use the dbl API without having a bot on it? (And without haven other's credentials)

jaunty sable
#

Where should I put my webhook thing

#

index.js?

junior tusk
#

Your choice

jaunty sable
#

Where should it be placed tho

topaz verge
#

hey

#

what's problem

client.on('ready', () => {
    setInterval(() => {
        dbl.postStats(client.guildsc.cache.size);
    }, 1800000);
});```
sullen nymph
#

client.guildsc

topaz verge
#

πŸ€¦β€β™‚οΈ

#

what is webhookAuth: process.env.AUTH });

#

@sullen nymph

sullen nymph
junior tusk
#

Where should it be placed tho
@jaunty sable just anywhere, but make sure the client is ready before you use it for making a connection to dbl

jaunty sable
#

Ah I see ty

junior tusk
#

np

topaz verge
#

@sullen nymph

#

nothing

junior tusk
#

I wondered: is it possible for other people to use the dbl API without having a bot on it? (And without haven other's credentials)

rocky bough
#

no

#

maybe on some endpoints, probably not

junior tusk
#

okay nice

#

thought I could only get my own info / my top.gg bot's info, but reproducing it doesn't work

restive otter
#

how zero two bot works

junior tusk
#

@restive otter what do you mean? Explain please

sullen nymph
#

-api

abstract mothBOT
junior tusk
#

already thought it was about something else ^

restive otter
#

@junior tusk How does the zero two bot work in discord

junior tusk
#

-wrongserver @restive otter

abstract mothBOT
#

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(

junior tusk
#

read this

restive otter
#

What i have to do when i have added weekhook url

#

i have to wait to vertify again ??

#

??

vapid cape
#

you need to configure a webhook server in your bot

#

top.gg webhooks are sent to you, not to discord, they are not discord webhooks

restive otter
#

How i can make like /vote

#

so the user can vote my bot

plush ore
#

Well make the /vote command send the link to your bots page

junior tusk
#
const dbl = new DBL(bot.voting.DBL_token, { statsInterval: 900000, webhookAuth: bot.voting.webhook_auth, webhookPort: bot.voting.webhook_port }, client);``` why does this not autopost my bot's stats every 15 minutes as it says in the docs? (I know there's also dbl.postStats())
vapid cape
#

it should

junior tusk
#

πŸ€”

#

because this is shorter code

#

but it sadly doesn't work

vapid cape
#

does your on("posted") not fire?

junior tusk
#

I don't use that event, but I joined a server with it and the amount should increase now

#

he joined it 45 minutes ago and after that nothing changed regarding guilds size

vapid cape
#

the event would be a better way to check if its working or not

junior tusk
#

okay will write that really quick

#

are you using the one I mentioned above? Or the postStats()? Or none?

#

restarted bot. So now I must wait 15 min

vapid cape
#

i dont use dblapi.js

junior tusk
#

ohh okay

junior tusk
#

Nothing logged

vapid cape
#

is client the same client you login with?

#

in the same file?

junior tusk
#

Different file

#

But is definitely defined

#

Will recheck later

vapid cape
#

its not about being defined, its about being the same

#

there should be only one client in the entire bot (unless you have multiple bots in a single file)

#

all files should use the same client, the one you created with new Discord.Client() and made .login() with

junior tusk
#

Yes it's just the same

vapid cape
#

then what is bot?

junior tusk
#

Oh that is my config bot property

#

I store some colours there, token, standard prefix, dbl token

vapid cape
#

ah so its not a bot client

junior tusk
#

Yes exactly

#

And the dbl var is just working tho. With webhook, getUser() etc.

echo salmon
#

just curious, dbl doesn't seem to enforce https, doesn't that make having an Authorization redundant ?

#

with webhooks ^

vapid cape
#

it doesnt enforce it because most users will not have an https server

valid oak
#

How do I make it so it says how many servers its in I dont understand the docs.

vapid cape
#

they either dont know or dont wanna be bothered with setting up SSL on their side

echo salmon
#

Seems like quite the security miss step

vapid cape
#

its not their problem tho, its the user's :^)

echo salmon
#

rip

valid oak
#

How do I make it so it says how many servers its in I dont understand the docs.

echo salmon
#

What language are you using

#

And do you want to update the information on the website? Or are you looking to output the number of servers your bot is in?

valid oak
#

I want make it show how many servers the bot is in @echo salmon

echo salmon
#

You shouldn't need the API for that

valid oak
#

bruh

echo salmon
#

But

#

you can still do it

#

What language are you using

valid oak
#

for what?

echo salmon
#

The bot?

#

Or whatever is communicating with the API

valid oak
#

idk

echo salmon
#

Do you have a bot?

valid oak
#

yes.

echo salmon
#

What did you make it with

livid hound
#

he fs dosent code.

restive otter
#

I am having some trouble with the DBL api. I'm trying to make a channel in my support server that announces when someone votes on the bot. I saw this code:

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!`);
});
``` but I don't understand the webhook part. Is it a webhook in Discord? And if so, what would the webhookPort, and the password be?
livid hound
#

the yourDBLTokenhere

#

also

#

it would console.log it

#

not message.channel.send it

restive otter
#

Oh yes I know I was just showing the code from the site so it wouldnt confuse people.

#

But does the port 5000 stay the same?

vapid cape
#

@restive otter top.gg webhooks are not discord webhooks

livid hound
#

^

restive otter
#

ooh

tired ivy
#

i have not used it 2 times

#

or i did not run the bot 2 times

#

why so

vapid cape
#

you're using the same port twice

tired ivy
#

no @vapid cape

#

could it be because the bot is 2 shard?

vapid cape
#

yes

#

if you're using the sharding manager, then the webhook should be in the manager

#

not in the shard

spiral steeple
jaunty steppe
#

https://top.gg/bot/619328560141697036 can anyone see the guild count here? I'm POSTing successfully locally but no changes seem to be made?

#

ah

#

im posting to the wrong endpoint

silk echo
#

I want the bot to send in the Direct Message of the user who voted for him, can someone help me?

worn quail
#

well first of all, webhooks, get the ID from the webhook that is sent from DBL, and go from there like normal

silk echo
#

where do I get the id for this "webhook"

vapid cape
#

what language are you using?

silk echo
#

javascript

#

.-.

vapid cape
#

are you using dblapi.js?

#

for posting server count?

silk echo
#

yeah

vapid cape
#

then you just need to add the webhook configuration

#

have you checked the webhook example?

silk echo
#

have you checked the webhook example?
@vapid cape I was already checking

vapid cape
#

you need to add a webhookPort and a webhookAuth

#

where is your bot hosted?

silk echo
#

@vapid cape here

vapid cape
#

?

silk echo
#

.-.

#

you need to add a webhookPort and a webhookAuth
@vapid cape OK...

vapid cape
#

where is your bot hosted?

#

your computer? vps? glitch? heroku?

silk echo
#

aahhh

#

sorry

#

I understand now

#

your computer? vps? glitch? heroku?
@vapid cape glitch.com

vapid cape
#

go to your top.gg bot edit page

#

scroll down to webhooks

#

in URL put YOURGLITCHPROJECTNAME.glitch.me/dblwebhook

#

in Authorization put anything you want, like blabla123

#

then in your dblapi.js

#

in webhookPort you put process.env.PORT

#

and in webhookAuth you put your Authorization (blabla123)

silk echo
#

ok

vapid cape
#

your dblapi should be like this

#

new DBL("top.gg token", { webhookPort: process.env.Port, webhookAuth: "blabla123" }, client/bot)

#

then you add these

silk echo
#

πŸ‘Œ

vapid cape
#

then go to your top.gg edit page and press the test button

#

you should see "user with ID xxxxxx just voted" in your glitch console

silk echo
#

ok

#

thanks

#

for help

#

:>

tepid harness
#

when will the dblpy webhook issue be fixed?

hearty pagoda
#

Why don't you get the server count from the oauth2 link

#
/(?<=Used in )(\d+)(?= server)/i```
echo salmon
#

Does the API send random get requests sometimes or am i going mad?

#

for webhooks

junior tusk
#

Can I talk to someone who knows a lot about the dblapi? All my dbl functions are working, like dbl.getUser(), but the automatic stats poster does not work, but the manual one does.
Automatic:js const dbl = new DBL(bot.voting.DBL_token, { statsInterval: 900000, webhookAuth: bot.voting.webhook_auth, webhookPort: bot.voting.webhook_port }, client);
Manual: using dbl.postStats() every 15 minutes

vapid cape
#

nothing wrong there, can you show more code? like how you use postStats

jaunty sable
#
const dbl = new DBL(<TOKEN>, client);
setInterval(() => {
        dbl.postStats(<TotalGuilds>, <ShardID>, <TotalShard>)
    }, 300000)
junior tusk
#

wait, are you talking to me, @vapid cape? As HyperGame reacts

#
setInterval(() => dbl.postStats(client.guilds.cache.size), 900000);```
#

no errors there

jaunty sable
#

@echo salmon why would I need to store vote time if I use the vote event

#

I can just clear it after 12 hours

echo salmon
#

But what if someone voted after 11 hours and 59 seconds

#

then checked

#

it would say they havent voted in the last 12 hours

jaunty sable
#

And I check whether Date.now() - 12 hours < vote time?

#

If it is smaller, then they voted

echo salmon
#

Yep that looks right

#

and if its not youd remove it from the cache

junior tusk
#
dbl.on('posted', () => console.log('posted guild size'));``` now I did this in combination with the "manual" guild size posting, and the event wasn't emitted when it changed the guild size on the top.gg page.
jaunty sable
#

How am I gonna cache the stuff? Should I use redis?

echo salmon
#

Thats up to you really

jaunty sable
#

Do you do this kind of stuff?

echo salmon
#

Id personally just chuck it in memory

#

pop it in a list

jaunty sable
#

Let’s say I do the check in the vote event, if no one votes, it won’t remove the previous votes?

echo salmon
#

Yes, you could add a periodic timer to overcome that

#

but its probably not worth it unless you have thousands of people voting and you really need the memory

vapid cape
#

@junior tusk the posted event only emits on autoposting not on manual posting

#

which version of dblapi.js are you on?

jaunty sable
#

@echo salmon no I didn’t mean that. I mean if I put the check in the webhook event, and remove from cache, and if no one triggered the vote event, the bot won’t check, and then basically this method requires someone to vote frequently

echo salmon
#

What im saying is that you could perform the check on a timer, iterate through the list and see if there are any old votes

#

But mine is just a simple example, you can implement it however you want

jaunty sable
#

Ah I see. Tysm for ur help

echo salmon
#

np

junior tusk
#

@vapid cape ooh okay. Will check. Guess the newest

#

2.4.0 is in package.json

vapid cape
#

your postStats is in the same file as new DBL right?

jaunty sable
#

Wait how can you manually post stats

vapid cape
#

by making a request?

#

you can do it with any top.gg/dbl library as well as with any http library

jaunty sable
#
const dbl = new DBL(<TOKEN>, client);
setInterval(() => {
        dbl.postStats(<TotalGuilds>, <ShardID>, <TotalShard>)
    }, 300000)

What is this? Manually or auto

vapid cape
#

you're basically using both at the same time

jaunty sable
#

Wait so I don’t need setInterval and it can already auto post?

vapid cape
#

yes

jaunty sable
#

Wtf

vapid cape
#

if you give it your client, it will autopost every 30 mins

jaunty sable
#

Ah I see. Ty!

junior tusk
#

your postStats is in the same file as new DBL right?
@vapid cape yes

vapid cape
#

does it post if you remove the statsInterval option?

junior tusk
#

and if I do use postStats()?

#

or if I don't use any of postStats() and statsInterval?

vapid cape
#

if you dont use postStats

jaunty sable
#

const dbl = new DBL(process.env.DBLAPI, client);

#

Can I use this to receive webhook events?

#

Like
dbl.webhook.on('vote')

vapid cape
#

yes

jaunty sable
#

And I can place this in ready event right?

vapid cape
#

no need to be in the ready event

jaunty sable
#

Index.js?

#

I mean is it possible to put it in ready event

vapid cape
#

it is possible yes, but not recommended

restive otter
#

u can put it outside

#

but yes

#

. . .

jaunty sable
#

Ah I see. ty

vapid cape
#

if you use postStats, the postStats can be inside the ready event

#

the autoposter doesnt, because the autoposter internally checks for the ready event

restive otter
#

How i can make my bot dm me when someone vote ??

vapid cape
#

did you setup the webhooks?

restive otter
#

dbl_w.webhook.on("vote", (vote) => {
bot.users.get("myId").send("Someone voted your bot");
});

#

?

#

@vapid cape yes

#

i did

vapid cape
#

and what isnt working?

restive otter
#

no i didnt test yet

#

cuz i have to wait 12h

jaunty sable
#

Is there a way to test the vote event?

midnight garden
#

I can add 2 bots on my account ?

restive otter
#

Yes

#

@midnight garden Yes

jaunty sable
#

It is stupid to wait 12 hours to test

restive otter
#

LoL

#

Or u can tell someone (friend) to vote it

jaunty sable
#

vote.user will return a user object right?

sullen nymph
#

It's user ID

restive otter
#

?

vapid cape
#

why do you need to wait 12h lol

#

there is a test button

restive otter
#

What where

#

??

#

Where

vapid cape
#

in your bot edit page

#

under webhooks

#

which by the way, you need to configure your webhook there too

#

you need to set the URL and Authorization

restive otter
#

bruh i press it and what must be happend

#

??

vapid cape
#

your on "vote" event will run

#

if everything is working

#

if it doesnt, then you're doing something wrong

restive otter
#

No when i press test

#

And nothing happend

vapid cape
#

then you're doing something wrong

restive otter
#

for example

#

?

vapid cape
#

what did you put in URL and Authorization?

restive otter
#

so i created a webhook in my server, copy link and paste it in URl and in AUth my password

#

?

jaunty sable
#

NO wait a second. vote.user is an ID?

sullen nymph
#

Well yeah

vapid cape
#

@restive otter thats wrong

#

top.gg webhooks are not discord webhooks

sullen nymph
restive otter
#

How do i get the top.g webhook

jaunty sable
#

dbl.webhook.on
it cannot read property of on of undefined

vapid cape
#

@sullen nymph top.gg should have big ass warning explaining what webhooks are and how they are not discord webhooks lmao

restive otter
#

how i get the webhook

sullen nymph
#

P.S whenever you enter a Discord webhook URL, it shows a warning.
Though ig it's not that big for people to notice

vapid cape
#

@restive otter where is your bot hosted?

restive otter
#

heroku

vapid cape
#

then your URL is YOUPROJECTNAME.herokuapp.com/dblwebhook

restive otter
#

oh

jaunty sable
#

And I can fill it everything I want for Authorization?

sullen nymph
#

Yup

jaunty sable
#

dbl.webhook.on
it cannot read property of on of undefined
Alright last question

#

const dbl = new DBL(process.env.DBLAPI, client);

restive otter
#

020-05-03T11:49:16.128754+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=bot-discord-cool.herokuapp.com request_id=575ff86d-ee76-4e83-8635-d04751bdda53 fwd="77.12.18.222" dyno= connect= service= status=503 bytes= protocol=http

#

-_-

vapid cape
#

@jaunty sable you need to add the webhook options

#

check the example

restive otter
#

?

vapid cape
#

@restive otter you need to enable a web dyno

restive otter
#

oh

#

How ?

#

i have to pay ??

vapid cape
#

i dont know, i dont use heroku

#

heroku has 2 free dynos

#

so you dont need to pay

jaunty sable
#
dbl.webhook.on('ready', hook => {
        console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
    });
``` I did this and it won't log anything
restive otter
#

How i can enable

vapid cape
#

did you add the webhook options?

jaunty sable
#

yea I did

#
const dbl = new DBL(process.env.DBLAPI, { webhookPort: 5000, webhookAuth: 'WebHookAuth' },client);
restive otter
#

wait i will google it

vapid cape
#

and the ready event doesnt fire?

restive otter
#

oh maybe now

#

at=error code=H10 desc="App crashed" method=POST path="/dblwebhook" host=bot-discord-cool.herokuapp.com request_id=fa21d9d6-59da-40b7-967a-df9856c6bc2d fwd="165.22.130.154" dyno= connect= service= status=503 bytes= protocol=http

jaunty sable
#

yea the ready event wont fire

restive otter
#

-_-

jaunty sable
#

Probably I put it in ready event of the bot?

junior tusk
restive otter
#

Any suggest for free hosting

vapid cape
#

@restive otter now its working, but your bot crashed

#

so you did something wrong in your code

restive otter
#

how

#

but . . . nv

#

nvm

vapid cape
#

show code

#

your DBL and dbl.webhook

#

@jaunty sable it should work outside of the ready event

#

is it in your main file?

jaunty sable
#

It logged the ready thing after I moved to my main file

#

But when I test the webhook nothing happened

vapid cape
#

what did you put in URL and Authorization?

jaunty sable
#

I put nothing in auth and my server ip
x.x.x.x:1234/dblwebhook

restive otter
#

ahm i enabled web dyno : web npm start

#

so ?

vapid cape
#

@jaunty sable put in Authorization the same thing you put in webhookAuth

#

@restive otter i mean your bot code

jaunty sable
#

I did and still nothing happened

vapid cape
#

is it a vps?

jaunty sable
#

Yea

vapid cape
#

which hosting company?

jaunty sable
#

Galaxy Gate

vapid cape
#

add http:// before the ip

restive otter
#

@vapid cape I used the example codes ??

vapid cape
#

show code

jaunty sable
#

It still doesn't show anything

restive otter
#

wait

jaunty sable
#

Webhook running at http://0.0.0.0:1234/dblwebhook

vapid cape
#

@jaunty sable dm me your ip and port

restive otter
#

@jaunty sable Nice

jaunty sable
#

Put it in a bin

#

Bruh

restive otter
#

i cant idk why

#

it doesnt allow me to save files

vapid cape
#

you dont need two DBLs, you can do dbl = new DBL(token,{options},bot)

restive otter
#

ok

vapid cape
#

change this bot.users.get("545490362568015873").send("Someone voted your bot");
to console.log("user voted")

jaunty sable
#

Any idea why mine isn't working?

vapid cape
#

for testing

#

@jaunty sable did you put the IP address of your server or your home pc? which one are you testing the webhooks on?

jaunty sable
#

Yea I did

restive otter
#

@vapid cape Ok

jaunty sable
#

https://<Home PC IP>:1234/dblwebhook

vapid cape
#

for home pcs you need to portforward your router

#

because ports are usually blocked by default

restive otter
#

maybe http://

jaunty sable
#

That's annoying

restive otter
#

not https

jaunty sable
#

Ill try push to my VPS

restive otter
#

use ssh

vapid cape
#

you can put a test bot in your vps as well

restive otter
#

on linux is good cuz u have optimesed terminal

jaunty sable
#

Wtf even I pushed to my VPS it still wont log the vote

silk echo
#

hello, can someone help me?

vapid cape
#

did you change the ip and port to your vps's?

jaunty sable
#

Yea I did

vapid cape
#

dm me your ip and port

jaunty sable
#

How can I check if port 5000 is opened in the VOS

vapid cape
#

your ip and port are correct

#

dm me your authorization

#

@jaunty sable your webhook is working

#

i sent you a test request and you received it correctly

jaunty sable
#

How did you know I received it

vapid cape
#

did you get a log in your console?

jaunty sable
#

Uhh no

vapid cape
#

show your code again

jaunty sable
vapid cape
#

is this in your main file?

jaunty sable
#

Yea

#

I mean no

#

it is in bot.js

#

and my main file is index.js

#

Which is shardingManager

vapid cape
#

that will not work

jaunty sable
#

wtf I have to put it in index.js?

junior tusk
#

ohw btw I see a possible error (nothing to do with what you're talking about): when the user that voted doesn't share a guild with your client, it goes wrong

vapid cape
#

because you cannot use the same port more than once, if you put it in the shards, each shard will try to open port 5000, which will throw an error port already in use

jaunty sable
#

I don't have that error

vapid cape
#

or maybe you do but its not logged anywhere

jaunty sable
#

I changed the port to 1029

#

And still nothing happened

restive otter
#

Bot crashed one more time -_-

jaunty sable
#

Oh wait now the console logged something

restive otter
#

i changed to console.log()

junior tusk
#

@vapid cape I now did it without statsInterval, without postStats() and with dbl.on('posted') and nothing logged/happened

silk echo
#

mine says he has no authorization .-.

#

Oops! Error: 401 Unauthorized

restive otter
#

const dbl = new DBL(botconfig.api_token, {
webhookPort: 5000,
webhookAuth: "pasword",
}, bot);

silk echo
#

OK

restive otter
#

it crashed one more time @vapid cape -_-

jaunty sable
#

Ah I got it working. Ty tim

restive otter
#

bruh

#

oof imma switch to google vps

silk echo
#

mine is giving error .-.

vapid cape
#

you didnt give it your dbl/top.gg token

restive otter
#

@jaunty sable How did u make webhook on vps ??

#

tell me pls

jaunty sable
#

Ip:port/dblwebhook

restive otter
#

oh ok

#

so u have to open port ??

jaunty sable
#

Yea

restive otter
#

how ?

#

@jaunty sable how ?

#

@jaunty sable What trafic tcp ??

vapid cape
#

@restive otter you switched to google vps?

#

google compute engine?

restive otter
#

yes

#

it is bad ??

vapid cape
#

you need to open the port in google firewall

restive otter
#

oof

vapid cape
restive otter
#

ye

#

added port 5001

#

Now

#

?

#

switched to webhookPort: 5001,

#

now ?

#

http://<ip>:5001/dblwebhook

#

but i it not working :((

#

when i type node index
output :
Webhook running at http://0.0.0.0:5001/dblwebhook

#

it is ok or it must display my ip andress

#

cuz here is 0.0.0.0

vapid cape
#

this is ok

#

dm me your ip and authorization

restive otter
#

but when i press test nothing happend

vapid cape
#

your firewall is wrong

#

show your firewall settings

restive otter
#

?/

#

?

vapid cape
#

put 0.0.0.0/0 on ip range

restive otter
#

ok

#

address already in use :::5001

#

-_-

#

why

#

how

vapid cape
#

in firewall or in your code?

restive otter
#

when i start node index

#

?

#

OMG it worked

#

OMG

#

thx

restive otter
#

Hi

junior tusk
#

well still nothing happened with the autoposter from the dblapi. Guess it's just not working then

vapid cape
#

there is only two possible reasons

#
  1. the client you gave it is wrong and/or not logged in
  2. it is actually working but it doesnt log for some reason, for example in some cases, child processes on windows dont get logged to the main process's console
junior tusk
#

I guess it's not one of them though.

  1. index:
    consoleLog.execute('Discord client is ready!');
    intervals.execute(Discord, bot, client, con);
    updateCounter.execute(Discord, bot, client, con);
});```
and in intervals.js:
```js
module.exports = {
    execute(Discord, bot, client, con) {
        const DBL = require('dblapi.js');
        const moment = require('moment-timezone');
        const consoleLog = require('./consolelog.js');
        const dbl = new DBL(bot.voting.DBL_token, { webhookAuth: bot.voting.webhook_auth, webhookPort: bot.voting.webhook_port }, client);
        ...```
2. I'am logging guild joins/leaves, and I added my bot to a server and after hours, nothing changed on the top.gg website
vapid cape
#

did you try simply putting it in your index?

junior tusk
#

no

#

will do that. Using the automatic statsInterval amount?

vapid cape
#

yeah

junior tusk
#

okay I have this now:

client.on('ready', () => {
    consoleLog.execute('Discord client is ready!');
    const DBL = require('dblapi.js');
    const dbl = new DBL(bot.voting.DBL_token, { webhookAuth: bot.voting.webhook_auth, webhookPort: bot.voting.webhook_port }, client);
    dbl.on('error', (error) => {
        consoleLog.execute(error.stack);
    });
    dbl.on('posted', () => {
        consoleLog.execute('posted guild size');
    });
});```
#

not really nice how I've done it tho

vapid cape
#

good enough to test

junior tusk
#

πŸ‘

junior tusk
#

okay almost 30min ago

#

ffs I removed the bot from the test guild 😭

#

🀦

hexed glade
#

Someone knows why the class DiscordBotListAPI can't be found even if I have the java maven package installed with no error? :p

#

Just had to invalidate caches

junior tusk
#

Still not posting, Tim

tender barn
#

is it normal to get a 503 error from the dbl postStats endpoint? Or is this just some random issue with the server? just making sure its not rate limiting or anything.

restive otter
#

When someone votes a bot, how can i get the user who voted the bot? Python discord.py

junior tusk
#

@restive otter read the api at the top.gg website

#

Ohw sorry it is not listed there for py

vapid cape
#

there is a py library there

junior tusk
#

I couldn't find the voting part for py. Or I'm blind

vapid cape
#

does your bot log this? consoleLog.execute('Discord client is ready!');

junior tusk
#

Yes

#

Consolelog is just a console log with time in front of it and I've used some formats to make logging easier

#

I just think it's not working, but yeah that's me

restive otter
#

Is there an event called while voting a bot?

vapid cape
#

there is a webhook sent by top.gg to an URL of your choice (not discord webhook)

#

@junior tusk do you have any log saying undefined?

junior tusk
#

No

vapid cape
#

well then i have no idea whats going on

#

try console.log(error) instead

#

the error might not have a stack

#

also, you said it works with postStats?

#

oh wait

#

i know why

#

put it outside of the ready event

junior tusk
#

Oh lol I just wanted to reply

#

Does that change anything?

vapid cape
#

because new DBL(client) adds a client.on("ready")

#

to set the posting interval

#

so if you run it inside the ready event, its like creating a ready listener on ready, but since the ready is already over by then, it will never run

junior tusk
#

Oof 😳

vapid cape
junior tusk
#

But it did connect to the webhook tho

restive otter
#

tim u help me ?

junior tusk
#

So that doesn't wait for ready

restive otter
#

can u help me ?

vapid cape
#

the webhook doesnt wait for ready, since it doesnt need the client

restive otter
#

but not api

junior tusk
#

Ohh okay thanks!

#

Even I understand that code you just sent, never thought I could xd

vapid cape
#

also, i noticed something recently

#

the ready event can be fired more than once

junior tusk
#

When a bot restarts or something?

vapid cape
#

not sure if its because one of my bots is outdated, but it has been firing ready more than once, when the bot reconnects for example

#

might be because its outdated lol

junior tusk
#

Oh lol

#

Wait... maybe that's why client.once('ready' exists

#

I used that for a really long time

#

Then I changed it because I was the only one

vapid cape
#

yeah lol

junior tusk
#

So that's better to use if you're executing other files in the ready event

#

Otherwise my bot will do weird things

cursive monolith
#

How do I get an API token without listing a bot on the site?

spiral steeple
#

you dont

tender barn
#

not sure how useful that would be

spiral steeple
#

to access the api, you MUST have a bot on the site

cursive monolith
#

If all I want is to search bots using the GET https://top.gg/api/bots route, I don't see how listing a bot is required.

tender barn
#

well they decided you need a bot to use their api

#

at a minimum

spiral steeple
#

because they dont want people spamming their api if they aren't users of the site

#

the api is already scuffed enough

cursive monolith
#

I just want to get a list of top X bots by server count. Their site doesn't have an interface that does this, but it seems their API does.

spiral steeple
hearty pagoda
#

Lol, that endpoint works without any tokens @cursive monolith

spiral steeple
#

idk if marco allows it without a token either

cursive monolith
#

Let me try it again then.

spiral steeple
#

no it doesnt

#

lmao

hearty pagoda
cursive monolith
#

GET https://top.gg/api/bots

{"error":"Unauthorized"}
hearty pagoda
#

It works for me, weird.

spiral steeple
#

wanna show what you got then?

tender barn
#

looks like being logged in is all you need

#

but thats gonna be difficult to do through the api without a token

cursive monolith
#

Yeah. I refreshed it and it seems to have loaded this time.

hearty pagoda
#

It might be because I'm logged in. Go into the network tab and copy the request headers.

cursive monolith
#

Yeah. I'm going to try doing this in postman and see what headers it's using.

sullen nymph
#

I'd bet it just uses cookies

tender barn
#

it does

#

almost certain

vapid cape
#

marco's rankings and statistics are always fun to look at, especially ordering by shard count lmao

#

there's a bot with 10 shards and 10 guilds

tender barn
#

brilliant

vapid cape
#

another with 10 shards and ~300 guilds

#

5 shards and 19 guilds

cursive monolith
#

Looks like all you need is the connect.sid cookie.

restive otter
#

You can receive vote updates into a channel in discord right?

#

Swear I've seen someone do it

green mantle
#

you use the webhook system

#

and then handle sending stuff to discord urself

restive otter
#

Gotcha

#

I did think that :)

restive otter
#

how to show the count of guilds that my bot had, i don't understand #topgg-api:( i tried but doesn't works

silk echo
#

something is giving error in the api ...

silk echo
#

ehh

#

can i send the error?

ocean rain
#

heyo guys, so how exactly do i display the server count for my bot on DBL?

cobalt seal
#

hey

wheat geyser
#

yo

#

@ocean rain server count is in pinned

#

how 2 do it

cobalt seal
#

im currently trying to make a bot that stops ip tracing in my discord server is there any way that would work ?

wheat geyser
#

hmm

#

may not stop it 100 percent

#

but you could definitely minimise it

ocean rain
#

@wheat geyser oops thank you!

wheat geyser
#

allg

cobalt seal
#

because wiredshark use l2p and l3i and pings your ip address and sees what devices you are seeing and what you are use and multi ip address

wheat geyser
#

idk tbh

#

there probably is a way

ocean rain
#

hey uh i cant seem to edit my bot on DBL?

#

i tried editing its description just now and clicked submit but nothing changed

cobalt seal
#

how do i earn the rank bot dev ? @ocean rain

wheat geyser
#

i think you gotta get your bot accepted

ocean rain
#

yep

cobalt seal
#

my bot isn't yet ready for the publish πŸ˜–

ocean rain
#

dw! you'll get there

wheat geyser
#

did you try editing it again peanut

cobalt seal
#

who's the owner for this server ? @ocean rain

ocean rain
#

@wheat geyser yeah and i just got pinged in #logs , i guess that means something did happen lol

wheat geyser
#

lmao

ocean rain
#

@cobalt seal i dont know but you could ask a mod

cobalt seal
#

who els uses gscc ?

ocean rain
#

pardon?

wheat geyser
#

whats gscc

restive otter
#

I am trying to use this code:
dbl.postStats(client.guilds.size);
but each time I get a return error of "postStats must contain 1 argument".

wheat geyser
#

weird

#

it has 1 argument

restive otter
#

yus

#

Let me try something different hold on

wheat geyser
#

k

restive otter
#

It worked now. Sorry

wheat geyser
#

allg

restive otter
#

I put in discord webhook into website but when I press test nothing comes through CBEyeSpazm

spiral steeple
#

because it doesn't work with discord webhooks

#

it even tells you it doesnt

#

you need an actual webserver

#

listening for POST requests

restive otter
#

is there is anyway to send a fake vote to test my code ?

valid ravine
#
dbl.webhook.on('vote', async  (vote, message )=> {  
let {body} = await get(`https://hd-development.glitch.me/api/fetchUser?id=${vote.user}`);
  let embed = new RichEmbed() 
  .setColor('RANDOM') 
 .setThumbnail(body.avatarURL)   
  .setAuthor('KhangBot vote Webhook', 'https://cdn.discordapp.com/emojis/338808864352763904.png') 
  .setDescription(`***${body.tag}*** Just voted EDGE\nWith ID: ${vote.user}`)
  .setTimestamp();
let U = client.channels.get('704011970478735450')
U.send(embed);```
#
(node:1384) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined```
restive otter
#

if its djs v12, then client.channels.cache.get();

valid ravine
#

ahh

#

v11

restive otter
#

does channel exists with that id ?

valid ravine
#

so what should i use

restive otter
#

client is not able to get the channel with that id

valid ravine
#

oh

restive otter
#

and you can simply it,
return client.channels.get('channel id').send(embed);

valid ravine
#

i'll try it

restive otter
junior tusk
#

@restive otter oh yes there definitely is

#

go to your bot's page, press edit and scroll down to the API part. There is a test button

#

It will send a vote with your own user id

restive otter
#

Thanks @junior tusk

junior tusk
#

np

jade shuttle
#

what are the possible values of type parameter in webhook json data

#

what can be the possible types of vote?

vapid cape
#

i think test or vote

#

to differentiate when using the test button

jade shuttle
#

The type of the vote (should always be "upvote" except when using the test button it's "test")

#

its not that

#

wait

junior tusk
#

btw my automatic statsposter is working now, @vapid cape. Thanks for the help

jade shuttle
#

nvm

#

should i check for its value in my handler?

vapid cape
#

@junior tusk amen lmao

junior tusk
#

πŸ˜‚

#

@jade shuttle what do you want to do?

jade shuttle
#

handle the webhook

junior tusk
#

ok but if you just don't use test, you don't have to check if the vote was a real one or a test

sullen nymph
#

should i check for its value in my handler?
@jade shuttle the same event is fired for test and votes, you can check for data.type

jade shuttle
#

so i can safely discard that value

junior tusk
#

Yes you can just check if it's a vote or a test vote, if that's what you mean

jade shuttle
#

okay

#

is Snowflake a string or int?

sullen nymph
#

string

jade shuttle
#

what are the query params that can be passed

junior tusk
#

when you want to get bots?

jade shuttle
#

what?

#

I mean

#

Query string params found on the /bot/:ID/vote page. Example: ?a=1&b=2
what can be those parameters

#

and what do they mean

restive otter
#

can someone help me? i am not getting vote updates ?

junior tusk
jade shuttle
#

yes

junior tusk
#

oh I don't know how that method works

jade shuttle
#

i'm using the dbl webhooks

#

although i'm not using the python library to handle webhooks

junior tusk
#

hmm idk 🀷 I'm sorry

jade shuttle
#

what should be my response to the request?

#

just a simple 200 would work?

vapid cape
#

yeah it should

restive otter
#

How would I do it so that only people that have voted get access to a command

jagged pine
#

Can I have 2 bots connected to the same api key?

junior tusk
#

@jagged pine I think you can't as the dbl requires your client as a parameter

jagged pine
#

UHm

jagged pine
#

What is the event that receives a vote?

junior tusk
#

look at the api in the channel description

jagged pine
#

Actually there isn't an event for that, I have to use webhooks

#

but looking them up in the api I can't really understand how to set up a webhook

abstract mothBOT
#

tickNo This user has no bots

tiny ingot
#

?

junior tusk
#

@jagged pine go to your bot's page -> edit -> scroll down

jagged pine
#

Yeah, but I kind of don't know what a webhook is exactly and how to set up one, if someone could link me a guild it would be really helpfull

junior tusk
#

I'm sorry if I had the time I could've helped you

#

I don't know if a guide exists

storm sequoia
#

we need a website to post webhooks?

#

from API OPTIONS section

restive otter
#

well duh yeah

restive otter
#

how can i use the vote event?, i was testing and i don't understand

jagged pine
#

there isn't a vote event

#

You need a webhook for that event

#

we need a website to post webhooks?
@storm sequoia That's what I havent's understand about webhooks

vapid cape
#

you need a webserver

#

not necessarily a website

#

a webserver can be something as simple as express.js in node

#

the official top.gg libraries also create a webserver for you when you use webhooks

#

for example dblapi.js creates a webserver for you

bold fulcrum
#

when dbl submits the vote, does it go as part of the URL or is it part of the request body

spiral steeple
#

if a query string is in the url, it will add it to the passed data

solid wharf
#

test it with requestbin or a catch all in express

bold fulcrum
#

couldn't find the page

#

sorry KEK

restive otter
#

The API doesn't make sense. I have 7 monthly votes, but when I check the API for the people who voted, only 5 show up in the list.

signal hawk
#

is it possible one of those people has voted more than once

restive otter
#

@signal hawk So it should show on the list more than once?

#

I voted 3 times, that shows up.

signal hawk
#

ah, i see.

#

not sure then myself,

restive otter
#

Can someone address this issue please?

junior tusk
#

@restive otter what code did you use?

restive otter
#

Nothing over complicated.

junior tusk
#

Hm ohw I don't know that way of doing it

#

🀷

restive otter
#

Its in the docs

junior tusk
#

Oh yes but I can't help with that one

onyx temple
#

@restive otter What do you do to have the profile picture animated?

restive otter
#

@onyx temple Buy Nitro

onyx temple
#

Thanks

restive otter
#

np

restive otter
#

I have this error sometimes when I start my bot.

(node:1389) UnhandledPromiseRejectionWarning: Error: 503 Backend fetch failed
    at IncomingMessage.<anonymous> (/home/AKMusic/node_modules/dblapi.js/src/index.js:118:25)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1201:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
bold edge
#

It's because the site is down atm, dont worry about it

hearty pagoda
#

catch and ignore the rejected promise

tribal ridge
#

s

ebon pivot
#

Why is botblock blocked from using the api?

ocean rain
#

i read the server count pin but i still dont understand how to do it ;(

#

how do i get an API token?

vapid cape
ocean rain
#

i cant get a token tho

#

i clicked on "generate token"

#

and i tried ctrl ving but nothing happened

#

oh wait, my bad

#

πŸ˜…

#

this one i mean

vapid cape
#

@arctic arch the website is having that weird cloudflare problem again

#

if you access the docs page directly, this is what happens
if you access the main page, you get the cloudflare 5 second "browser checking" thing, after that the docs page works again

ocean rain
#

oh yeah i got that too

#

i thought that was just my browser being weird lol

vapid cape
#

the docs page itself however doesnt do the cloudflare 5 second check if you access it directly, and without the browser being checked first, all the css files get blocked
this problem only happens if cloudflare decides to do the browser check on you, not sure what conditions they use to decide your browser should be checked

elfin maple
#

Why is the server count not updating?

elfin maple
cobalt seal
#

ok

jagged pine
#

If I wanna use the dbl api webhooks do i need to have a website?

vapid cape
#

no

ebon pivot
#

Why is botblock blocked from using the api?

jagged pine
#

no
Good, one step closer to understanding what them are hahha, guess I'll have to do some research

sullen yoke
#

hi, I was wondering if I could get some help with the webhooks (which used to be working)...

#

apparently setting the webhook port activate the web server, here the code (minus the password) python self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='****', webhook_port=5000)

#

also, I don't get any errors outputed the console when I start the bot and it is successfully updating stats on top.gg

#

any ideas why this is happening?

#

also, I did try disabling the sortware firewall to test if that could be the cause

#

I'm runing Python 3.8.2, dblpy version 0.3.4

green mantle
#

Are your ports definitely open

restive otter
#

^ a portchecker might help with that

sullen yoke
#

I turned off the servers software firewall as part of my testing in case it was blocking traffic on port 5000 as traffic is clearly hitting it when I use the test webhook on the top.gg page

green mantle
#

do you actually have the one webhook test event then

sullen yoke
green mantle
#

so whats the issue then?

sullen yoke
#

it's stopped worting

#

nothing is listening on port 5000

green mantle
#

has the ip changed

sullen yoke
#

and no error is being outputted when I start hte bot indicate it's having issue setting a webserver to listen for traffic

#

if you look at the first pic you can traffic from top.gg external ip hit the server on port 5000

green mantle
#

but has your actual external ip changed

sullen yoke
#

the first line is the network bandwidth being used by the bot proccess the second is inbound traffic

green mantle
#

seeing that most ISPs use dynamic ips so your changes every x time

sullen yoke
#

I have a minecraft server on the same ip which is still accessable to friends so, no

#

also, it would be impossible for the dbl traffic to hit server if the ip changed

#

I'll try to do some testing to see if I can make the webhook webserver be more verbose as my second picture shows that nothing is listening on port 5000

restive otter
#

What tthe webhook auth, password?

#

example please.

sullen yoke
#

I'll check it again but, I tripple checked everything before coming here lol

#

also, I'm using python

#

I copied and pasted the secret code from the top.gg page to my source code but still no luck

#

I've still got things I can check though so, I'll do some digging in /var/log/ and what not

restive otter
#

:(( the webhook is not working

#

oh i didnt know the ip was changed

#

so no problem more xD

pearl coral
#

guys let's say i want my bot to do something every time someone votes for it on dbl. I'd call the dbl.on_dbl_vote(data) within the main.py of my bot?

sullen nymph
#

It's a listener/event that will be emitted whenever someone votes for your bot on top.gg

pearl coral
#

thanks πŸ™‚

#

@sullen nymph do you know what the format of data is

#

like what the keys are

sullen nymph
pearl coral
#

thanks πŸ™‚

#

wait

#

what does Snowflake mean?

#

like if I wanna get the discord Id of the person who voted

#

i'd do data['user'].what

sullen nymph
#

an ID with type string

pearl coral
#

oh

#

thanks

#

so just data['user'] then

sullen nymph
#

Yup

pearl coral
#

ty

jagged pine
#

Does someone know a guide or something to help me understand how to use webhooks to fetch votes for my bot and send a message in my server. I can't understand how to do it

pearl coral
#

@sullen nymph sorry bro im a little lost about how to set up the webhooks

#

I have the same question as @jagged pine

jagged pine
#

I don't think you should ping a mod xD

sullen nymph
#

Official DBL libraries can host webhooks for you

pearl coral
#

sorry but how do we do that?

#

sorry for pinging btw

sullen nymph
pearl coral
#

webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000

#

thank you

jagged pine
#

Wait, is it that easy?

vapid cape
#

you still need to put a correct URL in your top.gg edit page

#

otherwise yes, its that easy

jagged pine
#

you still need to put a correct URL in your top.gg edit page
ok idk what that means

#

seemed to easy xD

#

URL of what?

vapid cape
#

a webhook is a reverse http request. instead of you sending a request from a website or api, the website sends a request to you

#

so when someone votes, top.gg will send a notification to the URL you specify, informing you that someone voted

#

in the form of a POST request

#

so you need to create something that can receive this request

#

usually with your own webserver or website

jagged pine
#

is there a guide for this?

#

usually with your own webserver or website
what if I don't have one

vapid cape
#

the official libraries do the setting up of the webserver for you

jagged pine
#

Oh

#

nice

vapid cape
#

so if you use dblapi.js, and give it a webhook port, it will create a webserver for you