#topgg-api

1 messages · Page 96 of 1

astral plaza
#

@rapid kettle what can i do if i do a vote command and they get a reward

latent narwhal
#

Ah thanks

astral plaza
#

no problem

neon bone
#

i!invite

restive otter
#

what

trail sigil
#

@gentle hawk you just use webhooks im pretty sure

tame kettle
#

Anyone else have the issue that guild counts wont update after the bot is running for a couple of days?
I find a lot of entries in the log with

Traceback (most recent call last):
  File "/var/discord/venv/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 275, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 523, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method

But that seems to be an issue with the vote webhook.. at least what I have found ^^

sullen nymph
#

Yup, an issue with the webhook I have no control over really

tame kettle
#

you mean that the count doesn't update or that votes throw that? 😄

sullen nymph
#

The votes KEKW

#

Something keeps sending random requests that aiohttp doesn't handle internally

#

Also, are you using on_guild_post?

tame kettle
#

😅 ok

#

no.. for what ever reason I do it manually..

sullen nymph
#

How are you sending the request?

tame kettle
#

oh, wait.. maybe not

#

let me check the code 😅 did that some months ago

#
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/dblwebhook', webhook_auth=os.environ['AUTHORIZATION_TOP_GG'], webhook_port=5000)

Auto post. But I dont have an listener to on_guild_post yet.

sullen nymph
#

Might be a good idea to put one up to see if the autopost is actually working

tame kettle
#

yes, I'll do that. Its working for a couple of days after I restart the bot.. but stops then for what ever reason ¯_(ツ)_/¯

sullen nymph
#

#Magic

tame kettle
#

#programming ^^

empty current
little wolf
#

How can I get my dbl token?

rapid kettle
#

hello how do you make a webhook? sorry I used the second account because I just tried to vote but hard
@empty current there are docs on https://top.gg/api/docs

#

How can I get my dbl token?
@little wolf You cannot get your DBL token without an approved bot

little wolf
#

I submitted my bot a week ago.

#

Or maybe more.

rapid kettle
#

3+ currently

little wolf
#

oof.

restive otter
#

how do i check if my bot has been approved or not

willow spindle
#

Luca will DM you

ebon pivot
#

so I have this and I getting this error but I am not sure why ```js
dbl.webhook.on('vote', async (vote) => {
^

TypeError: Cannot read property 'on' of undefined
at Object.<anonymous> (C:\Users\Gideon\Code\kettu\kettu\kettu\bot.js:224:14)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
at internal/main/run_main_module.js:17:11```

ebon pivot
#

nvm I got it

restive otter
#

How can I check whether a specific user voted for my bot in python? I'm trying to make a command where a user must vote for it to work.

spiral steeple
#

best way to do it would be to use a webhook and store votes to a database for an x amount of time

#

making an api call every time a command is ran is highly inefficient and will lead to rate limiting

restive otter
#

Hey I'm getting a 401 error

#

Error: 401 Unauthorized

#

Code: await dbl.hasVoted(member.user.id)

#

Hey, Kinda stuck with the webhooks. I have port forwarded already and used the public IPv4 of AWS Instance. http://public_ip:5000/dblwebhook in the TOP GG field + the password Still, The requests are not coming out. Any idea?

def __init__(self, bot): 
    self.bot = bot 
    self.token = 'dbl_token' 
    self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='---`, webhook_port=5000) 
willow spindle
#

@restive otter regen your dbl token

restive otter
#

yep fixed it

sonic forum
green mantle
#

@restive otter do you actually have the listener?

restive otter
#

@restive otter do you actually have the listener?
Yes

midnight lintel
#

hello because it gives me that error if I put the api that I give


at IncomingMessage.<anonymous> (/rbd/pnpm-volume/f714447b-03ff-4863-bf99-e7612c4dc859/node_modules/.registry.npmjs.org/dblapi.js/2.4.0/node_modules/dblapi.js/src/index.js:118:25)12:11 PM

at IncomingMessage.emit (events.js:201:15)12:11 PM

at endReadableNT (_stream_readable.js:1130:12)12:11 PM

at processTicksAndRejections (internal/process/task_queues.js:83:17)12:11 PM

(node:8861) 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(). (rejection id: 1)12:11 PM

(node:8861) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
#

mention if it helps me

rapid kettle
#

@midnight lintel it means you aren't authorised, is your API key correct?

midnight lintel
#

if I generated it right now @rapid kettle

rapid kettle
#

regen it

#

then press copy

midnight lintel
#

again

#

Ok

#

can be used in another bot because I have a test bot

sick saffron
#
DiscordBotListAPI api = new DiscordBotListAPI.Builder().token("my-token").botId("393887855274885121").build();
api.setStats(211);

This is in Java and this does not work for me, can anybody help me?
build.gradle:

...
repositories {
    maven { url 'https://jitpack.io' }
}
dependencies {
    compile 'net.dv8tion:JDA:4.0.0_66'
    compile 'org.discordbots:DBL-Java-Library:2.0.1'
}
tribal kraken
#

Ok it's Error: serverCount is not a number but a undefined instead

strange wraith
#

Why won't the api section show up when editing my bot on top.gg?

trail sigil
#

what is ur current code so far? @tribal kraken

#

@strange wraith has the bot been approved yet?

strange wraith
#

I forgot that it had to be approved

#

oops

trail sigil
#

lol

tribal kraken
#

```const dbl = require(discord-bot-list)
const client = new dbl({
token: "",
id: ""
})

client.postStats("Your bot's server count, MUST be a number, not a string", (err, res) => {
    if(err) {
        console.error(err)
    } else {
        console.log(res)
    }
})```
#

@trail sigil

trail sigil
#

ahh, i would recommend you try using the official dbl api

tribal kraken
#

nani?

#

lol

trail sigil
tribal kraken
#

ye

#

ummm

#

lemme try find it

trail sigil
#

ok lol, many of them are outdated

tribal kraken
#

ohhh i see

trail sigil
#

just do npm i dblapi.js

tribal kraken
#

ok

trail sigil
#

then these are the docs to get it working

tribal kraken
#

ok done

#

oh ok

trail sigil
#

all you have to do is pass your client into the constructor and it'll automatically post the stats

tribal kraken
#

Ok hold up lol, constructor? sorry once again imma noob

trail sigil
#

lol it's the line with the new keyword

#

const dbl = new DBL('Your top.gg token', client);

#

so this bit

tribal kraken
#

ohhhhh

#

ez

#

ty

trail sigil
#

np

little badge
#

does it support discord webhook

spiral steeple
#

no

#

if you try to put one in there it even says it doesnt

strange wraith
#

I had to reset my api key, but now even after changing the one in the code to the new one the bot says it is unauthorized

bleak pecan
#

hmm

restive otter
#

hello

bleak pecan
#

hi

restive otter
bleak pecan
restive otter
#

yeah

bleak pecan
#

go to topgg

#

click "add bot"

#

and do what it says

restive otter
#

ok thanks

sage flicker
#

g

#

b

#

b.

dense compass
#

No. 1. Don't spam (newlines). 2. This channel is not for talking (only for support with the top.gg API)

restive otter
#

@bleak pecan

#

that really helped

#

thanks

bleak pecan
#

your welcome

restive otter
#

appreciate it

bleak pecan
#

just try to keep it online so it can be verified by top.gg staff

