#topgg-api

1 messages ยท Page 71 of 1

austere pumice
#

me no understand no still

vapid cape
#
  1. install dbl's api for your language
  2. go to top.gg
  3. click "edit" on your bot
  4. scroll down to webhooks
  5. in "url", put your bot's address
    5a. if your bot is in a vps, put your vps's ip address (YOUR.VPS.IP.ADDRESS:PORT/dblwebhook)
    5b. if your bot is in glitch/heroku, put your project's address (YOURPROJECTNAME.glitch.me/dblwebhook or YOURPROJECTNAME.herokuapp.com/dblwebhook)
  6. in "authorization", create a password of your choice
  7. in your code, use the dblapi library you installed in step 1, and put your port, dbl token and the password you created in step 6
    7a. if your bot is in a vps, put the same port you put in step 5a
    7b. if your bot is in glitch/heroku, put process.env.PORT as your port
austere pumice
#

bots address?

vapid cape
#

yes, the address of the machine/computer where your bot program is running

austere pumice
#

ip?

vapid cape
#

check 5a and 5b

austere pumice
#

im running it on my computer

vapid cape
#

then its YOUR.COMPUTER.IP.ADDRESS:PORT/dblwebhook

#

and you need to make sure those ports are forwarded and not blocked

austere pumice
#

my router doesn't forward, it just doesn't work for no reason

vapid cape
#

port 80 is reserved in most systems

#

try port 3000 or port 5000

#

thats what most node.js apps do

austere pumice
vapid cape
#

that website doesnt really work for checking ports, because they will show as closed if not being used

#

you need to setup everything and then test in top.gg

austere pumice
#

so what do I use

#

ok

#

public or ipv4 to put?

vapid cape
#

public

austere pumice
#

so like xx.xx.xxx.xxx:2913/dblwebhook

vapid cape
#

yes

austere pumice
#

ok

#

epic nothing happened

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

    def __init__(self, bot):
        print('TopGG Cog')
        self.bot = bot
        self.token = dbltoken
        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_dbl_vote(self, data):
        print(data)

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

whats the port your dblpy is using?

austere pumice
#

how do I see/set that

#

oh

#

it's 3431

vapid cape
#

self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)

austere pumice
#

smol brain moment from me

#

and it did nothing

vapid cape
austere pumice
#

my ipv4 because that's only thing it lets me put

vapid cape
#

your local ip right? like 192.168.x.x

austere pumice
#

yeah

vapid cape
#

ok, whats your full code now?

#

and your webhook settings on top.gg?

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

    def __init__(self, bot):
        print('TopGG Cog')
        self.bot = bot
        self.token = dbltoken
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth=webhookauth, webhook_port=3431) # Autopost will post your guild count every 30 minutes

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

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

authorization = webhookauth?

austere pumice
#

how do I do that

vapid cape
#

im just asking to make sure, if your authorization in top.gg is the same as your webhookauth in your code

austere pumice
#

oh

vapid cape
#

no, i mean if the webhookauth is the same as the authorization

#

they have to be the same thing

#

webhookauth = authorization in top.gg

austere pumice
#

then we got a problem

#

Idk what webhookauth is

vapid cape
#

the same as authorization

austere pumice
#

how do I get that

#

bc I just put a random phrase into authorization

vapid cape
#
webhookauth = "blablabla123"```

in top.gg
authorization:
blablabla123```

austere pumice
#

oh

#

ok good, no need for more bs

#

then what is the problem

vapid cape
#

then idk what else

#

try making a simple http server

#

to test with your browser

#

im not a python user so idk, but look into creating a simple http server on a random port to listen to / and print anything that comes through it, then open your browser and navigate to 127.0.0.1:PORT

#

just to test if the server is working

austere pumice
#

idk anything about http

sullen nymph
#

Was there a moment where you made sure the port is open and firewall isn't blocking anything

vapid cape
#

oh yeah, also check the windows firewall (assuming you're on windows)

austere pumice
#

how do I check if the port is open @sullen nymph

sullen nymph
#

Router settings

austere pumice
#

where

#

also I did port forward it on the router

sullen nymph
#

Then make sure your firewall isn't blocking anything

austere pumice
#

I turned it off

sullen nymph
#

What was the full URL you used on top.gg

austere pumice
#

wdym

sullen nymph
#

Oh fucking hell

#

Mind sending me the line where you create an instance of DBLClient

austere pumice
#

self.dblpy?

sullen nymph
#

Yes

austere pumice
#
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth=webhookauth, webhook_port=3431, autopost=True) # Autopost will post your guild count every 30 minutes
sullen nymph
#

So

#

Your webhook_path is /dblwebhook but in the URL you put /webhook

austere pumice
#

typo

#

it's dblwebhook on the website

sullen nymph
#

Are Authorization keys the samw in your code and on the website
Are you sure the webhook is actually running

austere pumice
#

yes first part

#

second part idk

#

it prints

#

what could prevent my router from port forwarding @sullen nymph

sullen nymph
#

Firewall which is off

#

Improper port forwarding but God knows how you manage to fuck that up

green mantle
#

Tbf BT routers sometimes don't even bother opening the port even if you port forward in my experience

austere pumice
#

bt?

#

@green mantle how do you fix that issue

#

@sullen nymph NetBIOS over Tcpip. . . . . . . . : Enabled

#

DHCP Enabled. . . . . . . . . . . : No don't know if these have any meaning

austere pumice
#

@vapid cape

Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::41f3:1735:ee0:4cbc%3
   IPv4 Address. . . . . . . . . . . : 192.168.56.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :```
#

I have this

lyric vine
#

where can i find some kind of crash course on setting up a voting reward system for my bot

sullen nymph
#

@austere pumice You need your public/external IP

austere pumice
#

I do

sullen nymph
#

Mind sending it in my DMs to confirm

vapid cape
#

are you running your bot inside a virtual machine?

arctic arch
#

I think thats just the network that gets installed when you install virtualbox

vapid cape
#

yeah, no wonder why it doesnt work then

arctic arch
#

pretty sure there should be more output than that

gaunt steeple
#

wait wut

#

Default Gateway . . . . . . . . . :

#

no default GW

#

how are you even online?

harsh stream
#

That is his virtualbox network info, his VM might be offline while he is online
Or he just didnt add that info to his copy/paste

marsh panther
#

hi, I'm trying to use dblapi.js but it's not working. It's running but I'm not receving the message when someone upvotes. The code is ok.

#

what is dbl.domain for?

tame kindle
#

what

marsh panther
#

ping me when responding pls

sullen nymph
#

Does the "what" not indicate your question made barely any sense

marsh panther
#

well, I have the library running and it should send a message on discord when the vote event fires. But it's not sending it and I don't have any error in the console

sullen nymph
#

Did you make sure your port is open and forwarded while no firewall is blocking the requests

marsh panther
#

yes

harsh stream
#

and did you enter the right ip address and port for the DBL webhook settings?

marsh panther
#

there is no ip adress parameter, is there?

sullen nymph
#

Do you think you can just enter some random numbers and make it work

#

Get your external IP address and use it in the webhook URL

harsh stream
marsh panther
#

oh yeah ik that

#

I'have set the domain name

harsh stream
#

the URL on top.gg needs to be something like http://mydomain.com:5000/webhook or http://123.123.12.12:5000/webhook

marsh panther
#

wait now I'm getting TypeError: domain.enter is not a function at DBLAPI.EventEmitter.emit (domain.js:498:10)

#

ah ok

#

and if I didn't set a path in the code, is it just http://mydomain.com:5000?

harsh stream
#

I don't exactly know what you need to enter in your JS library because I don't use JS

sullen nymph
#

By default webhookPath is /dblwebhook

marsh panther
#

oh ok, thanks

harsh stream
#

And I think DBL only accepts http webhooks, so no https
But I might be wrong

marsh panther
#

oh

sullen nymph
#

What

harsh stream
#

I am wrong?

sullen nymph
#

I highly doubt that

harsh stream
#

ok, ignore what I said ๐Ÿ˜„

sullen nymph
#

But then again, you'd better ask a website admin

marsh panther
#

well I currently have https://mydomain.org:port/dblwebhook

#

and it's not working

harsh stream
#

you use dblapi.js?

#

that runs by default on http

marsh panther
#

and how do I change that?

sullen nymph
#

by hosting a webserver manually or sticking to http

#

I don't recall there being an option to be able to use https unless express server has that

marsh panther
#

I don't think my site works with http, lets see

vapid cape
#

show your dbl code

marsh panther
#
const dbl = new DBL(config.DBLToken, {
    webhookPort: config.port,
    webhookAuth: config.auth,
    webhookServer: server
}, bot)

dbl.on('error', err => {
    console.error(err)
});

dbl.webhook.on('ready', hook => {
    console.log(chalk.green(`[SYSTEM] - Webhook running at http://${hook.hostname}:${hook.port}`))
});

