#topgg-api

1 messages · Page 123 of 1

hearty lintel
#

alright

#

yeah i cant seem to reproduce the error

main prairie
#

if only I could unreproduce it lol

hearty lintel
#

@main prairie if on ready you do const ap = new AutoPoster.DJSPoster('token', client)

main prairie
#

is the const ap important?

hearty lintel
#

no

#

if you wanna event when you post yes but otherwise no

main prairie
#

yea I saw that, with the ap.on

hearty lintel
#

i mean you could just

#

AutoPoster(...).on('posted', () => {})

#

without defining it kekw

#

but yea u dont need to

#

but try using the structure built

main prairie
#

yea I did copy paste it, then just edited the token to make use of my index.json file, apart from that nothing should have changed, that's why it's weird...
Also it worked yesterday, so my bot is now marked with the right number of servers, just not updating

#

I'll play around with it, maybe there's something small I changed by accident or something silly

#

again ty for the help!

hearty lintel
#

yeah for sure

formal sparrow
#

Is it possible to set webhook server in runtime rather than providing it when dbl object using DBL class itself in dblapi.js?

#

What I mean is whether something like this is possible

const dbl = new DBL('token');

dbl.someMethod(/* stuff about webhook server */);
``` Instead of
```js
const dbl = new DBL('token', { webhookServer: serverObject, webhookAuth: 'some password' });
knotty garnet
#

you could create an actual webserver, but idk about creating at runtime

#

ah

#

isn't there something like that on the docs?

formal sparrow
#

Not sure

knotty garnet
#

no idea

#

I remember they created a new "fresh from the oven" lib for top.gg

formal sparrow
#

Well, I'm just gonna uninstall dblapi.js and gonna install @top-gg/sdk since I only need webhook and I need to get dbl object in 3 shards for doing some stuff which is why I wanna assign webhook details later on runtime rather than at start

main venture
#

Is there a way to post server count without using dblpy module in python?

jaunty plank
#

you could send the api requests manually.

#

not manually, but with whatever http requester you want

main venture
#

Probably will use requests module then

sullen nymph
#

use aiohttp please

main venture
#

Oh ok

#

Wait, is it like 100% must-use module?

#

Like it’s a better way to use aiohttp

sullen nymph
#

dblpy isn't must-use

#

aiohttp is more recommended since it's actually asynchronous and fits discord.py better

main venture
#

Probably should switch to aiohttp then... I used requests only

sullen nymph
#

Mhm

main venture
#

I think there is no a big difference in their syntax 🤷‍♂️

sullen nymph
#

Eh, a fair bit but in the end it's worth the migration

main venture
#

Alr :D

#

Thx a lot 🙂

sullen nymph
dapper bobcat
#
const DBL = require('@top-gg/sdk');
const webhook = new DBL.Webhook('topggAPIAuth')

app.post('/dblwebhook', webhook.middleware(), (req,res) => {
       console.log('We have arrived.')
    console.log(req.vote.user)
})

app.listen(<port number>, () => {
  console.log('Listening');
});```

Why doesn't it work? I don't get any errors, the webhook just isn't triggered.
restive otter
dapper bobcat
#

is it approved?

restive otter
#

no

dapper bobcat
#

then thats why

#

you cant connect to the api without an approved bot

restive otter
#

okay

#

thanks ❤️

restive otter
proven sandal
#

How to do the vote requirement command?

knotty garnet
#

use a database to store users' last vote

willow spindle
#

there is /check endpoint

cedar arch
#

!help

uncut kelp
#

for webhook, we don't need top.gg token?

restive otter
#

maybe you didnt installed it?

uncut kelp
#

yup, and then i install npm i express
but after that i try to test webhook, but nothing

#

i follow the instruction on pin

restive otter
#

where did you host your bot

uncut kelp
restive otter
#

Did you open port

uncut kelp
#

wait a sec

uncut kelp
restive otter
#

your public ip address

#

i guess

uncut kelp
restive otter
#

idrk didnt use ubuntu

willow spindle
#

curl ifconfig.co

uncut kelp
#

thanks

#

i always get error when i run with public ip

#

i have to use public ip and open port

#

but why still didn't work

restive otter
#

dont show your ip

#

also i think yes

uncut kelp
#

when i test in webhooks top gg, its not respond

restive otter
#

use a site and check if the port is open

uncut kelp
#

my code

  app.post('/dblwebhook', webhook.middleware(), (req, res) => {
    // req.vote is your vote object e.g
    console.log(req.vote.user) // 221221226561929217
  }) // attach the middleware
  
  app.listen(myport) // your port
#

that code will show in console log when someone voted right?

restive otter
#

yea

#

it will log the user id

uncut kelp
#

still closed, but i have to open, idk why

uncut kelp
#

i have no idea, my panel cannot run when i use public ip in bot
is public ip only one?

#

to get notif when someone vote, must be use webhook?

willow spindle
#

yes

uncut kelp
willow spindle
#

what

uncut kelp
#

the public ip every host just only have 1 ?

#

or many

uncut kelp
#

i try sudo ufw allow 'myport'

#

the port added, but when i check, still closed to my ip

#

port **** is closed on ***.***.*.*

sullen nymph
#

Are you adding the apostrophes

uncut kelp
sullen nymph
#

' '

uncut kelp
#

btw can i remove req, res ?

#

what res meaning?

#

when user has vote, and try to vote again, the webhook will be triggered or not?

tribal sky
#

how do i setup a new webhook url?

pallid forge
#

Head over to our documentation for webhooks first

#

You can find both the section about webhooks and examples of how to use the webhooks depending on what library you are using

tribal sky
#

alr

#

also @pallid forge abt the url my friend set it up

#

apparently he says that he got the url from this bot: Dbl vote

pallid forge
#

Okay I’m not sure how any external services operate so I won’t be able to help there sorry.

#

The documentation does explain how to implement the code etc

tribal sky
#

alr thanks anyway

tribal sky
tribal sky
#

anyone?

#

im hosting the bot on vultr

minor wedge
#

It is not working for me

#
const TOPGG = require('dblapi.js');
const topgg = new TOPGG(process.env.TOPGG, client);

topgg.on('vote', vote => {
  client.channels.cache.get(`790885444794449942`).send(` Upvoted on top.gg!\nID: ${vote.user}`);
});
restive otter
#

use new library

minor wedge
#

Link?

restive otter
#

pins

minor wedge
#

Alr Thanks

minor wedge
restive otter
#

look at the npm page

#

not so many things changed

minor wedge
#

I just checked but, it's for updating stats I guess

#

topgg.on('vote', vote => {
  client.channels.cache.get(`790885444794449942`).send(` Upvoted on top.gg!\nID: ${vote.user}`);
});
#

This remains same?

restive otter
#

Nope

minor wedge
#

I can't figure out this

#

The new api

restive otter
#

its too ez

minor wedge
#

Well, not for me I guess

#

If you know, you can maybe guide me here or dms?

restive otter
minor wedge
#
const express = require('express')
const Topgg = require('@top-gg/sdk')

const app = express() // Your express app

const webhook = new Topgg.Webhook('topggauth123') // add your top.gg webhook authorization (not bot token)

app.post('/dblwebhook', webhook.middleware(), (req, res) => {
  // req.vote is your vote object e.g
  logChannel = ...
  logChannel.send(req.vote.user) // 221221226561929217
}) // attach the middleware

app.listen(3000) // your port
restive otter
#

yup

minor wedge
#

Alright Thanks man

slow dust
hot axle
#

in the app.listen pass a callback

ionic abyss
#

hello im a js coder but what webhook url can i put like idk what to put there

restive otter
#

where do you host your bot

ionic abyss
#

hmm

#

madsen?

restive otter
#

You put your site url

ionic abyss
#

me?

restive otter
#

Yup

ionic abyss
#

like this?

restive otter
#

yup

ionic abyss
#

okay thank you

#

but why do i get this then

hot axle
#

because your route accepts post requests

#

not get

ionic abyss
#

hmm

#

im waiting

#

it did not send a message

#

nor did it console log

#

it didnt send message

#

it dint console log to

#

:c

tight crag
#

Come in vc bro @ionic abyss

ionic abyss
#

wich one?

#

@tight crag

#

hello

#

i dont understand you

#

yes

#

can u talk little slower

#

ok

tribal sky
#

how do i setup webhook url?

ionic abyss
#

hi

#

i console logged my dbl.webhook thing

#

/dblwebhook

#

this is right

rapid kettle
#

@ionic abyss can I see what you’ve put into the site

ionic abyss
#
  dbl.webhook.on("vote", async (vote) => {
    const user = client.users.cache.get((u) => u.id === vote.user);
    const ee = new MessageEmbed()
      .setTitle(`${user.username} Thanks for voting!`)
      .setDescription(`You got 1000 coins and unlocked 2 commands!`);
    await client.channels.cache.get("790923255250419722").send(ee);
    await addUserMoney(user.id, 1000);
  });```