restive otter
#

how do I keep it online

#

do commands once in a while

bleak pecan
#

mine was denied 5 times because of it being offline

#

use a hosting service or smth

restive otter
#

ok

#

so when it goes offline

#

how can I get it back online

bleak pecan
#

start it back up

restive otter
#

hello

#
dbl.webhook.on('vote', vote => {

});```
what can i use on here
just vote.user?
#

that returns the voter id

rapid kettle
#

vote.user returns the user ID

restive otter
#

what can i use for user tag?

#

or vote count

#

user.tag im guessing

#

or user.username

rapid kettle
#

you can use client.channels.cache.get("channelID") to send a message into a specific channel

restive otter
#

idk im retarded and tired

#

I just want to know the variables I can use.

#

I just want to know the variables I can use.

#

how can i find m ypublic ip address

#

on my machine

#

in cmd?

rapid kettle
#

on my machine
@restive otter what do you use to host

restive otter
#

if you using windows open cmd and write this ipconfig

rapid kettle
#

That’s private IP afaik

restive otter
#

its on a pterodactyl panel actually

rapid kettle
#

its on a pterodactyl panel actually
@restive otter you might have an ip somewhere on the panel

restive otter
#

yeah

#

its

#

0.0.0.0

#

so that sucks

rapid kettle
#

that’s all available ip’s for the host

restive otter
#

uhh yeah

#

theres the node ip (private) and 0.0.0.0

rapid kettle
#

idk pterodactyl

restive otter
#

welp

weak night
#

I also have the problem. I have this as a code

const DBL = require('dblapi.js');
const dbl = new DBL(config.DBLToken, { webhookAuth: 'xxxxx',  webhookPort: 'xxxx' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});```
He returns it to me
```JS
Webhook running at http://0.0.0.0:xxxx/dblwebhook

Why does it tell me 0.0.0.0?

restive otter
#

same

rapid kettle
#

Because 0.0.0.0 is all the IPs that are available to the host

#

it runs at your public IP

restive otter
#

ok so should we be fine using 0.0.0.0

#

or

#

?

rapid kettle
#

no

restive otter
#

then what do we use

weak night
#

It should give me the ip i have in my panel api?

rapid kettle
#

that’s not your public IP

#

It should give me the ip i have in my panel api?
@weak night yes that’ll work

restive otter
#

he is having the same problem as me

#

how does 0.0.0.0 work for him but not me

rapid kettle
#

0.0.0.0 doesn’t work

#

He has the public IP in his panel

weak night
#

How do we change it?

restive otter
#

oh

rapid kettle
#

you don’t change public IP

restive otter
#

how do i even get my ip from my panel

rapid kettle
#

idk how pterodactyl works you can prob look it up

weak night
#

I have an ip with a link on my panel but should I put it where?

rapid kettle
#

well, if you have the dbl webhook settings the same as the code in docs

weak night
#

it automatically modifies it?

#

oh

#

ok

#

I think i understood

rapid kettle
#

your.vps.ip.address is the ip on your panel

weak night
#

Yes I have that but in the code you have to put where the ip?

rapid kettle
#

nowhere

#

under API and then Webhook

weak night
#

Yes I have but the problem is that the code returns 0.0.0.0 when it should put the panel ip

rapid kettle
#

it’s actually hardcoded that way

#

I’ll find the code a sec

weak night
#

ok

rapid kettle
weak night
#

Once I have this I must replace it in the panel link ?

rapid kettle
#

no don’t replace the code

weak night
#

yeah

#

Once I have my ip, my port I must replace it in the panel link

rapid kettle
weak night
#

It is complicated xd

#

yes

rapid kettle
weak night
#

hm

#

I will test

#

it doesn't work, thank you anyway i will try it alone

#

There is no youtube video that explains this?

restive otter
#

You need to Port Forward (5000) Port in your Panel.

vivid surge
#

or if you use something like ufw or iptables allow it in that

dim shell
#

Wait is changing status too quick is api abuse and what is the minimum time allowed for each status changed?

weak night
#

ok

vivid surge
#

im not sure about that but id say if its a question it's probably too much, how often were you thinking?

restive otter
#

This seems like spoonfeeding but the only thing I am ever going to ask in my lifetime about the API is, how to detect when someone votes and get the user ID?

vivid surge
restive otter
#

Wtf is the bot token why would i reveal my bot token

rapid kettle
#

its the api token @restive otter

restive otter
#

????

restive otter
#

By opening a port and running an app this error is coming out. I have tried to change the ports 10-15 times. Also, there is no other application using the port in the background. If the port is not open, The script runs without any error.

OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 4500): address already in use
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f549587f8d0>
jaunty plank
#

@restive otter if you haven't figured it out.
Glitch and heroku limit what ports you can use.

vague rivet
#

OwO hug

#

OwO @vague rivet

restive otter
#

@restive otter if you haven't figured it out.
Glitch and heroku limit what ports you can use.
@jaunty plank I am using AWS

jaunty plank
#

Aws might also limit ports

#

Yeah, looks like aws limits ports.

restive otter
#

But not every single port is limited though, As mentioned I have changed it 10-15 times to random one. The error is same.

dawn topaz
#

I can't for the love of me get my bot to post my server count to the api using the javascript module

light talon
#

@dawn topaz use the npm module

dawn topaz
#

That's what I am using

#

It's whatever I'll come back later

willow spindle
#

dbl.webhook.on("posted or dbl.on("posted which one is correct

vapid cape
#

dbl.on("posted"

rotund lake
#

Is there an easy way of getting the amount of votes from a user

#

like how many times he has voted yet?

median badger
#

No

restive otter
#

The server count is not working, Is it down?

sudden hull
#

Does the bot need to include code to post server count info to top.gg api before getting approved for the first time

restive otter
#

No, and even though you need an API token for using the Script. You'll get it once your bot is approved.

sudden hull
#

after the bot gets approved the code to post server count must be added in right?

#

or is it optional

restive otter
#

It's optional

sudden hull
#

for some reason I remembering seeing that its compulsory to post server count

restive otter
#

It's not compulsory but not less than that, You can operate it without that in my opinion and some other services may require you to post the server count.

rotund lake
#

Whats the easiest way to get the total amount of votes the bot has?

trail sigil
#

then to get the number of votes that bot has, do either bot.points or bot.monthlyPoints

rotund lake
#

okay thanks

#

How would i read the data in javascript? @trail sigil

#

Is there like an overall explanation on how to do so?

trail sigil
#

how far have you gotten?

#

have you done the get request yet?

rotund lake
#

no?

trail sigil
#

ok so you first need to make a request to top.gg's servers

rotund lake
#

okay trough a function right?

trail sigil
#

you can use something like axios for that

#

ahhh nvm acc

#

you can use the dblapi.js package to do it very easily @rotund lake

rotund lake
#

okay is it explained in the docs?

trail sigil
#

yup

#

the .getBot(id) bit

rotund lake
#

ah i see

trail sigil
#

then you just do .points or .monthlyPoints on the object you get from that

#

its not the getStats one

#

it's the one below that

rotund lake
#

ah okay now i see

#

replace the bot.username with bot.points?

trail sigil
#

yup

rotund lake
#

oh okay thank you very much

trail sigil
#

or .monthlyPoints for the number of points this month

#

np

restive otter
#

What must i do there
{ webhookAuth: 'password', webhookServer: server }
So what do I have to write in "Password" and "server"? Please ping me

true talon
#

imagine using the dbl webhook when you can use express

restive otter
#

?

jaunty plank
#

🤔

#

Dbl api webhook uses http.
Express is built on http @true talon

#

Express likly will use more resources than the dbl api webhook(extremely small amount more but whatever)

true talon
#

lol

tired ivy
#

ping?

smoky yew
#

how would i make it so something happens when a use votes the bot?

trail sigil
#

use webhooks

#

what language do you use?

smoky yew
#

python

#

sry for late reply

#

@trail sigil

trail sigil
smoky yew
#

kk

trail sigil
#

you want to use the webhooks

#

so you'll get a notification basically each time you vote for your bot

#

and just put whatever you want it to do within the listener

smoky yew
#

so i use this one?

#
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, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)

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

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

        # if you are not using the tasks extension, put the line below

        await asyncio.sleep(1800)

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

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

the thing is i dont have experience using cogs

trail sigil
#

yeah, you can just use that bit on_dbl_vote(self, data)

smoky yew
#

so i would have like

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

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

as a seperate file

#

right?

trail sigil
#

honestly, idk because i don't do python

smoky yew
#

ah

trail sigil
smoky yew
#

k

trail sigil
#

but top.gg api specific questions should be asked here

smoky yew
#

oki

#

sry for ping @trail sigil but for this part of the code

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, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)

#

what do i need to change besides the dbl token?

trail sigil
#

just the password and the port (if 5000 is closed)

smoky yew
#

so what would i do for the port?

rapid kettle
#

anything

#

depends on host

smoky yew
#

uh

#

so could i just do like 2

rapid kettle
#

if u want ig

smoky yew
#

k

#

and uh how do i find token and password?

rapid kettle
#

and password is made yourself

smoky yew
#

@rapid kettle it would be on the my bots page?

rapid kettle
#

yes

#

and you make password on your bots main page

smoky yew
#

k

#

is it api key?

rapid kettle
#

Token is api key

#

Webhook auth is set by you

smoky yew
#

@rapid kettle i can't find the place to set the password if you know now can you help me?

rapid kettle
#

Ok!

#

Go to your bot's edit page

smoky yew
#

yes i'm there

rapid kettle
#

Then down to API section

smoky yew
#

yea

rapid kettle
#

in URL is your host (including port and /dblwebhook)

smoky yew
#

i dont have anything there is it needed?

rapid kettle
#

No, you don't need a webhook

smoky yew
#

kk

rapid kettle
#

Ok then, anything else api related?

smoky yew
#

wdym?

rapid kettle
#

You want to set up vote logging right?

smoky yew
#

yea

rapid kettle
#

Well you need a webhook

#

Where are you hosting?

smoky yew
#

i'm hosting on aws

#

a vps

rapid kettle
#

Ok, do you know it's IP address?

smoky yew
#

i belive i can find it

rapid kettle
#

Yea, find it, then put http://your.vps.ip.address:webhookport/dblwebhook into the webhook url

#

then just mash some buttons for auth, then copy it into webhook_auth

smoky yew
#

lol k

#

are you talking about inside the code or the website?

rapid kettle
#

its how i done my auth shrug

#

in the site

#

and copy paste the webhook auth into your code

smoky yew
#

k

proven jasper
#

is there an onvote method for java

#

like a listener for a vote

sullen nymph
#

Please regenerate it ASAP

wanton nymph
#
return new Promise(function (resolve, reject) {
  dbl.hasVoted(message.author.id).then(voted => {resolve(voted);});
})

this returns a false, even for users that have voted... then, after 5-10 minutes/sometimes a bot restart, it returns true. Is there a time that it takes to process the vote?

crisp widget
#

oh what

#

rjian

#

i just saw ur youtube video lmao

split ore
#

is there something going on with the api? my bot's stats are being reported at double what they actually are. i've tried updating it myself manually to make sure it's not something wrong with my code.

split ore
marble verge
#

.\

eternal sundial
#

Hi, does anyone know why a discord.py webhook would stop working?

#

@sullen nymph

restive otter
#

Nor the server count is working without hook

eternal sundial
#

No one?

grim lily
#

dpy webhook?

eternal sundial
#

@grim lily Yeah

proven jasper
#

is there a java vote action listener

raw void
#

How do I get my dbl api key?

eternal sundial
#

@raw void website. Check your bot list, hit edit, and it’ll be at the bottom the page.

raw void
#

Ty

restive otter
#

.

proven jasper
#

@inner venture can i get some help with java api

signal hawk
#

-dotpost @restive otter

abstract mothBOT
#

@restive otter

Please do not post dots to clear your messages/get attention. It adds absolutely nothing to the conversation and just causes spam.
If you need to get attention, then say hello everyone. If you need to clear your messages, then press the Esc key. If you do not follow these instructions you will be muted.

heady rover
sullen nymph
#

@eternal sundial What's your code

#

@restive otter Are you sure the autoposter doesn't work without the webhook?

restive otter
#

Yeah Shiva, It's not working. I have tried with my Local pc and with my VPS.

#

For both of my bots.

sullen nymph
#

What does your code look like

#

Also, DM me the URL and Authorization key you use on the website for your webhook

inner venture
#

@proven jasper what do you need help with?

proven jasper
#

Is there a way to get a vote event listener or does the api have a way of returning the number of votes on the bot

#

Event listener using the api, not the webhook

hoary briar
#

guys i have a question, how can i set the server numbers my bot is in, into the bot page?

restive otter
#

last endpoint

restive otter
#

Hi

#

Im new in discord

#

😘

inner venture
#

@proven jasper no, there isnt

rocky bough
#

you can't get number of votes using webhook but the REST API to fetch bot info includes monthly and total votes @proven jasper

restive otter
#

future: <Task finished coro=<DBLClient._auto_post() done, defined at /usr/local/lib/python3.6/site-packages/dbl/client.py:96> exception=Forbidden('Forbidden (status code: 403)',)> Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/dbl/client.py", line 99, in _auto_post await self.post_guild_count() File "/usr/local/lib/python3.6/site-packages/dbl/client.py", line 142, in post_guild_count await self.http.post_guild_count(self.bot_id, self.guild_count(), shard_count, shard_no) File "/usr/local/lib/python3.6/site-packages/dbl/http.py", line 169, in post_guild_count await self.request('POST', '/bots/{}/stats'.format(bot_id), json=payload) File "/usr/local/lib/python3.6/site-packages/dbl/http.py", line 143, in request raise errors.Forbidden(resp, data) dbl.errors.Forbidden: Forbidden (status code: 403) Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7f60dc4bbe80>

#

what does this means

#

I got it at the time of posting the server count.

dense basalt
#

Status code 403

#

Did you provide the correct token?

gusty citrus
#

is the vote logging just putting the webhook url in the bot edit page?

cursive roost
#

Idk if this is under the api section but i just added my bot to top.gg and it doesn't say that my bot is online how does this work ?

#

can someone please help?

rapid kettle
#

You can't do it without an approved bot

restive otter
#

Did you provide the correct token?
@dense basalt Yes, Even though I have regenerated it thrice.

dense basalt
#

What are you trying to access then

#

Like what are you trying to do

fickle breach
willow spindle
#

post server count to top.gg api

fickle breach
#

how im so confused'

jaunty plank
#

using the api

gritty snow
#

.

dense basalt
#

-dotpost @gritty snow

abstract mothBOT
#

@gritty snow

Please do not post dots to clear your messages/get attention. It adds absolutely nothing to the conversation and just causes spam.
If you need to get attention, then say hello everyone. If you need to clear your messages, then press the Esc key. If you do not follow these instructions you will be muted.

nocturne pendant
#

Okay, the API is not having the votes return true

#

After the users vote

#

Explanation 👀

#

I need a quick response

jaunty plank
#

your webhook isn't getting responses? or a specific endpoint is giving incorrect info?

nocturne pendant
#

Nah, it's the dbl variable

#
const dbl = new DBL("That Token",{
    webhookPort: 5000,
    webhookAuth: 'dZ615dp0xeTKmmf39SQNM-THATSOMETHING'
});```
#