dbl.webhook.on('vote', vote => { 
    bot.createMessage('666712304431136769', `<@!${vote.user}> Upvoted for us on DBL! Thanks :heart: \n<https://deltabot.tech/dbl>`)
});
#

and it's running on port 6719

vapid cape
#

your server is an express server?

marsh panther
#

yes

vapid cape
#

is it configured with ssl?

marsh panther
#

not directly

#

the site is https

vapid cape
#

ah so there is ssl in the reverse proxy or similar

#

so it should accept https

marsh panther
#

yes

vapid cape
#

if you're already running your own server object

#

you dont need a port

#

it will use the same port as the server

#

so remove the port configuration, and change your url to yourwebsite.org/dblwebhook

marsh panther
#

ok

#

and http or https?

#

tried both, still not working

#

Oh wait

fallen basin
#

How can i post my shards from my bot with the JS DBL api

fallen basin
#

or is it possible?

half olive
#

Yes its possible

fallen basin
#

and how?

half olive
fallen basin
#

ahh k thx

half olive
#

Example :

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

thx

half olive
#

You welcome

uneven vigil
#

hey, so my vote webhooks stopped working after i added my site to cloudfare, any idea how to fix?

vapid cape
#

you probably need to whitelist something in the cloudflare settings

uneven vigil
#

hmm like what? and where?

uneven vigil
#

anyone?

remote karma
#

hi

vital talon
#

-help

#

-play falling

harsh stream
shut fjord
#

Hi, I got a short question:
In you're Doc you are saying that any bot with over 1000 votes per moth can not use /bots/{bot.id?}/votes, but need to use webhooks instead.
Where does the moth came from? And what will happend with the 1001st voter within a moth?

harsh stream
#

webhooks are a lot easier than asking the DBL server every time if someone has voted

shut fjord
#

Depends on the system and I'm realy just courious what will happen to the 1001st voter, scince I couldn't find anything in the Docs for that.

vapid cape
#

well, the docs say in big red letters that you cannot use it

#

so its possible that it returns an error if your bot has over 1000 votes

harsh stream
#

I guess there is no hard limit, but the admins might take action if you go over the limit

#

Or maybe there is a hard limit, I never tried it

vapid cape
#

there probably is a hard limit

#

you have to limit a potentially limitless json response

harsh stream
#

It's funny that the Java library has marked it deprecated without having the option to use websockets

clever rock
#

it still works over 1k votes

#

but as for accuracy

#

well so-so

vapid cape
#

what if the bot has like 20k votes? does it return all 20k or does it limit the output to 1k?

arctic arch
#

limits to 1k

hasty patio
#

Hi for the revocation link token it is : https://discordapp.com/api/oauth2/token/revoke?access_token=TOKEN ?

arctic arch
#

this channel is for the top.gg api

hasty patio
#

Oh xuse me dude ๐Ÿ™‚

rain niche
#

so I'm trying to setup webbooks, but not receiving tests at all. (firewall is not an issue)

harsh stream
#

I think someone in #general said that there is an 18 minute delay on receiving votes through webhook right now

rain niche
#

oh god

#

thats bad

rain niche
#

question about the api, I have a cog listener event using the python DBL library, and when receiving POST requests i get this:

127.0.0.1 [18/Jan/2020:12:58:04 +0000] "POST /dblwebhook HTTP/1.1" 401 178 "-" "DBL"

#

but it doesn't call the function

#

but it doesn't call the function

sullen nymph
#

The authorization key isn't the same DBL sends

#

Make sure webhook_auth is the same as the Authorization field value on top.gg

#

Ah fuck you Discor

#

Make sure webhook_auth is the same as the Authorization field value on top.gg

rain niche
#

ah. ok

#

yeah discords being really laggy rn

#

ah. ok

#

ok still nothing

sullen nymph
#

Getting anything?

rain niche
#

im getting it, just function isn't beinmg called

#

the authorization is the same in top.gg as it is in my bot

rain niche
#

no im recieving it

#

in my bot i see the request

#

Economote [INFO] | 127.0.0.1 [18/Jan/2020:13:18:02 +0000] "POST /dblwebhook HTTP/1.1" 200 168 "-" "DBL"

#

in my bot i see the request

sullen nymph
#

fuck I'm being blind

#

Would you be sure that the event is actually registered on the bot?

rain niche
#

the event function is not being called

#

but I see the logs spout that out every time I test

#

(the delay I think is gone)

sullen nymph
#

Are you sending a test request?

rain niche
#

yes

sullen nymph
#

And you got on_dbl_test event?

rain niche
#

oh.. alright yeah that's what i was missing.

sullen nymph
#

haha

rain niche
#

Didn;t know there was a seperate evnt

#

thanks

sullen nymph
#

:p

#

np

rain niche
#

im jealous of the JS people with their really detailed docs lol

#

and I pity the GO/Java/C# devs XD

sullen nymph
#

Don't you dare call my docs useless, they're just not finished! :(

rain niche
#

i will admit they are way better than like a year ago ๐Ÿ™‚

sullen nymph
#

bloblul I would really appreciate some detailed feedback ngl

#

or some kinda explanation how to do proper documentation at this point

vapid cape
#

hit: 34 examples for each possible scenario and each possible command/function combination

#

and whatever other fuckery some idiot will eventually try

sullen nymph
#

At this point that doesn't sound like an exaggerating

vapid cape
#

documentation is literally one of those "for dummies" books lmao

sullen nymph
#

True

restive otter
#

Hi. My bot has only just been approved. I'm not sure how to use the API, so could somebody please provide me with a code snippet on how to DM a user when they've voted, or just tell me how to do this. Thx :)