#

this is the code that doesnt work

rapid kettle
#

can I see what you put into the site

ionic abyss
#

??

rapid kettle
#

and can I see your website config

#

the config on the site

ionic abyss
#

theres no site

#

just a bot

rapid kettle
ionic abyss
#

that uses that

rapid kettle
uncut kelp
ionic abyss
rapid kettle
rapid kettle
ionic abyss
#

yes

rapid kettle
#

can I see your webhook config line

ionic abyss
uncut kelp
rapid kettle
ionic abyss
#
const http = require('http');

const app = express();
const server = http.createServer(app);```
rapid kettle
ionic abyss
#

i followed this tutorial

rapid kettle
#

oh wait you’re using a server

ionic abyss
#

yeah

rapid kettle
#

is the server listening on port 25635?

uncut kelp
ionic abyss
#
server.listen(25635);```
rapid kettle
#

huh, weird

#

have you tried pressing test?

ionic abyss
#

lemme restart and follow what you said

#

ima restart first maybe that will fix

#

i think the webserver dint launch

rapid kettle
#

might help

#

try going to the URL in your browser too

ionic abyss
#

what happens if i press test

rapid kettle
#

it sends a test vote

ionic abyss
#

ah ok

#

dint get it then

#

i think it doesnt find the user

minor wedge
#
 const Topgg = require('@top-gg/sdk')
const express = require('express')
const app = express() 

const webhook = new Topgg.Webhook('WhosTheGambler')

app.post('/dblwebhook', webhook.middleware(), (req, res) => {
 // logChannel = client.channels.cache.get(`790885444794449942`)
  console.log(req.vote.user+" has upvoted on top.gg!")

}) 
app.listen(4000)
#

This is not working for me

void turret
#

Pls quest command of dank memer bot is not working

Pls repair it
Because I have completed 50 days streak quest

For today it is 52nd day
These many days of my hardwork will go waste so please help

#

@everyone

tribal sky
#

can someone help me setup webhook pleasee

#

what url shud i give?

restive otter
#

i have a webiste

inland mist
restive otter
sullen nymph
#

That's none of our business from there

tribal sky
feral palm
#

someone could pass me the top.gg API so the user has to vote for the bot

slow dust
jaunty plank
#

var is a bad idea

slow dust
#

how come?

#

im not a js developer btw.. i only learned that to get this vote thing going

jaunty plank
#

var is global

slow dust
#

yeah but var can be assigned over and over

#

const is once

#

no?

jaunty plank
#

for the one callback

#

the next callback it can be used again

slow dust
#

that's what i got from the docs pepepout

jaunty plank
#

let can also be reassigned without being const

slow dust
#

js is weird

#

@ionic abyss so i stand corrected.. use const but try user.fetch

restive otter
#

guys anyone know how i can post the shards on my top.gg page?

#

and also how i can give a role to someone who votes for my bot

slow dust
#

Woo, did u get the skd version working?

jaunty plank
jaunty plank
restive otter
#

ok

slow dust
#

a man of culture too huh

jaunty plank
#

well, also, probaby was a bad idea to deprecate a library while still recommended it in the sites docs

slow dust
#

does perseint change the numbers if its int64? the vote thing sometimes cant find users in the db but they are in the db

jaunty plank
#

in js?

slow dust
#

yeah

jaunty plank
#

parseint doesnt work with discord id's

#

discord id's are too large of a number for js int's

slow dust
#

vote.user returns an int or a string?

jaunty plank
#

so you have to treat them like strings

#

vote.user returns a string.

slow dust
#

well..... i use perseint to make it into ints.. damn i see it now..

#

is there any way to make it into int without changing it up?

#

my bot is in py 😩

#

the db is in int

jaunty plank
#

py does the same thing iirc, but am not 100% sure.

#

treat discord ids as strings i mean

slow dust
#

nah.. py does int32 and int64 automatically

#

if its big like discord id int64

jaunty plank
#

omg, dpy docs got updated a ton

slow dust
#

its updated?? last update was in September

#

when i checked

jaunty plank
#

just the docs updated

hearty lintel
feral palm
#

@hearty lintel sorry for the ping

#

But could you help me?

hearty lintel
#

what's up