@jaunty plank is this correct?

jaunty plank
#

yeah

nocturne pendant
#

Getting nothing back

#

no response

#

no vote requests

#

I'm still getting false back

#

The users who voted on my bot

#

It still returns false for them

jaunty plank
#

🤔 the webhook is to be used when top.gg gets a vote

#

it has a vote event

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

not getting anything back

#

Users vote, get nothing back

jaunty plank
#

do you have an event setup for votes?

nocturne pendant
#

The same one you sent

#

I have the ready event and the vote event

jaunty plank
#

okay, did you tell the website to use the right ip:port/path

nocturne pendant
#

👀

jaunty plank
#

http://ip:port/path

nocturne pendant
#

Discord's?

jaunty plank
nocturne pendant
#

What's their port and IP

#

again

jaunty plank
#

yours

#

not theirs

nocturne pendant
#

http://0.0.0.0:5000/dblwebhook

#

it's going on this

jaunty plank
#

yeah, you need to tell top.gg to use that

#

except with your ip

#

on your bots edit page

#

near the bottom

nocturne pendant
#

Life saver

#

Could kiss you now

jaunty plank
#

😻

plucky canopy
#

I made a vote log, the code works, but when a person votes, nothing happens
Code (js):

dbl.webhook.on('vote', vote => {
  ec.Global.findOne({_id: vote.user}, function (err, doc) {
    let amount = Math.floor(Math.random() * 8000) + 5000
    let money = amount + doc.money
    
    doc.money = money

    doc.save()
    client.channels.cache.get("726135416238899210").send(`<@${vote.user}>`)
    client.channels.cache.get("726135416238899210").send({
      embed: {
        "title": ":vote: » Voto",
        "description": `Obrigado por votar, <@${vote.user}> !\nRecebeu ${amount} por votar!`,
        "color": "GREEN"
      }
    })
  })
});
#