willow spindle
restive otter
#

ok

#

ty

#

@willow spindle it doesn't say anything about events on vote..

willow spindle
#

which library do you use

restive otter
#

python

willow spindle
#

sorry I can't help for py. I'm using js

restive otter
#

ok

#

@dense basalt can u help?

shy vortex
#

why do you ping a mod now

#

just wait for a response but don't start pinging mods

restive otter
#

sry

sullen nymph
restive otter
#

ty

#

c:

sullen nymph
restive otter
#

ok ty

#

@sullen nymph i have another question. how could i make it so the ip the server is on is 0.0.0.0, as im using gcloud and that's the only way i can think of being able to use the external ip.

#

on the webhook*

sullen nymph
#

Uhh

restive otter
#

mainly because i cant use the internal ip

sullen nymph
#

dblpy hosts the webhook on 0.0.0.0

restive otter
#

oh ok awesome

#

ty c:

sullen nymph
#

If you are unsure, you're free to to dig around the internal code

restive otter
#

ok, tysm c:

sullen nymph
#

๐Ÿ‘

restive otter
#

last question, is there anyway to test the upvote thing without having to wait 12 hours each time?

sullen nymph
#

I'd show the button itself as a joke but I don't have a bot listed so
There's a Test button on your bot's Edit page

#

You just save your settings and test the webhook there

restive otter
#

ok ty

pure current
#

u

half plover
#

Is there a test bot token I can use to see if my code for posting the server count works? I'm currently rewriting my bot so I'd rather not use my real bots token since it's currently used by the production version. Or is it okay to create a bot just for testing purposes?

spiral steeple
#

There is no test bot, but what's the risk in sending a server count?

harsh stream
#

During testing I first checked the nr of servers for my real bot and then I used that number plus or minus a few as a static value in the test version of my bot
Don't forget to disable or remove the test code after testing

fallen tartan
#

How many times can I use the API?

#

I mean are there any type of restrictions

sullen nymph
fallen tartan
#

thank you

worn quail
#

spam

#

dont dotpost

#

Thanks

austere pumice
#
 Can not obtain ownership information
  TCP    0.0.0.0:5000           license:0              LISTENING```
#

my port

#

is opened?

#

but test thing no work

sullen nymph
#

What does your URL look like

austere pumice
#

public/dblwebhook

#

public = publicipaddress

sullen nymph
#

What about port

austere pumice
#

5000

#

self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='epicgamerauthotokenthing', webhook_port=5000, autopost=True)

sullen nymph
#

Well did you specify the port in the URL

austere pumice
#

yes

sullen nymph
#

Are you sure your firewall isn't blocking stuff

austere pumice
#

I made 4 rules for it saying don't block port 5000

#

2 of them inbound tcp and udp, and 2 outbound tcp and udp

#
Ports currently open on all network interfaces:
Port   Protocol  Version  Program
-------------------------------------------------------------------
5000   UDP       Any      (null)
5000   TCP       Any      (null)
25565  TCP       Any      (null)```
#

@sullen nymph is there a way I could test if it blocking things

sullen nymph
#

I don't honestly remember if dblpy webhook outputs anything in console on request but you should probably check it out just in case

austere pumice
#

I have a cog listener for the vote thing

sullen nymph
#

is there anything being output in your terminal when you send a request to the webhook?

austere pumice
#

nope

vapid cape
#

are you listening to the test event?

austere pumice
#

i think so, but can you give me the name

vapid cape
#

dblpy has different events for normal votes and test votes, for some reason

austere pumice
#

ยฏ_(ใƒ„)_/ยฏ

#

well I added it, and tested the vote again, it's a nope

#

what could also prevent this

vapid cape
#

where is your machine hosted?

#

is it a vps?

austere pumice
#

no

#

my machine host is next to me

#

in my house

vapid cape
#

then besides router ports and firewall idk

#

you can try running a simple http server to test

austere pumice
#

can you give me the code bc I don't know shit about that

vapid cape
#

i dont use python, so... not really

green mantle
#

No

#

We are not gonna spoonfeed you

#

Also use a port tester to check if port is open on your public ip

austere pumice
#

I have

#

and it says no open

#

also @green mantle I fucking looked up the shit, and told me some complicated shit

green mantle
#

Because bots can and are complicated?

#

Idfk what you were expecting when you're intersecting with different web servers and socket layers

vapid cape
#

port testers do nothing, every single time i use them, they say my ports are closed, even though my shit works

austere pumice
#

ยฏ_(ใƒ„)_/ยฏ

#

windows says the port is open

#

ok, i have an idea @vapid cape how does one host my code on aws

vapid cape
#

install python in there, install all your libs, upload your files, and run

austere pumice
#

idk how to use aws

harsh stream
#

@austere pumice do you use a portchecker that is installed on your pc or do you use an online one?

austere pumice
#

installed

#

and online

harsh stream
#

the installed portscanner probably doesn't work while your bot is running because the scanner tries to use port 5000 while checking if it is usable

austere pumice
#

ok

harsh stream
#

if you want to use it then you will have to stop your bot first and make sure no other program is using port 5000 while running the port scan

austere pumice
#

ok

autumn bronze
#

what is this channel for?

clever rock
#

dbl api

hushed coyote
#

im trying to make a request to https://top.gg/api/users/ID_HERE and get the json data but it appears i am doing something wrong because embed i put the data in doesn't show up.
I have looked over the code and double checked but i can't find anything wrong with my code.

If it helps, i'm using a website to code and host my bot (https://glitch.com) which runs on nodejs and uses the request package to make the request.

this is big confusion to me indeed.

idk if im an idiot or smth but yh

restive otter
#

How add this

#

Server counter

willow spindle
#

post stats

#

which language do you use

#

*library

restive otter
#

I m use Bot designer for discord

willow spindle
#

Is this bots allowed? @dense basalt

placid peak
#

nope.

dense basalt
#

Interesting

restive otter
#

This is place where you making bot commands

dense basalt
#

@restive otter you're using bot designer for your bot(s)?

restive otter
#

Yea

dense basalt
#

DMs

willow spindle
#

You cannot post stats with bot designer

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

restive otter
#

How i can add it

dense basalt
restive otter
#

I looked

#

I add this token in autho?

dense basalt
restive otter
#

This?

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

worn quail
#

@restive otter you just leaked most of your dbl token

restive otter
#

This is nad?

#

This is nad?

#

Bad

worn quail
#

Yeah

elfin maple
tame kindle
#

that doesn't give us context of the problem

#

show us code so we can give you a step by step of how to fix it

elfin maple
#

dbl.webhook is undefined

tame kindle
#

do you have code supported

elfin maple
#

Well, first I tried dbl.webhook.on but it threw error, so I tried to make dbl.on('vote') and put it in my event handler