feral palm
#

how I do so that a command can be executed when the user has voted for the bot

hearty lintel
#

use the webhooks

#

check pins there's an example of using the webhooks

feral palm
#

not to use discord very

#

discord.js*

hearty lintel
#

the webhooks and your discord library are separate

#
const express = require('express')
const Topgg = require('@top-gg/sdk')

const app = express() // Your express app

const webhook = new Topgg.Webhook('topggauth123')

app.post('/dblwebhook', webhook.middleware(), (req, res) => {
  // req.vote is your vote object e.g
  console.log(req.vote.user) // 121919449996460033
}) // attach the middleware

app.listen(3000) // your port```
feral palm
#

I put that as it is, or should I change something?

hearty lintel
#

req.vote.user is your user id

#

do with that information what you will

feral palm
#

I don't think I'm getting

hearty lintel
feral palm
#

it's okay thank you very much

#

Your top.gg token

what should I put there?

hearty lintel
#

this is not for webhooks

#

look at the bottom of the page

feral palm
hearty lintel
#

under the webhook server category

feral palm
#

oh

feral palm
#

then all I would have to do is create the webhook and what else would I be doing?

hearty lintel
#

opening your webserver to the internet, putting the ip and info into your top.gg panel and hit test

bitter iris
#

how do i create a webhook

hot axle
#

read the docs

woeful mesa
#

How can I find
user.tag
user.username
in

req.vote.user
hot axle
#

fetch it with the discord api

#

or use your lib

woeful mesa
#

I have the full code
But I don’t want to do mention in the message, I just want the user tag

bitter iris
#

@woeful mesa like their tag without the @

woeful mesa
#