The other things works

rapid kettle
#

what do you have as the webhook settings

plucky canopy
rapid kettle
#

0.0.0.0 isn't the right ip.

#

It's actually hardcoded to say that in the code

#

So, change 0.0.0.0 to your VPS public IP

#

@plucky canopy

plucky canopy
#

ok

#

thx

rapid kettle
#

Ping me if that doesn't work

plucky canopy
#

@rapid kettle The VPS doesn't provide public IP's

#

has other alternative?

rapid kettle
#

eyess wdym

#

it obviously has to

#

provide the IP

plucky canopy
#

The VPS don't have dedicaded machines

rapid kettle
#

my vps does

#

what hosting service do you use?

plucky canopy
#

Discloud

rapid kettle
#

What plan

plucky canopy
#

Diamond

rapid kettle
#

You'd be cheaper buying a VPS at that point

plucky canopy
#

yeah...

rapid kettle
#

no wait

#

forgot exchange rates existed

rotund lake
#

What's the social part about?

#

In the get user part?

#

"social":{}}

graceful heath
#

It is true that if my bot is in heroku hosted. Does the Vote api not work for you?

median badger
#

No

#

Why would that be the case lmao

graceful heath
#

Is it good for heroku too?

rapid kettle
#

It works but only on a certain port afaik

restive otter
#

Please i need help for the status of my bot

#

How i can display the number of servers and members

rapid kettle
#

You can't when it's not approved

restive otter
#

How i can display the number of servers and members
@restive otter wytb

#

?

lavish elm
#

What happens if my webserver is offline at the moment of a vote? Do I get another attempt from dbl to send me the vote later? (using webhooks)

gaunt steeple
#

No I don't think it retries

#

Use a web server that's separate to any in your bot e.g. not express.js or such. From there queue them to a db table or similar and have your bot query that

#

That way if your bot is offline you don't miss votes

#

My webhook handlers are simple PHP scripts for example

stone pasture
gaunt steeple
#

If it's related to the top.gg API yes we can help you here otherwise wrong channel

restive otter
#

future: <Task finished coro=<DBLClient._auto_post() done, defined at /usr/local/lib/python3.6/site-packages/dbl/client.py:96> exception=Forbidden('Forbidden (status code: 403)',)> Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/dbl/client.py", line 99, in _auto_post await self.post_guild_count() File "/usr/local/lib/python3.6/site-packages/dbl/client.py", line 142, in post_guild_count await self.http.post_guild_count(self.bot_id, self.guild_count(), shard_count, shard_no) File "/usr/local/lib/python3.6/site-packages/dbl/http.py", line 169, in post_guild_count await self.request('POST', '/bots/{}/stats'.format(bot_id), json=payload) File "/usr/local/lib/python3.6/site-packages/dbl/http.py", line 143, in request raise errors.Forbidden(resp, data) dbl.errors.Forbidden: Forbidden (status code: 403) Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7f60dc4bbe80>
Anyone please? I have regen the token thrice, The auto server count is not working. It does work for my other bot but not this.

lavish elm
#

Thanks brain

full walrus
#

Am I right your bot needs to be verified before you can use the api?

#

Verified on top.gg to make use of dbl api

fluid cobalt
#

how else do you want to use the api? you need the token, which u only get after u are verified

full walrus
#

Ok thanks, I already thought so but wasn't 100% sure

lavish elm
#

I think it might be because I'm using cloudflare, any way to solve that?

#

Please ping me if there is any answer!

rapid kettle
#

@lavish elm just use the IP

median badger
#

It returns a 404 not found btw

restive otter
#

So, I just recently got my bot approved and I want to start using webhooks and seeing when a users votes and such, I've read the documentation but I'm still a bit confused on how to set it all up. I'm currently using heroku temporarily for hosting so that it's not on my computer 24/7. Can anyone assist me with this?

#

Scroll up

#

This channel is filled with those questiobs

#

And answer about it

restive otter
#

I did scroll up, but none of those things seemed worked for me.

#

If anyone is available to help me, feel free to ping me whenever you have the chance.

rapid kettle
#

@restive otter need help?

distant raven
#

hey what's the last version of dblapi.js? 2.4.0?

willow spindle
#

yes

restive otter
#

@restive otter need help?
@rapid kettle Yes, I still do.

rapid kettle
#

Ok, so what language are you developing in?

#

@restive otter?

restive otter
#

hi, anyone knows if rich presence works for mobile apps?

placid citrus
#

We have to host a webhook server in order for the vote webhook to work, or we just put the IP and port in the URL and then running the bot with new DBL() allows for them to work?

rapid kettle
#