#
      Events.forEach(e => {
        e = e.split('.');
        if (e[0] === 'dbl') {
          let event = new (require(`./events/${e[0]}.${e[1]}`))(client);
          dbl.on(e[1], (...args) => event.run(...args));
        } else {
          let event = new (require(`./events/${e[0]}`))(client);
          client.on(e[0], (...args) => event.run(...args));
        }
      });
tame kindle
#

well

elfin maple
#

discord.js events work correctly
but I think dbl's don't

tame kindle
#

did you setup the dbl client correctly

elfin maple
#
let readdir = require('util').promisify(require('fs').readdir),
  client = new (require('./base/Client'))(),
  dbl = new (require('dblapi.js'))(client.config.dblKey, client)
tame kindle
#

well

#

it's undefined because you didn't setup an object for the webhook

#

you have to add an object with webhookPort and the path

placid peak
#

@scarlet cobalt

Iirc dbd uses js
no no and no... it uses Golang and DiscordGo

elfin maple
#

@tame kindle Would the webhookAuth be the token of the discord webhook or top.gg?

tame kindle
#

it's a custom token you set

elfin maple
#

@tame kindle I keep trying but it still doesn't work

tame kindle
#

show your code

#

did you add the token to your bot page?

elfin maple
#

Yes

#

event

module.exports = class event {
  constructor(client) {
    this.client = client;
  }
  async run(vote) {
    let client = this.client;
    try {
      let hook = await client.channels.get('651532735185420288').fetchWebhooks();
      hook = await hook.first();
      let user = await client.users.fetch(vote.user),
        bot = await client.users.fetch(vote.bot),
        embed = new (require('discord.js')).MessageEmbed()
          .setColor(client.selectColor('green'))
          .setTitle('![BlurpleThumbsUp](https://cdn.discordapp.com/emojis/487031865577046026.webp?size=128 "BlurpleThumbsUp") | ยกHan votado por ' + bot.username + '!')
          .setDescription('ยกTรบ tambiรฉn vota por ' + bot.username + ' [haciendo clic aquรญ](https://top.gg/bot/' + bot.id + '/vote)!')
          .addField('โ€ข Usuario', user.tag)
          .setTimestamp();
      //if (vote.type === 'test') embed.setFooter('(Voto de prueba)');
      hook.send(embed);
    } catch (e) {
      client.err({
        type: 'event',
        name: 'voteDBL',
        error: e
      });
    }
  }
};
#

command & event handler

let readdir = require('util').promisify(require('fs').readdir),
  client = new (require('./base/Client'))(),
  dbl = new (require('dblapi.js'))(client.config.dblKey, { webhookPort: 5000, webhookAuth: client.config.dblSkey }, client),
  init = async () => {
    try {
      let Commands = await readdir('./commands'),
        Events = await readdir('./events');
      Commands.forEach(async cmds => {
        let commands = await readdir('./commands/' + cmds + '/');
        commands
          .filter(cmd => cmd.split('.').pop() === 'js')
          .forEach(cmd => {
            let response = client.loadCommands('./commands/' + cmds, cmd);
            if (response) console.log(response);
          });
      });
      Events.forEach(e => {
        e = e.split('.');
        if (e[0] === 'dbl') {
          let event = new (require(`./events/${e[0]}.${e[1]}`))(client);
          dbl.on(e[1], (...args) => event.run(...args));
        } else {
          let event = new (require(`./events/${e[0]}`))(client);
          client.on(e[0], (...args) => event.run(...args));
        }
      });
      let login = await client.login(client.config.token),
        connect = await require('mongoose').connect(client.config.mongo, { useNewUrlParser: true, useUnifiedTopology: true });
      if (login) console.log('ยกIniciando sesiรณn!');
      else console.log('Ha ocurrido un error iniciando sesiรณn');
      if (connect) console.log('ยกConectando con la base de datos!');
      else console.log('Ha ocurrido un error conectando con la base de datos');
      client.dbl = dbl;
    } catch (e) {
      console.error(e);
    }
  };
init();
#

Try to execute the event code with eval and it works, what doesn't work is the webhook, I think.

scarlet cobalt
#

One message removed from a suspended account.

tame kindle
#

@elfin maple did you add it to your bots page

elfin maple
#

I don't know what you mean by that, sorry
Here is the project for you to see https://glitch.com/edit/#!/yuiiiii

tame kindle
elfin maple
#

ah yes I did that

tame kindle
#

did you test

#

with the test button

elfin maple
#

Yes

tame kindle
#

yes

elfin maple
#

But, I don't have a page in my bot, I don't know how to use it either

tame kindle
#

it works with glitch

elfin maple
#

But I would need to create routes, and that's what I don't know how to do.

vapid cape
#

the url is your glitch project url + /dblwebhook

#

and in your webhook port, you need to use process.env.PORT

#

and there is no dbl.on("vote"), it has to be dbl.webhook.on("vote")

elfin maple
#

Still not sending anything.

vapid cape
#

what did you put in the url?

elfin maple
vapid cape
#
  • /dblwebhook
elfin maple
#

Holy God.

#

MANY THANKS

vapid cape
#

๐Ÿ‘

elfin maple
restive otter
#

Botdaki verileri dbl ye nasฤฑl aktarฤฑrฤฑm

wintry kernel
#
@commands.Cog.listener()
async def on_dbl_vote(self, payload):
    print(payload)