I mean like (SOLAY#999) only name

bitter iris
#

what language?

woeful mesa
#

discord.js 👀

bitter iris
#

is it not ${this.username}

woeful mesa
#
setDescription(`❤️ Just vote <@${req.vote.user}>  ❤️\n
            id: ${req.vote.user}
            tag: ${req.vote.tag}
            username: ${req.vote.username}

this my code

bitter iris
#

why am i getting missing server count?

#

Error: Missing Server Count

foggy ore
#

Hi

#

Commands bot designer for discord

hearty lintel
#

@woeful mesa the webhook doesn't provide .tag or .username, use your cache or fetch from the discord api for that info

bitter iris
#

@hearty lintel which?

dapper bobcat
#
const DBL = require('@top-gg/sdk');
const webhook = new DBL.Webhook('topggAPIAuth')

app.post('/dblwebhook', webhook.middleware(), (req,res) => {
       console.log('We have arrived.')
    console.log(req.vote.user)
})

app.listen(<port number>, () => {
  console.log('Listening');
});```

Why doesn't it work? I don't get any errors, the webhook just isn't triggered.
willow spindle
#

did you open that port

dapper bobcat
dapper bobcat
restive otter
#

can some one send a upvote checker in py

jaunty plank
#

pretty sure the docs go over it.

restive otter
#

thx

hearty lintel
#

if you have a firewall allow the port to be passed

dapper bobcat
hearty lintel
#

if you go to the url in your browser does it not respond?

dapper bobcat
#

Yea

tribal sky
#

hey what url should i give in the webhook url field?

hearty lintel
#

what does it say zeedz

hearty lintel
tribal sky
#

oh alr so i have my host server ip but where do i get the port?

hearty lintel
#

what lib are you using?

tribal sky
#

python

hearty lintel
#

should ask you for a port somewhere?

#

or check the docs for the default

tribal sky
#

alr

hearty lintel
tribal sky
tribal sky
hearty lintel
#

should be

#

or you can set the port to something else to make sure

tribal sky
hearty lintel
#

you hit save first right?

tribal sky
#

yep

#

i got this when i hit save

hearty lintel
#

oh

#

like

#

you put your actual server ip right?

tribal sky
#

yes

#

like http://4.5.67.89:5000/dblwebhook

hearty lintel
#

yea

#

uh

#

reload and try again

tribal sky
#

demn i get the same error agn

hearty lintel
#

i don't know much about why you'd be getting errors saving unless the url was invalid

dapper bobcat
#

im gonna have to use a reverse proxy

hearty lintel
#

then your firewall has it blocked

tribal sky
#

hmm ill try askin in support channel then

hearty lintel
#

yeah if it's available a reverse proxy with a domain or something is the way to go

dapper bobcat
#

bc my server lets reverse proxies thru

#

sure sure

rare quiver
#
const client = Discord.Client()

const Topgg = require('@top-gg/sdk')

const api = new Topgg.Api('xyz')

setInterval(() => {
  api.postStats({
    serverCount: client.guilds.cache.size,
  })
}, 1800000)
``` hey so this would go in our main bot file or a ready.js event?
restive otter
#

main bot file

rare quiver
#

okay thank you

minor wedge
#

const app = express() 

const webhook = new Topgg.Webhook('pass')

app.post('/dblwebhook', webhook.middleware(), (req, res) => {
  logChannel = client.channels.cache.get(`790885444794449942`)
  logChannel.send(req.vote.user+" has upvoted on top.gg!")

}) 
app.listen(3000)
#

This isn't working for me

slim osprey
#

ok so I was wondering I have a bot and I was wanting to use the top.gg api thing so I can see when somebody votes and thank them in a dedicated channel, how do I set this up in discord.py

#

I dont really use JS

#

node.js*

restive otter
#

how do i check if a user has voted for a particular bot?

#

ping me while answering.

willow spindle
#

you can't

restive otter
#

How can i do when i search a bot name and bot shows me bot info (discord.js)

bitter iris
hearty lintel
hearty lintel
hearty lintel
hearty lintel
bitter iris
#

alrighty ty

#

regen my token to see if maybe that might have been the issue

hearty lintel
#

the error seems to be library generated, not entirely sure why, i'll take a look later today

bitter iris
#

okay ty

pastel rune
#
(node:5540) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 32)
(node:5540) UnhandledPromiseRejectionWarning: Error: 404 Not Found
    at IncomingMessage.<anonymous> (root\Projects\ACNHBot\src\node_modules\dblapi.js\src\index.js:118:25)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
#

anyone else get this?

#

for the dblapi

restive otter
#

Use the new library for js

#

pins

pastel rune
#

ty

rare quiver
#
const Topgg = require('@top-gg/sdk')

const api = new Topgg.Api('xyz')

setInterval(() => {
  api.postStats({
    serverCount: client.guilds.cache.size,
  })
}, 1800000)
``` i have this in my main bot file i.e index.js, no errors but still shows N/A on the bot page
rare quiver
#

@jolly moth could ya help?

restive otter
#

Did you wait 30 min

rare quiver
#

yes

restive otter
#

it works for me

rare quiver
#

hmm

golden adder
#

But only for your own bots. Can't check for bots that aren't yours.

hearty lintel
#

Would recommend using a webhook and storing however if you don't need to event a user voting the endpoint can be called when checking

fervent kite
#

hello i dont understanw where i can find the dbl_weebhook_token and the dbl_webhook_port

#

etc..

hearty lintel
#

webhook port is the port to run your webhook server on

fervent kite
#

where ?

hearty lintel
#

your webhook auth/token is set in the webhook section of your edit bot

#

its up to you

fervent kite
#

in discord ?

hearty lintel
#

no

#

its on your host

fervent kite
#

oh..

#

after the :

#

<ip>:<port>

#

i take the port here ?

hearty lintel
#

i dont think that's how it works, if you don't have a dedicated ip for your hosting you're probably not gonna be able to use the webhook

#

i would contact your hoster to see if it's possible to port forward a specific port to the open internet

fervent kite
#

ok

#

It is Axial Host

hearty lintel
#

ask them

fervent kite
#

ok

#

Because I would like to make sure that as soon as someone votes for my bot then my bot thanks them

hearty lintel
#

yeah you need an open webserver with the webhook and top.gg posts to that webhook

#

if you're unable to open a port then you can't receive realtime events

fervent kite
#

okey i ask yo my host

hot axle
#

@rare quiver setInterval doesn't execute the function at first

#

so you have to wait 30 minutes

rare quiver
#

I did

#

Wait for 30 mins

hot axle
#

o

rare quiver
#

But still same thing

hot axle
#

panik

rare quiver
#

Lul

hearty lintel
#

press refresh data

golden adder
rare quiver
#

okay

hearty lintel
#

some people seem to be having trouble using the built-in function let me know if that works

#

the autoposter library also insta posts

#

so u can check right away after like a min for cache

rare quiver
#

cool

fervent kite
hearty lintel
#

hm

#

do u have anything else running on that port?

fervent kite
#

that is to say

hearty lintel
#

try setting the webhook port to that

fervent kite
#

okk

dawn solar
#

Hi

#

I have an issue with the top.gg website. I am setting up the DBL Vote bot and I need to link it with my URL and token but when I click the link it just has a white screen for ages then I got a cloudfare error with the host

fervent kite
#

just what is the dbl_weebhook_url ?

rare quiver
#

@hearty lintel wait so I do remove the top-gg/SDK one or keep that one as well?

hearty lintel
#

the topgg-autoposter relies on the @top-gg/sdk in its package so you don't have to have it independently installed no

rare quiver
#

ah

golden adder
#

@dawn solar have you read the docs in the pins?

fervent kite
#

?

#

okk

dawn solar
#

It doesn't really help me

hearty lintel
#

try clearing cache

dawn solar
#

I am not coding a bot

hearty lintel
#

thats a site issue not api

rare quiver
#

also do I have to replace the topggtoken in the auto poster with something or leave it as is?

dawn solar
#

Just using one

golden adder
#

@dawn solar what are you trying to do?

dawn solar
#

Support told me to go to API

#

And here i am

#

I have an issue with the top.gg website. I am setting up the DBL Vote bot and I need to link it with my URL and token but when I click the link it just has a white screen for ages then I got a cloudfare error with the host

hearty lintel
fervent kite
hearty lintel
#

that doesnt work

fervent kite
#

hum..

hearty lintel
#

it's not how the webhooks work

dawn solar
#

Yes thats the problem

#

But I need to go to it to set the bot up apparently

#

DBL Vote

hearty lintel
#

@dawn solar what link are you going to? that /bot/12123123/webhooks?

dawn solar
#

Something like that yes

golden adder
#

@dawn solar just to clarify, you're trying to get voting data for a bot that isn't yours?

dawn solar
hearty lintel
#

go back to support, sorry for janking you arround

jaunty plank
#

dbl vote isnt a top.gg bot, its made by a third party

#

#support wont be able to help you with it either.

hearty lintel
#

he's having cloudflare issues accessing the site

#

from what im gathering

golden adder
#

It doesn't look like that bot is approved though...

hearty lintel
#

that we just went over getting

dawn solar
#

But yes it was an issue with the host top.gg

jaunty plank
#

The vote bot that you can use to setup webhooks (which isnt a dbl official bot) only works for servers
#support

golden adder
#

@dawn solar The DBL Vote bot is for server voting. Not bots. For bots, you have to wait until it's approved, then use the API in the pins here in your bot's index file.

#

That's why we were confused.

dawn solar
#

I am going to wait until the bot is approved and then try and connect the bot again

brisk mason
#

@Frosty#6992

jaunty plank
#

dbl vote doesnt work with bots @dawn solar

#

atleast as far as we have been told

dawn solar
#

Oh it does

dapper copper
#

Disguised I would ask in their support server

dawn solar
#

As it has been used on another server I moderate

dapper copper
#

you have a better chance of getting help there

dawn solar
#

They told me to come here

dapper copper
#

Oh?

jaunty plank
#

lol

dawn solar
#

Not the bot

jaunty plank
#

well, we will send you there

dapper copper
#

right

#

Lemme try and help you

dawn solar
dapper copper
#

oh wait

dawn solar
#

Yes that is exactly what the website is supposed to look like

dapper copper
#

your bot isnt approved yet

#

is it

dawn solar
#

I dont think so

dapper copper
#

Yea

#

wait until its been approved and then it should work

dawn solar
#

Ok thank you very much. I will try that

dapper copper
#

No problem

#

Afaik you dont actually get an api get until you are approved so technically you cant receive votes until then

#

so best bet it wait until its public anyway

dawn solar
#

No I know. Was just trying to get everything ready

dapper copper
#

That's fair

restive otter
#

nvm fixed

hearty lintel
#

what was the issue?

#

@restive otter

restive otter
#

i chose wrong token

#

the token on docs is like example token

hearty lintel
#

oh

#

got it

restive otter
flint olive
#

Hey, so my bot is currently in 42 servers. Why does it not display that on the website?

#

How do I get the api link?

hearty lintel
#

what language do you use?

flint olive
#

Python

hearty lintel
hollow meadow
#

Guys my bot reaction role is offline?? How do I fix that

hearty lintel
#

go to its support server

viral solar
zealous crown
#

Hey, when I type https://top.gg/api/bots/155149108183695360 , I can get data from a bot (like Dyno in the example) but when I request it in my code I need a token? I'm just curious if there is an alternative to getting bot data without one? Why restrict info that is public? I'm kind of new so there's probably a reason but I don't get it.

hearty lintel
#

you need an api token to access the api

zealous crown
#

and the only way to get a token is through having a verified bot?

hearty lintel
#

a bot added to the platform yeah, i've never really considered the need to use the api without a bot, you should talk with veld and express the idea of having a way of getting a token without needing a bot

rapid kettle
#

i don't see why you'd need to, tho

hearty lintel
#

i mean you shouldn't really need a bot to request bot info ig

rapid kettle
#

eeh

zealous crown
#

I have a bot but it's not verified. I have a command that you can get a user's info and, if it's a bot, it'll spit back the bot info too but apparently the publicly available info needs a token 0_o seems kinda weird to me

hearty lintel
#

add the bot to the site

#

once the bot is added you get a token

rapid kettle
#

i think it is

hearty lintel
#

it's not

rapid kettle
#

oh right

hearty lintel
zealous crown
#

I applied but I guess I have to wait weeks or maybe months to get verified? ASshrug02 sad life for me

hearty lintel
#

yeah p much

rapid kettle
#

its like 1 week

zealous crown
#

oh 😮

hearty lintel
#

if u haven't dm'd veld I can i'm quite curious

rapid kettle
#

ill contact veld via chat.veld.dev demoSmart

hearty lintel
#

kek

bitter iris
#

i get no errors

#

but it also doesn't update my server count

hearty lintel
#

did you hit refresh data?

#

and wait a few minutes for cache

bitter iris
#

not yet

bitter iris
hearty lintel
#

whats your code now?

#

@bitter iris the bot you're trying to post to is added right?

#

cuz looking at your page your bot has posted stats

bitter iris
#

those are old ones

#

prior to it not working

#

yeah Not Ryan

#

it was working before

hearty lintel
bitter iris
#

those are not up to date

#

thats the last count before it stop updating

hearty lintel
#

whats your code now?

bitter iris
#

91

hearty lintel
#

your code

bitter iris
#

oh

#

one sec

#

const Discord = require('discord.js')
const Client = new Discord.Client()

const AutoPoster = require('topgg-autoposter')

const ap = AutoPoster('token', Client)

ap.on('posted', () => {
console.log('Posted stats to top.gg')
})

#

am trying the sdk

#

it's working

#

i must have without thinking did a capitol c on the client.guilds.cache.size

flint olive
#
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)
        self.update_stats.start()

    def cog_unload(self):
        self.update_stats.cancel()

    @tasks.loop(minutes=30)
    async def update_stats(self):

        await self.bot.wait_until_ready()
        try:
            server_count = len(self.bot.guilds)
            await self.dblpy.post_guild_count(server_count)
            print('Posted server count ({})'.format(server_count))
        except Exception as e:
            print('Failed to post server count\n{}: {}'.format(type(e).__name__, e))


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

hey, I have been trying to set up my bot api, and it still is not working. my code is above

rain heart
#

What exactly is not working?

#

what errors are you getting?

agile quail
#

Has something changed? My bot isn't able to send updates to the api for server count, etx

rain heart
#

make sure your token is valid

#

regenerate it and see if it works then

flint olive
#

This is my first time

#

i got my bot verified today

rain heart
#

Yeah but what exactly is not working

flint olive
#

i have no idea what i am doing

#

just scrap everything

rain heart
#

pepoS Bad idea

#

read the documentation properly

flint olive
#

what do i do first

flint olive
#

but for the json file all it does is show params

#

i have no idea what to do w/ it

rain heart
#

what json file?

flint olive
#

that

rain heart
#

That is not needed if you don't make http requests to the api

#

you're using a wrapper already

flint olive
#

k so what do i do?

rain heart
#

I still have no idea what is not working, i am unable to help

flint olive
#

the error command just says that there is no such command as update_stats

#

hello?

#
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, autopost=True) # Autopost will post your guild count every 30 minutes

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

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