You need to have the webhook options in new DBL()

#

and if the ports are open and the ip is right it'll work

placid citrus
#

Yeah, but not need for an external webhook server, right?

rapid kettle
#

No.

placid citrus
#

Awesome

#

Thanks

rapid kettle
#

Glad I could help!

restive otter
#

Ok, so what language are you developing in?
@rapid kettle Sorry for the late response but JS.

rapid kettle
restive otter
#

Yeah, I looked at that but I am still confused on how to setup webhooks.

jaunty plank
#

const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
^ initilize webhook with port 5000, and password as the auth

restive otter
#

I understand that much, but then what about the actual webhook url?

jaunty plank
#

http://yourpublicip:5000/dblwebhook

#

if you use default settings

#

you can see it, in the example ready event aswell

restive otter
#

Even if I am hosting the bot elsewhere?

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

#

the public ip of wherever the code is being ran

restive otter
#

So, the public ip of heroku, is what I think would apply in my case.

jaunty plank
#

heroku doesnt provide static IP's

restive otter
#

So then what do I use?

jaunty plank
#

some people suggest proxying from a static ip, to heroku.
but your looking at spending money to do that.

#

which suggests it gives a static ip

restive otter
#

I'll take a look, thanks.

placid citrus
#

What’s the best way to pass the client into the new DBL() is using an external program to host this?

restive otter
#

@jaunty plank I setup that addon and got a static IP, so now I should just input it in this right? http://yourpublicip:5000/dblwebhook Also apologies for the ping.

jaunty plank
#

yeah

#

never used heroku, so im not sure if you are limited to specific ports

restive otter
#

Okay, thanks.

restive otter
#

does dbl have an issue because the webhook isn't passing the auth token that i give it see below for the headers

alpine robin
#

but when i make a POST request, returns a status 200

#

but the stats aint updating hmm

abstract swallow
#

what language @alpine robin

alpine robin
#

js

abstract swallow
#

may i see your code that posts the stats?

alpine robin
#

🤔

abstract swallow
#

i trust you know your top.gg token?

alpine robin
#

yeah

abstract swallow
#

ok

jaunty plank
#

Are you replacing :id with server id?

#

Isn't it supposed to be client id

alpine robin
jaunty plank
#

Just making sure

abstract swallow
#

what are you trying to do?

alpine robin
#

post stats

abstract swallow
#

how many servers he's in?

alpine robin
#

46

abstract swallow
#

i-

#

i meant are you tryna post how many servers he's in

alpine robin
#

yes

abstract swallow
#

why did you make it so complicated - not to be rude

alpine robin
#

When i post the stats, i get Status 200, says the API, but the stats on the site aint updating

abstract swallow
#

under methods,

#

have you tried using the example

#

?

#

h-hello?

alpine robin
#

wait

abstract swallow
#

I will

alpine robin
#

nvm

abstract swallow
#

Ok

#

?

alpine robin
#

got it ;p

abstract swallow
#

Good job I'm proud

distant raven
#

hey idk if it's here but, how can i change my page's background?

restive otter
#

Use html

restive otter
#

oh

weak wyvern
#

hey

#

i installed the dblpy

#

how i can test?

sullen nymph
#

Your bot's Edit page -> Test button at the bottom

#

Don't forget to fill out the URL and authorization fields

restive otter
#

lol

warped lance
#

Hello, I'm having a hard time with vote listening on dblpy

rapid kettle
#

Yea?

warped lance
#
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)

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

So here's my Python code

rapid kettle
#

you don't have any webhook settings afaik

warped lance
#

But whenever I press the test button nothing happens

#

I must have missed something

#

Probably a wrong URL

#

But I don't know what URL to choose and how to set a listener server side as I guess http://ip/dblwebhook doesn't lead anywhere

jaunty plank
#

http://ip:port/dblwebhook

warped lance
#

How do I choose the port?

#

Ohhhh I didn't see the arguments when initializing the class, thanks

#

I can choose the path and port

#

Gonna try that later thanks

sullen nymph
#

You relied on your IDE to suggest that?

warped lance
#

I wish it could

#

TBH I had never worked with webhooks before

sullen nymph
#

Yeah, webhook_x kwargs are received internally from **kwargs so your IDE didn't know those existed

#

A webhook is just a reverse API, you listen to requests

warped lance
#

Oh I see

restive otter
#

hey there, my webhook handler isn't working due to dbl not sending the authorization header.

#

(for votes)

warped lance
#

Ok so I tried configuring the webhook when calling the DBLClient class and setting up my webhook accordingly on the website :

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

    def __init__(self, bot):
        self.bot = bot
        self.token = 'token' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path="/dblwebhook", webhook_auth='mypassword (authorization field on the website)', webhook_port=5000)

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

It won't print anything when clicking the Test button

rain bramble
#

hmm, difference between automatic and manual server count (and maybe webhook too)?

sullen nymph
#

"Autopost" provided by dblpy accesses the client.guilds and posts its length to top.gg
Manual server count just allows for more flexibility with the interval between each post

#

As for the webhook,

A webhook is just a reverse API, you listen to requests

#

A webhook that you use for top.gg is optimally a webserver listening to POST requests to get data of votes in real time

rain bramble
#

Ooohh thanks that cleared out a lot for me

sullen nymph
severe steeple
#

I can't get the on_dbl_vote event to work, I set the webhook path, auth, port and everything

#

but it doesn't work as expected

#
import dbl
import discord
from discord.ext import commands
import os
on_vote_log_id = os.getenv('ON_VOTE_LOG_ID')

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

  def __init__(self, client):
      self.client = client
      self.token = os.getenv('DBL_TOKEN') # set this to your DBL token
      self.dblpy = dbl.DBLClient(self.client, self.token, autopost=True, webhook_path='/dblwebhook', webhook_auth='somepassword', webhook_port=5000) # Autopost will post your guild count every 30 minutes

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

  @commands.Cog.listener()
  async def on_dbl_vote(self, data):
    print("voted")
    vote_channel = self.client.get_channel(int(on_vote_log_id))
    member = self.client.get_user(data['user'])
    embed = discord.Embed(title="New vote!",
    description=f"{member} voted on your bot.",
    color=discord.Color.green())
    embed.set_thumbnail(url=member.avatar_url)
    await vote_channel.send(embed=embed)

  @commands.Cog.listener()
  async def on_dbl_test(self, data):
    print('ey')
    print(data)

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

Does anyone have any idea of what it could be?

#

I tried many ports, tried using https instead of just http

#

tried using my own public ip instead of the application host's public ip

#

none worked

restive otter
#

h

jaunty plank
#

did you let the port through the firewall?

#

if you have one*

#

and if you need to, port forward

severe steeple
#

I tried using sudo ufw allow 5000/tcp

#

in the console

#

but I don't have perms

#

I mean, there is no ufw, so to install it I would have to have perms

#

it's an ubuntu 18.04.4

#

to 'host' the bot

#

and a third party website to ping the flask application's ip

#

to run it

#

forever

jaunty plank
#

repl it might have restrictions on what ports you are allowed to use

severe steeple
#

i used a website to check if that 5000 port was blocked

#

it apparently is

#

isn't there another port that I could use?

jaunty plank
#

I'm not sure, ive never used replit
they will have it listed somewhere

severe steeple
#

I can't find anything

#

well, guess I'm not having an on_vote command