``` Not sure why, but the on_dbl_vote in dblpy never fires
willow spindle
#

@restive otter english only

vapid cape
#

@wintry kernel did you configure it in the top.gg edit page?

wintry kernel
#

1 sec

#

it might be to do with how I init the DBLClient

#

Ok no it didnt fix it

#

Right so i realised that dbl says you cant POST directly to a channel

harsh stream
#

your URL should be the IP or domain of your bot, not discord itself

wintry kernel
#

Yeah

#

All fixed now

cold pendant
#

@wintry kernel I recommend changing your webhook now.

wintry kernel
#

I did before I sent the image

#

It wasnโ€™t the full url anyway

cold pendant
#

Yeah but prevention is better than cure.

worn quail
#

so uh how would I make my raspberry pi have a static IP without making the entire internet router static

#

this is related to dbl API

green mantle
#

some routers like Asus allow you to set specific devices to be static

#

also your router should be static anyway

#

this is referring to local IP btw ^^

harsh stream
#

I think almost every router/modem has an option to link a local IP to a mac address

#

your external IP is controlled by your internet provider and it depends on them if you have a static or changing public IP

restive otter
#

ips are dynamic

#

not static (like me)

green mantle
#

That's is technically wrong

#

They can be stati

#

Static

#

Most loca IPs are static if you have any decent router

#

Public IPs are often dynamic but can be static if you ISP allows it like mine

harsh stream
#

In the Netherlands most public IPs are static in practice, your modem can be disconnected from the internet for a few hours and you will still have the same IP

#

The ISP can give you a new IP, but they usually dont

worn quail
#

Local IPs are based on computer connection time

#

and are decided by the computer itself, if available

#

Or at least that's how I've set it up

harsh stream
#

Most routers have a DHCP server that assigns IP addresses on the local network

rough wind
#

It's extremely common practices for isps to give you a static public ip

green mantle
#

not really

indigo ice
#

How i solve this

sullen nymph
#

Post your server count

indigo ice
#

How?

harsh stream
austere pumice
tame kindle
#

wot

harsh stream
#
OSError: [Errno 10048] error while attempting to bind on address ('0.0.0.0', 5000): only one usage of each socket address (protocol/network address/port) is normally permitted
Unclosed client session
#

is your bot running twice?

worn quail
#

I'd use a unique port

#

eg for my webservers I use :5644

#

and we need the code to help

civic wind
#

!help

placid peak
#

if you are playing online game they uses 57xx port

#

(on windows, idk on linux)

#

(and i mean the client, not the server, and its not choiced by game dev)

#

(and yeha this is off topic)

velvet charm
#

when i want to but a bot he is aying to me you have to varify your e-mail adress in order to enter a bot to a server somthing like that how i cant find any thing in my email , even how to resend it

sullen nymph
#

What makes you think this is the correct channel

trail sigil
#

hey can anyone give me some guidance on creating a webhook from top.gg to my bot so it can see when a user has upvoted it

vapid cape
#

language and library?

trail sigil
#

javascript, discord.js

vapid cape
#

have you checked this?

trail sigil
#

yep. I am still a bit unsure how it all works.

vapid cape
#

well, install the library and configure it

#

your dbl token can be found in your bot's edit page

#

the webhook port depends on how your machine is set up. if you're on a vps without a reverse proxy, using 3000 or 5000 is fine, if you're on glitch/heroku you have to use process.env.PORT, if you have another webserver running such as express, omit the port and pass your server instance to the options instead, if you have a reverse proxy such as nginx, use whatever you configured the nginx proxy to use

#

the webhookauth password is a password you create. it must match what you put in the authentication field in your bot edit page

#

the URL field in your bot's edit page also depends on your system's configuration, if its a vps without a reverse proxy, use your.vps.ip.address:port/dblwebhook, if youre on glitch/heroku, use yourprojecturl.glitch/heroku.com/dblwebhook (or whatever is the correct project url)

trail sigil
#

ok thanks a lot i will try this out now

#

thank you so much for the support i really appreciate it

#

i have now got it working so thanks

#

i have something else also using the port. i am using glitch. is there any way to have both this webhook and the other thing to use the same port?

vapid cape
#

yes

#

pass your server instance in the options

#

then it will use the existing server instead of creating a new one

trail sigil
#

ah ok ty

restive otter
#

Does anyone share a code for my bot that I will create from raid?

harsh stream
#

Raids are not allowed and can get you banned

spiral steeple
#

I think he means to counteract raids but that english is broken asf also wrong channel

queen mason
#

Maybe

restive otter
#

@flat comet

restive otter
#

so im new to the top.gg api can anyone explain it to me, im confused

#

actually nvm

cold pendant
#

Does your bot needs to be approved to use the API?

spiral steeple
#

you dont get an api token until it is so yes

cold pendant
#

Might explain why I can't update my status and It just throw an error.

shut mantle
#

I have setup a wehook url but, however I'm not getting any response from the test button and wireshark confirms that nothing is coming in (port is open and firewall is not blocking anything)

#

nvm maybe I'm just being stupid

#

I'll ask again if there's still a problem

#

Alright I do need help

vapid cape
#

whats your url? where is your bot hosted?

shut mantle
#

[removed]

vapid cape
#

is endercrypt.network a domain you own?

#

do you have a webserver running on that domain?

shut mantle
#

no, my co developer, he is in a call rn with me

vapid cape
#

does he have a webserver running on it?

shut mantle
#

"possibly, but on different ports"

vapid cape
#

what kind of server? nginx? node? apache?

shut mantle
#

Wireshark does not get any incoming packages when we press the test button

#

Custom java based server

#

When we send a request to that URL using a browser, wireshark is detecting packages, but when we press the test button nothing is happening

vapid cape
#

hmm

#

i cant think of anything that could cause this. did you save before pressing test?

shut mantle
#

I guess I'm too retarded to press a button. I'm sorry for wasting your time heh...

vapid cape
#

lul it happens

shut mantle
#

If it makes you feel any better, we lost one and a half hours on tracing this

#

lmao

vapid cape
#

damn lmao

#

makes me feel worse actually

#

for you

sullen nymph
#

The issue is fixed, that's all that matters Kappa

shut mantle
#

Thanks for your time tho!

fallow nymph
#

could I get help with binding a port to to a PM2 docker container. Everywhere i've looked says to use docker run -p but we don't use that when running the container instead we use docker-compose up -d to update and restart the container and within the Dockerfile we use pm2-runtime, I am asking because I am trying to get the upvote post webhook working but the container is bound to IP 0.0.0.0 and doesn't have a port bound to it currently afaik right now.

btw, the bot is being hosted on a VM, and the docker containers are being routed using a nginx container.

if this should be asked in #development feel free to let me know. I wasn't sure if it should be here or that channel.

also no i'm not asking for help with everything. Just a few things to help get my started with this.

lilac falcon
#

Hi

#

how to add servers to bot page?

#

@clever rock

#

@dawn fjord

tame kindle
#

@lilac falcon

  1. dont ping the mods online
  2. you make a post request to https://top.gg/api/bots/{BOT_ID}/stats with ```json
    {
    "server_count": <number>
    }
lilac falcon
#

ฤฐm where add to server count?

#

detailed desc.?

tame kindle
#

no

#

you have to hit the request manually

#

I would recommend using an official library if you have no idea how to hit the request

azure hedge
#

how can i get the username of the user voted?

left egret
cyan spoke
#

Can I get help with youtube database api v3

willow spindle
#

read the channel topic

inland spindle
#

I installed dblapi.js and set the token

#

however it still shows n/a

#

is it normal

willow spindle
#

post stats

vapid cape
#

did you add it to your code?

inland spindle
#

yes

#

im a noob so I just installed it and put the code including token

#

Cannot find module 'dblapi.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/app/server.js:15:13)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)

runic grove
#

npm i

inland spindle
#

now it doesnt give any error

#

but still says N/A

vapid cape
#

show your code

scarlet cobalt
#

One message removed from a suspended account.

restive otter
#

Hello, I'm trying to get my bot to work with the API and I cant seem to get it to work, it would help if I just got a rundown of what I need to do in order to get it to work properly. I'm currently running my bot using discord.py.

sullen nymph
#

Are you using dblpy?

nimble hinge
#

Does anyone know why webhooks arent working? It says it will test it within a few seconds but nothing is happening

vapid cape
#

if its not working, then your configuration is wrong

restive otter
#

@sullen nymph Yes I am using dblpy.

sullen nymph
#

Make sure your needed port is open and you're using public IP address
DBLClient has webhook_x kwargs, when you specify webhook_port, the webhook will run

nimble hinge
#

I cant get the webhook to work. Can someone send me an example, because I think im doing something wrong?

sullen nymph
#

Which lib?

nimble hinge
#

dblPY, python

sullen nymph
#

Out of all webhook kwargs, specify webhook_port

#

Also

nimble hinge
#

I have it specified

sullen nymph
#

Make sure your needed port is open and you're using public IP address

nimble hinge
#

It is open

sullen nymph
#

Are you sure your webhook is running?

nimble hinge
#

Well when I go to the url from my browser it says Method not allowed