bruh why don't it work

#

and yeh i pujt the top.gg token

smoky marten
#

@eager anchor here

eager anchor
#

?

main nexus
#

How can I use the api at my bot Continue

finite moat
#

how do i make a command where a user votes and they'll get cash in return?

smoky marten
#

this is from the official

#
dbl.getVotes().then(votes => {
    if (votes.find(vote => vote.id == "95579865788456960")) console.log("Tonkku has voted!!!")
});
finite moat
#

ok thanks my bad

bold wave
#

Yaya I have a working music bot

#

With filters that can crash my bot

restive otter
#

ok

bold wave
#

😭

#

If I put all the filters it crash

restive otter
sullen viper
#

I tried using dbl.getVotes for voting rewards, but it gets all the votes in the bot lifetime. How can I make it only get the votes that haven't expired from the last 12 hours?

willow spindle
#

there is no way to get last votes

#

you can use vote webhooks and store this data in your db

sullen viper
#

Ok, thanks

#

What should I put in as my webhook authentication?

#

Oh never mind, I found out it is in the top.gg dashboard settings

sullen viper
#
Error: Cannot find module '/home/account/folder/node_modules/@top-gg/sdk/dist/index.js'. Please verify that the package.json has a valid "main" entry
``` I ran `npm install @top-gg/sdk`
main prairie
#

Hey, so I have this code (copy pasted from the top.gg documentation, and changed to make sure all my variable names are correct):

const DBL = require("dblapi.js");
const dblPoster = new DBL(topggtoken, client);
// mention in support server (staff channel)
dblPoster.on('posted', () => {
    client.channels.cache.get('791605633480261652').send(`Posted bot info: ${client.guilds.cache.size} guilds`)
    console.log('Server count posted!');
})

//top.gg vote event
const dblVote = new DBL(topggtoken, { webhookPort: 5000, webhookAuth: 'password' });

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

dblVote.webhook.on('vote', vote => {
    client.events.get('vote').execute(vote.user, client)
    client.channels.cache.get('791605633480261652').send(`User with ID ${vote.user} just voted!`)
    console.log(`User with ID ${vote.user} just voted!`);
});```