#

thank you for your time anyways

severe steeple
#

wait a sec, I'll take a look into it

rain bramble
#

So I finally got around to using the 'manual' example

#

How can I check it works?

severe steeple
#

@sullen nymph I get a [23/Jul/2020 22:18:02] "POST /dblwebhook HTTP/1.1" 404 - in my console

#

when I test the webhook

#

but it doesn't trigger anything

sullen nymph
#

What's your webhook_path?

#

Yeah, a 404 status code is returned

#

/dblwebhook endpoint doesn't exist on your webhook

severe steeple
#

like that

#
def __init__(self, client):
      self.client = client
      self.token = os.getenv('DBL_TOKEN') # set this to your DBL token
      self.dblpy = dbl.DBLClient(self.client, self.token, autopost=True, webhook_path='/dblwebhook', webhook_auth='justatest', webhook_port=8080) # ```
#

my flask thing also uses the 8080 port

#

am I doing something wrong? Thonk

sullen nymph
#

Weird

#

Try http

severe steeple
#

I've been since yesterday trying to fix this

#

ok I will

#

same output

#
  • 404
sullen nymph
#

Could you send me the full URL and Authorization key in DMs?

severe steeple
#

sure

steel hawk
#

What are the different things I could sort by for the /bots endpoint?

#

It just says String for type but I don't actually know the different things I can sort by

spiral steeple
#

I'm not entirely sure, maybe like points or monthlyPoints

#

those are what first come to mind, but I have no idea

steel hawk
#

I know there is points and guildcount

#

Is there a place where I could find a list of all of them?

spiral steeple
#

marco would probably know, but he's offline so I wouldnt bother him

steel hawk
#

Ight

#

Thanks

spiral steeple
#

Simple, just generate every possible combination of strings that go to x length and eventually you'll find most of them mmLol

steel hawk
sullen nymph
#

Could try any key returned from /api/bots/XXXX

primal mirage
#

i got this error when testing locally, is this normal?

Error: connect ETIMEDOUT 104.31.87.28:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14) {
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '104.31.87.28',
  port: 443
}
#

dblapi.js is the package

median badger
#

Hey chief

#

No

#

It is not

restive otter
#

where do i get yourDBLTokenHere

vapid cape
#

your bot needs to get approved first

restive otter
#

alright

vapid cape
#

afterwards, you will find it in top.gg/api/docs#mybots as well as in your bot's edit page

restive otter
#

cheers HYPE

uneven ferry
restive otter
#

i added mine a few days ago but also waiting on discord to verify my application and i bet that will take a few months memedie

tribal moat
#

Does it take that long to check a bot on discord?

severe steeple
#

if quarantine exists, yes

#

people in quarantine be like, "I have nothing to do.. guess I'll submit my unique moderation bot"

blissful forge
#

whats the webhook auth & password if you were to use the webhook?

rapid kettle
#

Webhook auth is set by you

blissful forge
#

what is that supposed to be

spiral steeple
#

Nice spam

jolly hornet
#

-api @restive otter

abstract mothBOT
#

@restive otter

THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs

jolly void
#

!start

restive otter
restive otter
#

what im say?

#
OOF
sullen nymph
#

Please keep this channel on topic of top.gg API questions.

restive otter
#
mendanibig
#

idk what is api?

#

TOTOW

#

TOTOW

sullen nymph
#

really...

restive otter
#

yes

#

¯_(ツ)_/¯

#

uhh can i ask?

sullen nymph
#

-ask2ask

abstract mothBOT
#

Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.

Please read https://dontasktoask.com/ for an explanation on why this is an issue.

restive otter
#

ok

high turret
#

So what exactly is the api used for?

sullen nymph
#

browse the Resources tab and see what endpoints are available

restive otter
#

hi

olive arrow
floral orchid
#

Hello ,
How do I get my bot to kick the name of the person who voted for a particular channel when I voted from top.gg?

oblique gulch
#

.p anuel bebe leche

#

'T enrique que es esto aquí?

upper forge
#

-asxp

#

as-xp

open cape
#

Can anybody suggest me a free chatbot api, that can respond to the user's messages?

cerulean igloo
#

THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs

dreamy portal
trail sigil
#

-api

abstract mothBOT
half rivet
#

you have a api for server list ?

rapid kettle
#

no, the server list is managed by @wild lantern afaik

storm siren
#
            ^