sullen nymph
#

Could you send me in DMs the full URL you're entering on top.gg?

nimble hinge
#

I sent it

sullen nymph
#

Is your webhook_auth the same as on top.gg?

nimble hinge
#

Yes

eternal sundial
#

Alright so I'm trying to pull the votes from the website. I created a webhook within Discord and added that to the https://top.gg/bot/:ID/edit page.

#

I don't have an idea of what to do next lol

vapid cape
#

discord webhooks have nothing to do with dbl webhooks

#

you run the dbl.py module in your code, configure it with as a webserver (give it a port and an auth password)

#

then in the edit page you put the auth password you configured, and in the url you put whatever address will make dbl find your bot

#

this can be your.vps.ip.address:port/dblwebhook or your project url if you're using glitch/heroku

#

basically, dbl sends the webhooks directly to your machine, which is listening to them through a mini-server created by dbl.py

#

it has nothing to do with discord webhooks

eternal sundial
#

ooo

restive otter
#

In the docs it shows async def update_stats(self): """This function runs every 30 minutes to automatically update your server count"""
Do we have to call this first? Or does it start itself?

sullen nymph
#

You call it somewhere in your code

#

Or set autopost kwarg to True when declaring DBLClient

restive otter
#

wdym?

#

oh wait

#

im being stupid dw

#

tysm for ur help

sullen nymph
#

๐Ÿ‘

eternal sundial
#

@sullen nymph where do you see autopost?

sullen nymph
#

wdym where do I see it

#

Oh this is fun, the docs are't up-to-date apparently

nimble hinge
#

Yeah ive noticed that, some things arent there

eternal sundial
#

Yeah I've been going through them for a little while now lol

azure pollen
#

Anyone having issues with webhooks?

nimble hinge
#

Whats your issue?

azure pollen
#

that it's not working and so i'd like to compare it with someone who may or may not be having a problem, i know how webhooks work

nimble hinge
#

Have you saved the changes before testing?

azure pollen
#

jesus

nimble hinge
#

On top.gg where you put your url

#

Hmm

dense grail
#

I- lmao he wasn't trying to figure out how to save the page, he was asking if webhooks were being glitchy

nimble hinge
#

Yeah I guess

#

But that did happen one time

eternal sundial
#

lol

nimble hinge
#

lmao

eternal sundial
#

so under the edit page on dbl, for the url, I put your.vps.ip.address:port/dblwebhook?

#

or is dblwebhook something else?

sullen nymph
#

Depends on what you set webhook_auth to

eternal sundial
#

that's the password right?

sullen nymph
#

oopsies

#

I meant webhook_path

#

By defailt it's /dblwebhook yeah

eternal sundial
#

Would there be any point in changing it?

sullen nymph
#

Preferences really

eternal sundial
#

Gotcha

eternal sundial
#

Alright so I've got everything setup I believe. Opened the port on my vps and I'm not getting the test from the edit page on TopGG

eternal sundial
green comet
#

hey guys, which url i need to check if someone have voted for my bot

green comet
#

have catch it

azure plover
green comet
#

thanks

eternal sundial
#

I'm trying to use the webhook to detect when someone upvotes my bot. The updated server count works fine and I think I've got everything webhook wise setup correctly. I opened the port on my host and added the test listener but it isn't recognizing the test from the edit page.

#

Is there something else I need to do for the webhook to work?

vapid cape
#

Whats the setup youre using?

elfin maple
vapid cape
#

What is the problem? All your dbl code is commented out

#

Also, what did you put in your top.gg edit page?

vapid cape
#

Console.log q.body

#

Yoire probably getting it as a string

#

Add content-type json or json.parse it

eternal sundial
vapid cape
#

Or console.log body itself, and see what youre actually receiving. The payload might not be in body

#

@eternal sundial and yohr top.gg config?

eternal sundial
#

@vapid cape

vapid cape
#

Thats your correct public ip? Is it a vps or selfhost?

#

Did you save before testing?

eternal sundial
#

VPS

#

It's the same IP I use to get in with PuTTY

vapid cape
#

Did you check the vps control panel for any port opening? Some hosts require that, like google's GCE

eternal sundial
#

I opened the port using UFW

#

It's Ubuntu

vapid cape
#

Check your hosting company

#

They might require you to do something in their control panel

eternal sundial
#

Alrighty

elfin maple
vapid cape
#

req.body

Contains key-value pairs of data submitted in the request body. By default, it is undefined, and is populated when you use body-parsing middleware such as express.json() or express.urlencoded().

eternal sundial
#

Tim I can't find anything

vapid cape
#

Whats your host?

eternal sundial
#

DigitalOcean

vapid cape
#

You did this? sudo ufw allow 5000/tcp

eternal sundial
vapid cape
#

Then idk

#

Can you try running a small webserver and test if it works?

#

Im not famliar with python webservers so i cant help you there, but you should find your way

sullen nymph
#

Simple Flask script or straight up copy dblpy's internal code

vapid cape
#

Dbl webhook libs should have a test that listens to get requests

#

so you can try it in your browser

harsh stream
#

Maybe check what response you get if you try to connect to that URL with a browser

eternal sundial
#

@sullen nymph Which part?

sullen nymph
#

You mean the webhook dblpy uses?

eternal sundial
#

for the webserver, I think that's what I'm missing cause if I type vps.id.address:port into my web browser nothing happens

sullen nymph
#

Tried visiting ip:port/dblwebhook?

vapid cape
#

Does dblpy listen to get requests?

eternal sundial
sullen nymph
#

@vapid cape nop, only POST

#

@eternal sundial a pure poke on the ground but have you tried adding http:// before the ip

eternal sundial
#

@sullen nymph Nothing, well, it says it took too long to respond

elfin maple
#

Hi

#

I'm trying to use dblapi.js in my project but i can't run webhookevents

#

I'm running an express.js server in port 3000 and webhook in port 5000, everything is running fine but when i trying to catch ready event of the package ain't receive anything

sullen nymph
#

Show your code

elfin maple
#

yep, wait

sullen nymph
#

@eternal sundial 1925_JojoThonk

elfin maple
#

All code is in init(), hmm i guess that is the error because when i put dbl.webhook.on("ready") out of that function works fine.

eternal sundial
#

That's the only code I have in regards to dbl

#

I think I'm missing the webserver part

vapid cape
#

@elfin maple glitch only supports port 3000

eternal sundial
#

The other one was super small sorry

sullen nymph
#

You are running the webhook just fine if when visiting http://ip:port/dblwebhook webhook gices you "Method Not Allowed"

eternal sundial
#

Then wtf lol

sullen nymph
#

Did you save your settings ThinkDown

eternal sundial
#

I just redid it

#

Lemme test

#

So when I hit test

#

Does it just print in console?

sullen nymph
#

by default yes but I can't access your URL 8644_AwooThink

#

Are you sure that cog is loading
Also why are you using autopost AND making a loop for update_stats Think

eternal sundial
#

Cause I grabbed the manual example and then you mentioned the autopost here.

#

lol

#

So I can delete the whole task?

#

and the cogs load

sullen nymph
#

Either remove autopost or the task, up to you