The autoposter works fine (just checked the website, it's all updated fine), however the vote didn't work. When I voted, nothing happened, even tho the webhook was ready.

Am I doing anything wrong?
sullen viper
#

Are there any errors?

main prairie
#

nothing at all, doesn't even trigger the vote event

#

when I log the bot on, I get the ready message webhook running at ... but when I voted nothing happened

#

okay so I just ran a few more tests, looks like my vote got registered, still can't figure out why the event won't trigger

sullen viper
#

Have you set up your webhook on the top.gg dashboard

main prairie
#

ah that might be the issue, lemme check

#

that was the issue lol, thanks abdo

sullen viper
#

Welcome

main prairie
#

altho how does the test work? Does it trigger a fake vote so I can test it, or do I need other code to detect it's working?

fervent kite
#

i make what here

sullen viper
fervent kite
#

the webhookpath

sullen viper
#

What path do you want the data to be sent to

#

Yeah @main prairie It does.

main prairie
#

okay ty... means something still isn't set up right then 😂

sullen viper
#

I'm facing the same issue

main prairie
#

I thought you were getting errors tho? I'm getting nothing at all

sullen viper
#

I'm not

main prairie
#

ah okay

sullen viper
#

Maybe we could see what happens if I try voting for yours

main prairie
#

http://0.0.0.0:5000/dblwebhook this is what I should put in as the webhook on the dashboard right?

sullen viper
#

Maybe the test doens't work

#

I'm not sure.

main prairie
#

sure, and I can test if your ID has voted afterwards

sullen viper
#

Alright, dm me your top.gg vote link

fervent kite
#

I just want when someone votes for my bot to thank them

main prairie
#

hey @gaunt steeple @dense basalt I hope the ping isn't an issue, the FAQ says it should be okay to ping a couple of mods for help?

I'm just having some trouble setting up the top.gg vote webhook, I wondered if you could help? I don't know what to put into the webhook URL field in my bot dashboard for it to work. Putting http://0.0.0.0:5000/dblwebhook (the place it says the webhook is running at), doesn't seem to work, and I can't see what else I could add

#

please can you ping me if you reply 🙂

shy vortex
#

and I mean public ip

main prairie
#

ohhhhh okay thanks

sullen viper
#

Not working for me.

wheat copper
#

Why do i get data logged when test using reqbin but when test webhook using 'test' button i get nothing?? is it a top.gg error? everything is the same between top.gg and reqbin but top.gg doesnt work

kindred swift
#
import dbl
import discord
from discord.ext import commands


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

    def __init__(self, bot):
        self.bot = bot
        self.token = 'dbl_token' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, 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(bot):
    bot.add_cog(TopGG(bot))

I don't understand the code, where does it post the server count?

frozen maple
#

That shouldn't actually be there

rare quiver
main prairie
#

Hey, I've been having trouble setting up vote rewards for my bot.
I have this code:

const dblVote = new DBL(topggtoken, { webhookPort: 5000, webhookAuth: topggpassword });

dblVote.webhook.on('ready', hook => {
    console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dblVote.webhook.on('vote', vote => {
    console.log(`User with ID ${vote.user} just voted!`);
    client.events.get('vote').execute(vote.user, client)
    client.channels.cache.get('791605633480261652').send(`User with ID ${vote.user} just voted!`)
});```
And on the top.gg dashboard I've put the webhook URL as `http://my-server-IPv6-address:5000/dblwebhook`

However when I run a test from the dashboard, nothing happens.

Of course topggtoken, password and my-server-IPv6-address are the actual token, password and address
#

could someone ping me if they have any info on what I'm doing wrong please?

restive otter
#

use the new library for js

main prairie
#

which one is that?

restive otter
#

pins

main prairie
#

ahhh okay I'll try that

restive otter
#

const cheweyBotAnalyticsAPI=require("discord-bot-analytics")
const customAnalytics = new cheweyBotAnalyticsAPI("YOUR API TOKEN", client)

Can Anyone tell me what this is how do i onnect discord bot to website

versed storm
merry stump
#

What should be the check URL for top.gg

hearty lintel
#

wdym

woeful mesa
#

Hi
I apologize for the question
But when i run dblwebhook + sharding
I have this error

Uncaught Error: listen EADDRINUSE: address already in use :::3000

Is there exposure between them or is the problem from my code?

hearty lintel
#

something else is already running on that port

#

so you could change the port, or if whatever is taking up that port is something you control you can just add the webhook onto it

woeful mesa
hearty lintel
#

the error literally means something else is using that port

#

it could be anything on your machine

hidden stag
#

Stupid question, but what is the base url for the api calls?

hearty lintel
hidden stag
#

thnx

hearty lintel
#

np

woeful mesa
#

Maybe, I'll try to change the port, thanks

hearty lintel
#

👍

woeful mesa
#

Which is better
@top-gg/sdk
or
Top.gg AutoPoster

Because I see that they all perform the same thing

thorny elk
#

Naber lan

#

!yardım

hearty lintel
#

the auto poster uses the sdk to post stats

#

the sdk has api methods and webhooks

main prairie
#

hey, I've been trying all day, still no success, to set up a topgg vote event for my bot (to give rewards).
I've tried @waxen widget-gg/sdk and the older version, I've tried my server's IPv6 and IPv$ addresses as the webhookURL etc etc etc and still get nothing when I test...
This is the code I got from someone (It worked for them):

const http = require('http');
const app = require('express')();
const server = http.createServer(app);
const dbl = new DBL(topggtoken, { webhookAuth: 'topggauth123', webhookServer: server });

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running with path ${JSON.stringify(hook)}`);
});
dbl.webhook.on('vote', vote => {
  console.log(vote.user)
});

app.get('/', (req, res) => {
  // ...
});

server.listen(5000, () => {
  console.log('Listening');
});```
I've changed all the topggtoken and passwords to be correct, when I run that on my server I get the console saying it's listening, however when I click `test` on the topgg dashboard, nothing.

I assume using sdk would be better, but atm I just want something that works lol
bitter iris
main prairie
#

shoot sorry for pinging top.... didn't mean to do that

woeful mesa
hearty lintel
jaunty plank
main prairie
#

yes sorry, I did do that

jaunty plank
main prairie
#

according to the server I have no firewalls no

jaunty plank
#

is the server hosted at a company or at home?

main prairie
#

it's vultr (VPS)

hearty lintel
main prairie
bitter iris
bitter iris
#

like on the site

#

its showing the correct server count

#

but i noticed this in my console

#

when i went to check

jaunty plank
#

actually the 5000, as in the express app

#

not sure why it logs the port as 0 🤷‍♂️

main prairie
#

hmmm any idea where I'd go to do that?

#

I asked the same question to the guy I pasted the code from, he said he got it too, but it worked for him lol

jaunty plank
#

most hosts have all ports open by default

#

never used vultr so im not sure where it would be

#

somewhere on the webpanel.

main prairie
#

oops wrong link

jaunty plank
#

check the ipv4 settings

main prairie
#

what would I be looking for? I'd prefer not to send screens of that lol

jaunty plank
#

port forward, or anything that mentions ports.

#

might be called rules

main prairie
#

nothing... only for support and nothing for rules (using control F)

jaunty plank
#

what about rule/rules

#

inbound/outbound

main prairie
#

nothing for either of those 4

jaunty plank
#

Do you have iptables or ufw installed?

hearty lintel
#

under that firewall picker what does it say?

main prairie
#

I don't really know what they are... I'm pretty sure I don't, but I'd have to look if you can tell me where too

hearty lintel
#

oh

#

so it's a linux vps?

main prairie
#

I probably have to buy firewalls

#

ubuntu 18.04 x64, should be linux (I don't know a lot about all this stuff in case you haven't guessed lol)

hearty lintel
#

alright if you do ufw enable does it work?

main prairie
#

it tells me Command may disrupt existing ssh connections. Proceed with operation (y|n)?

hearty lintel
#

when you do y you'll have to do ufw allow ssh

#

then after that you can do ufw allow [port]

main prairie
#

okay says rule added. Should I try running the code again now?

hearty lintel
#

yeah and see if the web server can be accessed

main prairie
#

same as before, but when I test from the topgg dashboard, nothing happens again

hearty lintel
#

you need to set the port

main prairie
#
const http = require('http');
const app = require('express')();
const server = http.createServer(app);
const dbl = new DBL(topggtoken, { webhookAuth: 'topggauth123', webhookServer: server });

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running with path ${JSON.stringify(hook)}`);
});
dbl.webhook.on('vote', vote => {
  console.log(vote.user)
});

app.get('/', (req, res) => {
  // ...
});

server.listen(5000, () => {
  console.log('Listening');
});```

This is the code. Where would I be able to set the port?
hearty lintel
#

just for easier support and it's updated, you should use the new library, it's pinned, it uses an express middleware instead so you don't have to mess with this other stuff

jaunty plank
#

the port is set to 5000 properly from what i can tell.

main prairie
#

I did try that, but when it failed I found someone who'd got working code, and that's the code (only changed to add my pass and token).

So should I try changing that to the pinned code?

hearty lintel
#

it'll also let you easily debug open ports without having to hit test

#

yeah it looks like you're already using express

#

this probably won't fix the issue but will let us figure it out more easily

main prairie
#
const Topgg = require('@top-gg/sdk')

const app = express() // Your express app

const webhook = new Topgg.Webhook('topggauth123')

app.post('/dblwebhook', webhook.middleware(), (req, res) => {
  // req.vote is your vote object e.g
  console.log(req.vote.user) // 121919449996460033
}) // attach the middleware

app.listen(5000) // your port```

Is it normal I never have to use my token in this?
#

also my password is topggauth123 (I'll change it once I figure all this out)

hearty lintel
#

you set the auth inside of the webhook settingd

jaunty plank
#

the token is only used for making api requests, not receiving webhooks.

main prairie
#

👌

hearty lintel
#

but once that's working try to go to the serverip:port on your browser

#

if it's working it'll say Cannot GET /

#

you did do ufw allow 5000 right?

main prairie
#

yea

#

it works (the console.log('ready') triggered), but I got nothing else, is that normal?

hearty lintel
#

yea the new webhook doesn't log when it starts

main prairie
#

oh yea I should test it lol

hearty lintel
#

you can make it by using a callback in the app.listen

#

but check for that Cannot GET thing

main prairie
#

nothing when I test... wdym by callback? And where should I see the cannot GET?

hearty lintel
main prairie
#

"site can't be reached"

hearty lintel
#

hm

#

if you do curl http://localhost:5000 on the machine does it work?

main prairie
#

I tried serverIP:port and serverIP:port/dblwebhook

#

failed to connect, connection refused

#

that doesn't look good...

jaunty plank
#

your not using the ip 0.0.0.0 are you?

hearty lintel
#

do it on the vps

main prairie
hearty lintel
#

yeah so it's a firewall issue

main prairie
#

It works better when I keep the app on lol

main prairie
hearty lintel
#

you're sure the IP you're entering is correct?

main prairie
#

It's copy pasted, lemme check again

#

ffs... I somehow added a c3 on the end 😭 , it works now.... sorry for all the time spent, I really appreciate it tho

hearty lintel
#

aa a

#

it's all good at least it works lol

main prairie
#

thank you so much!

hearty lintel
#

👍

flint olive
#

How do I set up the API?

hardy umbra
#

@flint olive what operating system and language?

flint olive
#

python

#

so a venv

#

@hardy umbra

hardy umbra
#

um

#

python is ew

#

so i can't help you

restive otter
#

hello
how to make
votes rewards
i need to use this?

#

@pale fulcrum

pale fulcrum
#

I’m not familiar with the api

restive otter
#

bruuh

#

help pls

jaunty plank
#

You can use the webhooks, the multiplier is just a weekend multiplier.

#

Some of the libraries have built in webhook support if you want to use those.

hot axle
#

use the webhooks

#

read the docs

#

yea

#

the url where you're hosting the webhook server

sullen viper
#

Bro, one message

rain heart
#

self.bot and self.token are both required

#

Oh wow 4 hours ago, nevermind Kek

uncut kelp
hot axle
#

i get it every now and then for some reason

#

but retrying normally works for me

restive otter
#

I'm having issues with top.gg api for 3 weeks and none of the top.gg moderators or staff giving a fuck about it

latent mirage
#

@restive otter bro pipe down, you are acting like you pay a monthly subscription or something

restive otter
#

so I have to pay to get help??

rapid kettle
#

no

#

tell us your bloody issue

restive otter
#

its not a thing you can solve

#

and I already did many times

sullen nymph
#

"no one helps me"
"well, tell us what the issue is"
"you can't solve it"

restive otter
#

guess why

sullen nymph
#

Also, moderators are not obligated to provide assistance with the API directly

restive otter
#

everyone trying to be a smartass when it comes to helping

sullen nymph
#

Stop feeling like someone owes you something and help us help you this time

restive otter
#

I explained my issue like 2 or 3 times here

rapid kettle
#

explain it again

sullen nymph
#

I can't say for sure where from and why exactly they are being sent, but you are free to just ignore those with 405s

#

How often are they sent?

restive otter
#

I click "Test webhook"

#

and it makes a get request

#

instead of a post

#

server vote

sullen nymph
#

🤔 interesting

restive otter
#

it was working fine all the time it just suddenly started making get requests

#

^ requests sent via test webhook button

sullen nymph
#

@mighty shuttle Would this happen to be an intended change?

mighty shuttle
#

Uh

sullen nymph
#

From the looks of it, I have high doubts it's supposed to send GET requests

mighty shuttle
#

The webhook sending a get request?

#

That doesn't sound right

#

I'll notify the dev team about it

restive otter
#

well I can retry again if you want

sullen nymph
#

thanks qt

restive otter
#

this is an old screenshot

hearty lintel
#

@restive otter open your port to the internet then add your serverip:port/dblwebhook add your auth and save then test

#

are you using a vps?

#

what firewall do you use

#

i've no clue if or how to open a port via heroku

#

oh ok so there's a PORT environmental variable that you can use

#

but if it changes you can't do webhooks

#

please stop spamming

#

there's no need to split your messages

#

set your port to one of those open ports then put the http://[server.ip]:[port]/dblwebhook into your webhook settings

#

it's the same thing

shrewd river
#

server.ip

hearty lintel
#

there's just a . in your ip

#

you're not actually putting that you're replacing it with your host's ip

#

yes delete that tho

#

and then put what you put in the auth into the authorization section

#

yeah still put it in the section

#

and i'd suggest changing it

#

it's already there

#

you put it in

#

you hit save first right?

#

you changed the port in the code too right?

#

no you use neither

#

you have to use the port supplied by heroku

#

google how heroku port forwarding works

#

then you need to open your firewall still

#

then you're probably not ready to do webhooks

#

i recommend doing research on how web servers work and how firewalls work

prisma path
#

how to specify bot libraries

hot axle
#

that's being deprecated, so don't bother

fickle basalt
#

how to send guild count data to top.gg?

jaunty plank
exotic thorn
#

it's the api key right?

jaunty plank
#

Yep

exotic thorn
#

Thank you thanks

fickle basalt
#

Authorization error but which headers should I send

hot axle
#

you probably need an Authorization header with your DBL token

fickle basalt
#

Okey, I'll try

restive otter
flint olive
#
class TopGG(commands.Cog):

    def __init__(self, bot):
        self.bot = bot
        self.token = 'my token'
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)  # Autopost will post your guild count every 30 minutes

    @commands.Cog.listener()
    async def on_guild_post(self):
        print("Server count posted successfully")


def setup(bot):
    bot.add_cog(TopGG(bot))```
My API is not working. Do i need a seperate file for my cog? because this is just in my main file. There is no error code it just doesn't work
acoustic dove
#

you dont use setup if its in the same file

flint olive
#

so i delete that?

acoustic dove
#

do bot.add_cog(TopGG(bot)) on_ready i think

flint olive
#

instead of ```def setup(bot):
bot.add_cog(TopGG(bot))

acoustic dove
#

why dont you try it

flint olive
#

doesn't even start

#

@acoustic dove

steel bolt
#

What is API ?

#

Discord API ?

slow fulcrum
#

Yeees

novel laurel
#

can I send member count to top.gg?

#

or is that just server count

rain heart
#

Server count

restive otter
#

im having error 404 on bot

hot axle
#

dblapi.js is deprecated

#

use @top-gg/sdk instead

restive otter
hot axle
#

don't just say "pls fix"

restive otter
#

??

hot axle
#

and the message explains itself

restive otter
#

ohhh you are so smart wow

hot axle
#

move the bot role on the hierarchy list

restive otter
#

go edit your server

#

you'll see the same

rapid kettle
#

bro can you not be a dick for like once

odd valley
#

Fr

restive otter
#

I can read the error and this error occurs whenever I refresh the page

hot axle
#

move the dsl bot role

restive otter
#

it's already over every role

odd valley
#

And if i asking for a question, at least behave

hot axle
#

probably refresh the page or something

rapid kettle
#

then we literally cannot help?

restive otter
#

refresh doesn't fix

rapid kettle
#

it'll be an issue on their side?

hot axle
#

this channel is for the top.gg api

white trellis
#
    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        print(data)
``` i cant seem to get this event to trigger
#

can anyone help me?

rain heart
#

You need to use the webhook options too

#

in order to receive vote events

#

@white trellis

white trellis
rain heart
white trellis
#

i run my bot on heroku, so does that mean i would need to create a seperate webapp tp listen for the webhooks?

rain heart
#

You should be able to do that on heroku aswell iirc, but no clue how

white trellis
#

this might be a stupid question but how come i dont have to set up my bot as a webapp but i need to to receive webhooks

hot axle
#

you could make the webhook and bot on the same app

#

use worker for the bot and web for the server

#

either that, or just make two separate apps

white trellis
#

if i make a web and worker on the same app then when the web sleeps the worker sleeps too

#

im also just new to webapps

cyan wyvern
rain heart
#

That is the path of your webhook for voting

#

for the voting events

#

for example this would be http://yourpublicip.com:port/dblwebhook

cyan wyvern
rain heart
#

Yes

#

Does not mean to just put in /dblwebhook

#

you need your server ip

#

for example something you could enter would be http://yourserverip:5000/dblwebhook

cyan wyvern
#

ok great

#

thank for your help

white trellis
#

do i need to provide a port?

rain heart
#

Yes

#

You cannot use ports that are used already

white trellis
#

ty

worn silo
#

im still new to coding sorta

rain heart
worn silo
#

i understand some stuff

#

but i dont understand what i have to do

#

waiiiiiiiiit

#

never mind

fallen crescent
#

Hello, I'm using discordjs library, and my bot just got verified by top.gg, and I was wondering how I could handle votes.
I use this code, but it doesn't seem to work : ```js
const app = express();
const Topgg = require('@top-gg/sdk');
const PORT = 8080;
const topgg = new Topgg.Webhook('uneron-auth-777')
app.get('/', (req, res) => {
res.sendFile(path.resolve('test.html'))
})

app.post('/topggwebhook', topgg.middleware(), (req, res) => {
console.log(bot.users.cache.get(req.vote.user).tag + 'just voted')
bot.users.cache.get(req.vote.user).send("Hey ! You just voted for UNERON !").catch(e => {})
})
app.listen(PORT, () => {
console.log('Online on port : ' + PORT)
});

mellow matrix
#

How can make a vote log

wanton rover
#

کس ننتون

stable forum
#

!play papa h

rare quiver
#

hey my bot got verified and i am not good with webhooks so what do i have to replace the password and webhookserver name with exactly? and what to do on the website

const DBL = require('dblapi.js');
const express = require('express');
const http = require('http');

const app = express();
const server = http.createServer(app);
const dbl = new DBL(xyz, { webhookAuth: 'password', webhookServer: server });

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

app.get('/', (req, res) => {
  // ...
});

server.listen(4000, () => {
  console.log('Listening to port.');
});