TypeError: Cannot read property 'on' of undefined``` i get this error
jaunty plank
#

dbl.webhook doesnt exist unless you tell it to

storm siren
#

ight

jaunty plank
#

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

storm siren
#

ight

restive otter
#

never used heroku, so im not sure if you are limited to specific ports
@jaunty plank I don't know if you remember talking about the heroku addon that said would help me with webhooks but I was testing out the url with testing tool and it returns This is a proxy server. Does not respond to non-proxy requests.

#

Also sorry for the ping.

quaint valley
#

I want to connect the API to my bot so it shows the amount of servers it is in but I don’t know how to do this with discord.js commando

gusty citrus
#

where can i get the DBL npm?

restive otter
median badger
#

Happy day of birth

restive otter
#

is it possible to receive the webhook with aiohttp

true talon
#

yes

restive otter
#

With post?

gusty citrus
#

hey what did i do wrong here

sullen nymph
restive otter
#

And

#

just request.post()

#

?

#

GOt it

gusty citrus
#
const server = http.createServer(app);
const dbl = new DBL(`lmaokeyhere`, { webhookAuth: 'auth', webhookServer: server });
dbl.webhook.on('ready', hook => {
    console.log(`Webhook running with path ${hook.path}`);
  });

  dbl.webhook.on('vote', vote => {
    const voted = new Discord.MessageEmbed()
    voted.setColor(`RANDOM`)
    voted.setAuthor(`XBot DBL Webhook`)
    voted.setDescription(`${vote.user.tag} just voted for XBot!\nID: ${vote.user.id}\nThank you and don't forget to vote again!`)
    voted.setTimestamp()
    voted.setThumbnail(vote.user.displayAvatarURL({ format: "png",dynamic: true, size: 1024 }))
    bot.guilds.cache.get(`652474899511640074`).channels.cache.get(`736862394466304011`).send(voted);
  });``` hey anyone know what i did wrong here?
it doesnt send anything after a user voted
tranquil fox
#

Hello ! I would like to know where I have my webhook password? Thank you !

#
{ webhookPort: 5000, webhookAuth: '' });
restive otter
#

Your bot's edit page

tranquil fox
#

thx nac_catclapA

gusty citrus
#
const server = http.createServer(app);
const dbl = new DBL(`no`, { webhookPort: no, webhookAuth: 'no' });
dbl.webhook.on('ready', hook => {
    console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path} - Works`)
  });

  dbl.webhook.on('vote', vote => {
    console.log(`2`)
    const voted = new Discord.MessageEmbed()
    voted.setColor(`RANDOM`)
    voted.setAuthor(`XBot DBL Webhook`)
    voted.setDescription(`${vote.user.tag} just voted for XBot!\nID: ${vote.user.id}\nThank you and don't forget to vote again!`)
    voted.setTimestamp()
    voted.setThumbnail(vote.user.displayAvatarURL({ format: "png",dynamic: true, size: 1024 }))
    bot.guilds.cache.get(`652474899511640074`).channels.cache.get(`736862394466304011`).send(voted);
  });```
#

ehh now it logs the ready part but doesnt work when someone votes

grand agate
#

Hmm

gusty citrus
#

anyone know why?

restive otter
#

vote.user is a just a id

gusty citrus
#

oh

restive otter
#

but you're using vote.user.displayAvatarURL() sad

gusty citrus
#

oop-

#

idk what vote was oof

#

ight

#

how do i get the username tho

restive otter
#

Use fetch or get

gusty citrus
#

o

#
const server = http.createServer(app);
const dbl = new DBL(`no`, { webhookPort: no, webhookAuth: 'no' });
dbl.webhook.on('ready', hook => {
    console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path} - Works`)
  });

  dbl.webhook.on('vote', vote => {
      let voter = bot.users.get(vote.user)
    console.log(`2`)
    const voted = new Discord.MessageEmbed()
    voted.setColor(`RANDOM`)
    voted.setAuthor(`XBot DBL Webhook`)
    voted.setDescription(`${voter.tag} just voted for XBot!\nID: ${vote.user}\nThank you and don't forget to vote again!`)
    voted.setTimestamp()
    voted.setThumbnail(voter.displayAvatarURL({ format: "png",dynamic: true, size: 1024 }))
    bot.guilds.cache.get(`652474899511640074`).channels.cache.get(`736862394466304011`).send(voted);
  });```
#

soo this should be okay?

frigid basin
#

sairam why do you really want to announce it, it's not even public yet

vagrant glen
#

Ok

#

Will do that later

gusty citrus
#
const server = http.createServer(app);
const dbl = new DBL(`no`, { webhookPort: no, webhookAuth: 'no' });
dbl.webhook.on('ready', hook => {
    console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path} - Works`)
  });

  dbl.webhook.on('vote', vote => {
      let voter = bot.users.get(vote.user)
    console.log(`2`)
    const voted = new Discord.MessageEmbed()
    voted.setColor(`RANDOM`)
    voted.setAuthor(`XBot DBL Webhook`)
    voted.setDescription(`${voter.tag} just voted for XBot!\nID: ${vote.user}\nThank you and don't forget to vote again!`)
    voted.setTimestamp()
    voted.setThumbnail(voter.displayAvatarURL({ format: "png",dynamic: true, size: 1024 }))
    bot.guilds.cache.get(`652474899511640074`).channels.cache.get(`736862394466304011`).send(voted);
  });``` this still doesnt send the message tho
trail sigil
#

@gusty citrus have you setup the url on your bot page?

gusty citrus
#

the webhook url? yea

#

the authorization thing too

rapid kettle
#

where do you host

trail sigil
#

@gusty citrus are you certain that the port you are using is open?

gusty citrus
#

uh idk i just put 5000 there

trail sigil
#

is it open tho?

#

the port may be blocked by a firewall

rapid kettle
#

@gusty citrus Where do you host?

gusty citrus
#

uh on a friend's host

rapid kettle
#

get their host's IP address

gusty citrus
#

uh ye

rapid kettle
#

if you have the path set as dblwebhook ofc

gusty citrus
#

im quite sure i already tried that tho

trail sigil
#

have you opened the port?

gusty citrus
#

how do i open

full walrus
#

If it is your friends host your friend needs to open it for you

gusty citrus
#

ye i used the node IP and 5000 as the port but it doesnt seem to work still tho

rocky yoke
#

where do i set the path to dblwebhook in my code

rapid kettle
#

webhookPath option

rocky yoke
#

hmmm

#

its saying my ip is 0.0.0.0...

spiral steeple
#

0.0.0.0 is all ips on the server

#

0.0.0.0 is just hard coded into the dblapi.js file

rocky yoke
#

how do i know when its connected cuz whenever i test the webhook nothiing goes through

gusty citrus
#
const server = http.createServer(app);
const dbl = new DBL(`no`, { webhookPort: no, webhookAuth: 'no' });
dbl.webhook.on('ready', hook => {
    console.log(`Webhook running at no - Works`)
  });

  dbl.webhook.on('vote', vote => {
    console.log(`User with ID ${vote.user} just voted!`)
      let voter = bot.users.cache.get(vote.user)
    const voted = new Discord.MessageEmbed()
    voted.setColor(`RANDOM`)
    voted.setAuthor(`XBot DBL Webhook`)
    voted.setDescription(`${voter.tag} just voted for XBot!\nID: ${vote.user}\nThank you and don't forget to vote again!`)
    voted.setTimestamp()
    voted.setThumbnail(voter.displayAvatarURL({ format: "png",dynamic: true, size: 1024 }))
    bot.guilds.cache.get(`652474899511640074`).channels.cache.get(`736862394466304011`).send(voted);
  });```
#

why does this still not send

#

i checked the port is open and the IP is correct

jaunty plank
#

http://ip:port/dblwebhook

#

and auth needs to be the same as your program and the website

ionic holly
#

Does anyone know how to add a music command to play music on the bot? It should connect to the voice channel itself

uneven crest
#

why my bot servercount saying no server data

#

any api issue?

ionic holly
#

@uneven crest this is my real name wth

#

My name is Rishit

uneven crest
ionic holly
#

Does anyone know how to add a music command to play music on the bot? It should connect to the voice channel itself

uneven crest
#

why my bot servercount saying no server count
@uneven crest

#

which

#

?

uneven crest
#

its not coming now also

restive otter
#

What is dbl base api url?

true talon
high turret
#

Is there a way to get an api key if your bot isn’t verified yet?

#

Like on the website if it still hadn’t been reviewed or no?

true talon
#

no

jaunty plank
#

not that im aware of

true talon
#

you'll only get the api key once its approved

high turret
#

Alright thank you

true talon
#

@sleek hamlet here too

sleek hamlet
valid heath
#

how do i make my bot detect when somebody votes for the bot on top.gg?

jaunty plank
#

webhooks

#

most, if not all the top.gg api libs have the webhook stuff built in

whole night
#

const dbl = new DBL("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3NjE1MTExMTY4MTMxMDczMCIsImJvdCI6dHJ1ZSwiaWF0IjoxNTk1ODA3MDY5fQ.q4s4Fmo8aaMgA3lZ-tcwHotu-------------------", { webhookPort: 5000, webhookAuth: 'password'});

sullen nymph
#

Do you think censoring only the last part of a token is a good idea

whole night
#

can u help me?

jaunty plank
#

are you having an error?
or whats not working

whole night
#

I need to change something in the webhookAuth?

vapid cape
#

what is your webhook configuration in top.gg?

#

in your bot's edit page

whole night
#

can u send a link to the bot's edit page?

vapid cape
#

its your bot's edit page

#

you have the link

valid heath
#

this isnt working

import dbl, discord, cogs
from discord.ext import commands, tasks

import asyncio
import logging


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

    def __init__(self, client):
        self.client = client
        self.token = '<my bot token>'
        self.dblpy = dbl.DBLClient(self.client, self.token)

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        logger.info('Received an upvote')
        print(data)
        print(data["user"])
        channel = self.client.get_channel(id=737102089800515655)
        try:
            u = self.client.get_user(id=int(data["user"]))
        except:
            u = await self.client.fetch_user(id=int(data["user"]))
        await channel.send(f'**{u}** has voted for the bot.')

def setup(client):
    global logger
    logger = logging.getLogger('client')
    client.add_cog(TopGG(client))
whole night
jaunty plank
#

edit

#

bottom of edit

whole night
jaunty plank
#

url would be http://ip:port/whateverpathissetto
the public ip of your bot, port and path you set in setup

#

auth would be webhook auth you set in init

whole night
#

You mean this?

  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});```