#

Did we go through firewall yet

sullen nymph
#

Fun, I typed 42 instead of 142

eternal sundial
#

kek

sullen nymph
#

Webhook is working fine, make sure your Authorization values are the same in your code and on top.gg, re-save and test again

eternal sundial
#

@sullen nymph Done and nothing changed

vapid cape
#

Well, if all else fails, just setup your own webserver

eternal sundial
#

I wouldn't even know where to get started lol

sullen nymph
#

Send your webhook URL in my DMs

naive coral
#

Hello

restive otter
#

HELLO

indigo ice
dapper copper
#

@indigo ice The docs page explains what you have to do

valid walrus
#

Hey, does dblpy's aiohttp version conflict with d.py's aiohttp

green mantle
#

They shouldn't be effected no?

#

They will both call off the same module/package

sullen nymph
#

No they shouldn't

valid walrus
#

specifically this pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches aiohttp<3.6.0,<3.7.0,>=3.3.0,>=3.6.0

#

it's trying to install a version <3.6.0 and >=3.6.0

sullen nymph
#

Oh huh

#

@valid walrus thank you, I'll note this

valid walrus
#

no problem, i'll downgrade the d.py version for now

sullen nymph
#

You're fucking with me, d.py changed its requirements

valid walrus
#

yeah lol i just realized

green mantle
#

@sullen nymph yes it did, that did get noted in 1.3.1

sullen nymph
#

I didn't read changelogs soz

nimble hinge
#

Does "query": "?reminderClicked" mean the user just clicked "Remind me"? (Im talking about when a user votes)

arctic arch
#

it means the user clicked on a vote reminder notification and then voted

nimble hinge
#

Ok cool, thanks!

terse elbow
#

async def on_dbl_vote(self, data):

#

how do I get the user that upvoted?

#

What's the full scope of data?

sullen nymph
terse elbow
#

@sullen nymph im talking about dblpy

#

not webhooks

sullen nymph
#

What's the full scope of data?
Isn't it explained on that page

terse elbow
#

oh

#

ill look

#

ty

sullen nymph
#

np

terse elbow
#

OOH

#

data.user

#

is that it?

sullen nymph
#

Well yeah but that's not how you access dict keys in Python

terse elbow
#

uh

#

wait how

#

data[user]?

#
@commands.Cog.listener()
        async def on_dbl_vote(self, data):
            print(f'Received an upvote from {data[user]}')```
sullen nymph
#

make a user a string there and you're good

terse elbow
#

uh

#

how

#

like

#

data[str(user)]

#

?

sullen nymph
#

Add quotation marks

terse elbow
#

im gonna be fetching said user by ID anyway

#

cuz user is an int

#

but thank you ๐Ÿ™‚

sullen nymph
#

It's a string actually

terse elbow
#

wait

#

so i need to cast it to an int?

sullen nymph
#

Yup

terse elbow
#

user Snowflake ID of the user who voted

sullen nymph
#

Snowflakes are usually saved as strings

terse elbow
#

ok cool

#

tysm

sullen nymph
#

Well technically they are unsigned int64 but top.gg sends them as strings and so does Discord /shrug

terse elbow
#

        @commands.Cog.listener()
        async def on_dbl_vote(self, data):
            userid = int(data[user])
            print(f'Received an upvote from {userid}')```
#

coolio

#

Im still a bit confused on how to vote-lock commands

#

@sullen nymph

sullen nymph
#

Have a database, store the user's ID in there and probably timestamp

terse elbow
#

ok

sullen nymph
#

and on command usage, fetch that data from database and compare current timestamp to saved timestamp

terse elbow
#

could i use get_user_vote()?

#

im not that good with db's

sullen nymph
#

It's an API call which kinda defeats the purpose of webhooks

terse elbow
#

oh

sullen nymph
#
  • it's ratelimited
terse elbow
#

but it works, right?

#

im only on 800 servers

sullen nymph
#

sometimes it has delays

terse elbow
#

ratelimiting seems to not be too bad

#

ah

#

ok

#

its for a minor commands

#

ill use that for now

#

but im migrating to MySQL soon

#

so ill keep that in mind

#

thank you!

sullen nymph
#

Just make sure to keep ratelimits in mind

#

๐Ÿ‘

terse elbow
sullen nymph
#

CSS

terse elbow
#

@sullen nymph please elaborate. WHERE do I put the CSS. HOW do I put the CSS?

sullen nymph
#

HTML
<style> tag in long description

terse elbow
#

ok

#

ty

#

im figuring it out

restive otter
#

so i want to work with discord api ,where can i start i am completely new to discord

#

i do not want to use an already made api

snow zephyr
#

Uh

#

This is for dbl API

frank grove
#

Which port does dbl send webhook requests to?

#

and is the documentation outdated cause I'm getting this error when trying to use dbl.webhook.on:

Property 'webhook' does not exist on type 'DBLAPI'.
vapid cape
#

You need to configure the port in the dbl options

#

Then it will enable the webhook receiver

#

Check the webhook examples in the docs

night creek
#

If i type body {
Background-color: black;
}
Will it work or is it only html?

frank grove
#

@night creek it'll work

frank grove
#

Can anyone let me know why webhooks aren't working for me?

#
const dbl = new DBL(topGGAPIKey, {
  webhookPort: 5000,
  webhookAuth: animuAPIKey,
});
silk bluff
#

oo

#

you hosting them on?

clever rock
#

what kind of arent working

#

property webhook is missing?

#

are you using typescript probably not

hallow dew
#

How to change long description transparency??

green mantle
#

not the right channel for that @hallow dew ask in #development

hallow dew
#

Ok, thanks.

#

Sorry

elfin maple
vapid cape
#

2 things

  1. The image is cached, you might want to add a cache breaker
  2. Your server count is sent once every 30 minutes by default, so unless you change it (not recommended) it will always be up to 30 minutes outdated
willow spindle
#

@dense basalt looks like an ad ^

fallow nymph
#

When I try to send a GET request to thehttps://top.gg/api/bots/:id/check/?userId=user id here it seems to sometimes give me a 401 error even though I am providing the correct token. I am doing it like this

const did_vote = (await axios.get(`https://top.gg/api/bots/602406235848835073/check/?userId=${user_id}`, { headers: { 'Authorization': 'token here' } }))

GWaobloChildPepeShrug it seems to give the 401 most of the time but not always.

terse elbow
#

Question

#

I know there's a way to check if a user voted for your bot or not

#

But is there a way to check if a user spent their vote, or if they haven't voted yet?

#

In the python lib :)

topaz wyvern
#

I mean it's as simple as checking for a false return if they're voted or not..?

true zephyr
#

@topaz wyvern

topaz wyvern
#

?

terse elbow
#

@topaz wyvern I know that

#

I would like to know if there's a way to discriminate if they have voted for my bot, another bot, or no bot at all

topaz wyvern
#

That's not possible afaik

#

Why should it matter if they're voted for another bot anyways?

terse elbow
#

Well, I want to make a vote locked command, BUT give them a different option if they already voted so they wouldn't have to suffer

#

@topaz wyvern

topaz wyvern
#

Wdym already voted?

terse elbow
#

Let's say a user wants to use a vote locked command, and they have not voted for my bot yet.

#

I want to make voting their only option if they have not yet used their vote.

#

I want to do something else if they already spent their vote.

#

Idk how to make this simpler @topaz wyvern

topaz wyvern
#

Spent their vote?

terse elbow
#

Yes/

#

You can only vote for 1 bot

#

Every 12 hours

topaz wyvern
#

Eh

terse elbow
#

That is spending a vote

topaz wyvern
#

Since when

terse elbow
#

?????

#

WYM SINCE WHEN

topaz wyvern
#

Since when

terse elbow
#

AM I DUMB?!

#

OH GOD

#

IM DUMB!!!!!

topaz wyvern
#

lol

terse elbow
#

im so sorry

#

for bothering you

#

EEEEEE

topaz wyvern
#

It's ok lol

#

We all make mistakes

terse elbow
#

oof

#

well now I dont feel bad vote locking

silk bluff
#

I need help with widgets

#

my widget is not getting updated idk why ๐Ÿ˜

#

it still says 62 guilds but its in 64 guilds and 60 votes but it has 2 votes ๐Ÿ˜

#

feel free to ping me

vapid cape
#

Widgets are cached

#

You can add a cache breaker

#

widgeturl?whatever=somerandomthingthatalwayschangeslikeatimestamp

silk bluff
#

oo okay thanks

cold marlin
#

.

green mantle
#

dont do that here @cold marlin

restive otter
#
const { stringify } = require('querystring');
const { request } = require('https');

const update = () => {
  const data = stringify({ server_count: client.guilds.size });
  const req = request({
    host: 'discordbots.org',
    path: `/api/bots/${client.user.id}/stats`,
    method: 'POST',
    headers: {
      'Authorization': 'API TOKEN',
      'Content-Type': 'application/x-www-form-urlencoded',
      'Content-Length': Buffer.byteLength(data)
    }
  });
  req.write(data);
  req.end();
};

client.on('ready', update);
client.on('guildCreate', update);
client.on('guildRemove', update);
#

added to my bot but still not showing me the server count

radiant basin
#

Did you even change 'API TOKEN'?

#
      'Authorization': 'API TOKEN',
dapper copper
#

@radiant basin
A) you're not being helpful. He obviously wrote that by the looks of it. And hid the token as to not post it here
B) some people prefer not to use a lib.

#

@restive otter what response do you get

#

In console

restive otter
#

@radiant basin yes i have changed

#
1|alphaold |   message: 'Unknown Webhook',
1|alphaold |   path: '/api/v7/webhooks/645531624737603595/G5cMG-WkEJJMYQvOphD1dExbMYNM_QsdkFwOxhjyU?wait=true',
1|alphaold |   code: 10015,
1|alphaold |   method: 'POST'
1|alphaold | }``` @dapper copper
dapper copper
#

That's a discord error

restive otter
#

means

dapper copper
#

Saying it can't find the webhook it's posting too

restive otter
#

means i am not getting the error on this code

silk bluff
#

Hi I need help with top.gg widgets

#

//ps I tried to delete cache!

#

widgets don't reload idk why ๐Ÿ˜

frank grove
#

Why is Top.gg showing that my bot is in 2 servers?

#

When it's in ~90 servers

#
new DBL(topGGAPIKey, this.client);
silk bluff
#

are ye sharding?

#

I recommend you to change your api keys and try again

kind barn
#

Hello. I setup the vote event. And my friend voted for my bot.
But the console didn't log anything.

harsh stream
kind barn
#

Is it correct like this?
Webhook running at http://0.0.0.0:5000/dblwebhook

#

Or what im missing?

#

I pressed test and said this may take seconds. No thing else.

harsh stream
#

I cant really help you with any details, im sure someone else can help

kind barn
#

Thanks brother

kind barn
#

If I pressed the test button what should i see in the console??

harsh stream
kind barn
#

The console only logs that server count posted. But don't log votings

#

The url is blank in my bot's config
Which url should I give.?
Make a url in discord or what?

harsh stream
#

in your bot config you need to have the ip of the server where your bot is hosted

#

should be something like http://123.123.123.123:5000/dblwebhook

kind barn
#

I made a webhook in my server and also provided the authentication password. But it loges
Webhook running at http://0.0.0.0:5000/dblwebhook

kind barn
#

Error: listen EADDRINUSE: address already in use :::5000
Error while trying hasvoted

tame kindle
#

port 5000 is already taken

rustic burrow
#

Whats up with this webhook? A website that i can read over on how to set one up and such?

tame kindle
#

what

#

reelaborate pls

frank grove
#

@rustic burrow webhooks are basically a term for post requests that you use for pushing updates/notifications of some sort

lyric vine
#

can anyone give me a crash course in webhooks

spiral steeple
#

webhooks allow servers to send you requests and data. If you connect a webhook to top.gg sends you vote data including the user id and some other stuff.

lyric vine
#

i know what they do but i want to know how to set them up

#

everywhere ive looked just says what they are but not much on how to use them besides some screenshots of javascript

spiral steeple
#

Well, you make a http server that accepts requests and make a handler for whatever it is you're using it for

#

I personally use node's built in http module and fastify because that's what I know, but I believe express works

lyric vine
#

i dont know any js

#

only py

#

and cant find any guides on making the server and handler part

spiral steeple
#

Are you just trying to make a top.gg webhook?

#

you can use dblpy if so

lyric vine
#

i want to have it both do votes and manage some paypal donations for me if i can

spiral steeple
#

But I can tell you, generally, how it would work but I wouldnt be able to help with any code because I use js

#

Shivaco, the maker of dblpy, might be able to help better

lyric vine
#

i mean general is better than nothing

spiral steeple
#

So my top.gg webhook that I used to use that I made is just an http server waiting (or listening) for requests then when it got one it sent the request to the method I made. dbl sends data as json (I would think that JSON is the most common, but url encoded is a possibility) so first you parse whatever it is that was sent, usually if it's an application/json it's in the body of the request. then you can use the data it sent as normal object or map (idk what python calls it) you'll also want to send a response code so the server knows its request was verified (some websites will send it until it is accepted or until it caps out, like twitch) so you just send a response code (200 is OK, 401 is Unauthorized which I think are the most common) and message if you want. You'll also want to make sure you set some type of authorization code so not just anyone can send a request and it'll be operated on like normal (alternatively you can use a firewall to only accept requests from specific IP's I think*). I think that's a basic run down of generally how you would make your own, I wish it wasn't 1:09 AM or I would answer questions too, but I really need sleep for tomorrow. I suppose if you do have questions you can ask but I'm hopping off regardless, good luck with them though

clever rock
#

@lyric vine do you need a webserver for your votes?

#

so it doesnt run alongside with your bot?

lyric vine
#

honestly i dont know what i need

analog trout
#

Hey when you pass your client to new DBL() like in this example

const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);```
Can you only do it if you aren't sharding? My understanding is that each shard would be creating it's own instance of client correct?
sullen nymph
#

i want to have it both do votes and manage some paypal donations for me if i can
@lyric vine Flask or aiohttp.web sound like what you would need

tame kindle
#

not even sanic