vapid cape
#

where is your bot hosted?

whole night
#

It say Webhook running at http://0.0.0.0:5000/dblwebhook

jaunty plank
#

yeah

vapid cape
#

is your bot in a vps?

whole night
#

Yes

jaunty plank
#

just replace 0.0.0.0 with your pub ip.
if your hosting not on a vps, you may need to let your port through

whole night
#

How can I know my public ip?

valid heath
#

this isnt working

import dbl, discord, cogs
from discord.ext import commands, tasks

import asyncio
import logging


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

    def __init__(self, client):
        self.client = client
        self.token = '<my bot token>'
        self.dblpy = dbl.DBLClient(self.client, self.token)

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        logger.info('Received an upvote')
        print(data)
        print(data["user"])
        channel = self.client.get_channel(id=737102089800515655)
        try:
            u = self.client.get_user(id=int(data["user"]))
        except:
            u = await self.client.fetch_user(id=int(data["user"]))
        await channel.send(f'**{u}** has voted for the bot.')

def setup(client):
    global logger
    logger = logging.getLogger('client')
    client.add_cog(TopGG(client))
vapid cape
#

your vps company tells you

#

either in a control panel, or in an email, or whatever

#

when you buy a vps, you get its ip

jaunty plank
#

in order to ssh into a vps, you use the public ip

whole night
#

and I need to put my link there?

jaunty plank
#

yeah, thats the link they push webhooks to

#

then auth is the auth you set

#

webhookAuth: 'password'

vapid cape
#

@valid heath what exactly is not working

whole night
#

where I need to put 'password'

#

?

vapid cape
#

Authorization

#

Authorization (in top.gg) and webhookAuth (in your code) must be the same thing

whole night
jaunty plank
#

probably shouldnt be passwork

#

password

#

kinda easy to guess that

valid heath
#

@vapid cape the data wont print and the bot wont post votes

vapid cape
#

did you read the example?

valid heath
#

yeah

#

i checked it

#

i dont think anything should be wrong

vapid cape
#

you're not using the example

valid heath
#

its paramaters dont match up with my bot

vapid cape
valid heath
#

i dont want a webhook

#

or is it needed?

#

because tehre are examples without them

vapid cape
#

no webhook = no on_dbl_vote

valid heath
#

oh

jaunty plank
#

the examples without webhooks are for posting server count only

whole night
#

and the end of the url should be /dblwebhook?

vapid cape
#

yes

whole night
#

Why when I start the bot it still says Webhook running at http://0.0.0.0:5000/dblwebhook?

#

even tho I changed the 0.0.0.0

jaunty plank
#

0.0.0.0 means all system ip's

#

its hardcoded into the lib

whole night
#

So why its not saying http://myvpsip:5000/dblwebhook ?

jaunty plank
#

its hardcoded into the lib

whole night
#

So what I can do?

jaunty plank
#

nothing, it doesnt matter it says 0.0.0.0

#

because it means, any ip this system has available

#

including your public ip

whole night
#

So why its not console.log when I vote?

#

cause it should console.log(${vote} );

jaunty plank
#

if you have a firewall, you need to let port 5000 through

whole night
#

how?

jaunty plank
#

depends on the firewall

whole night
#

but I have used this port before when I created my web apps in express

#

I used localhost:5000

jaunty plank
#

localhost doesnt need firewalls to have that port open

whole night
#

oh

#

so how I can know my firewall?

jaunty plank
#

generally speaking, you install them yourself.

whole night
jaunty plank
#

o windows

whole night
#

yes lol

jaunty plank
#

your vps is windows?

#

🤔

whole night
#

yes

jaunty plank
#

🤷‍♂️ might work, i dont know windows firewall at all

valid heath
#

no webhook = no on_dbl_vote
@vapid cape I added a webhook, still doesnt work. Code:

import dbl, discord, cogs
from discord.ext import commands, tasks

import asyncio
import logging


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

    def __init__(self, client):
        self.client = client
        self.token = '<token>'
        self.dblpy = dbl.DBLClient(self.client, self.token, webhook_path='https://discordapp.com/api/webhooks/73710970111******/****************', webhook_auth='hello', webhook_port=5000)

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        logger.info('Received an upvote')
        print(data)
        print(data["user"])
        channel = self.client.get_channel(id=737102089800515655)

        try:
            u = self.client.get_user(id=int(data["user"]))
        except:
            u = await self.client.fetch_user(id=int(data["user"]))

def setup(client):
    global logger
    logger = logging.getLogger('client')
    client.add_cog(TopGG(client))
jaunty plank
#

that path

#

lmao

#

your hosting a webhook, not discord

valid heath
#

i know

#

ik

jaunty plank
#

the path would be something like /dblwebhook

#

not a whole url

#

to another webhook

valid heath
#

can you give me an example

jaunty plank
#

sure

#

webhook_path='/dblwebhook'

valid heath
#

so you just write "/dblwebhook"

jaunty plank
#

if thats the path you want yes

#

at the end of your url
which an example of is
http://ip:port/dblwebhook

valid heath
#

self.dblpy = dbl.DBLClient(self.client, self.token, webhook_path='/dblwehook', webhook_auth='hello', webhook_port=5000)

#

like that?

jaunty plank
#

yeah

whole night
#

@jaunty plank I did it

#

I allowed the port

jaunty plank
whole night
#

what now?

jaunty plank
#

should be able to test it, on your bots edit page, very bottom is a test button

valid heath
#

i change the code, it still doesnt work

#

full code:

import dbl, discord, cogs
from discord.ext import commands, tasks

import asyncio
import logging


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

    def __init__(self, client):
        self.client = client
        self.token = '<token>'
        self.dblpy = dbl.DBLClient(self.client, self.token, webhook_path='/dblwehook', webhook_auth='hello', webhook_port=5000)
    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        logger.info('Received an upvote')
        print(data)
        print(data["user"])
        channel = self.client.get_channel(id=737102089800515655)

        try:
            u = self.client.get_user(id=int(data["user"]))
        except:
            u = await self.client.fetch_user(id=int(data["user"]))

def setup(client):
    global logger
    logger = logging.getLogger('client')
    client.add_cog(TopGG(client))
jaunty plank
#

did you update the url on your bots edit page?

#

along with the right auth?

whole night
#

Thankssssssss @jaunty plank ❤️

jaunty plank
#

😻

whole night
#

And another Q, how can I know how many votes there is to the bot?

valid heath
#

@jaunty plank ^

jaunty plank
#

thats a discord webhook

#

your creating a webhook in your code

#

a server, which catches requests

valid heath
#

so what do i put there

jaunty plank
#

http://pubipofyourbot:port/dblwebhook

valid heath
#

oh god

#

how do i find the ip

#

is it my own IP?

jaunty plank
#

you host on a VPS?

valid heath
#

its not hosted yet im hosting it when its done

#

i do have a host tho

jaunty plank
#

yeah, itll be the public ip of that host.
if your temp hosting it on your home network, itll be your home public ip(google "whats my ip")