#topgg-api

1 messages · Page 148 of 1

spark raven
#

so it wont work

#

right?

#

...

sullen nymph
#

Correct

spark raven
#

ok

#

good

solid crest
#

yes

#

to my devices ip

vast phoenix
#

which line in the docs is the vote tracking? (py)

oak sinew
#

Why top.gg is sending multiples post for 1 vote of 1 person?

night ingot
#

You need to reply with a 2xx HTTP response

#

otherwise it's going to re-try about 10 times

oak sinew
#

okay thanks :D

trail anchor
#

@rain heart Using the API you provided me, I'm having issues initiating the listener. How can I fix a null ip address?

trail anchor
rain heart
#

0.0.0.0 means being able to connect through everywhere

#

Iike localhost, public ip address, domain

#

In other words, not bound to any ip

#

@trail anchor

#

Sorry for the late response tho

gusty thorn
trail anchor
#

The port is open and I see the requests coming into my router and being sent to the correct machine on the LAN

vast moat
#

Can anyone tell me what are the data we get when someone votes for the server?

#

I mean json data

rain heart
trail anchor
#

Yes

#

I think

rain heart
#

how are you testing it?

trail anchor
rain heart
#

authorization is correct too?

trail anchor
#

Yes

rain heart
#

otherwise add the IGNORE_AUTHORIZATION and IGNORE_VALIDATION at the addBotListener

#

because normally it wouldn't fire the event when it isn't authorized (not correct authorization) or not valid (not the correct json format mentioned on the top.gg docs)

trail anchor
#

It's authed

rain heart
#

see if you're at least receiving anything

trail anchor
#

I will add the options

rain heart
#

i assume you also have started the webhook server using start() on the Webhook after using build()

trail anchor
rain heart
#

yeah correct version

#

and the listener class is correct too? have a simple debug line on the onWebhookRequest method

trail anchor
#

Also, I added both options and still no event

rain heart
#

just a simple System.out.println("test"); to see if it gets fired

trail anchor
#

Yeag

rain heart
#

dm me your webhook url and authorization if you're comfortable with it, so i can make a test request from my end

#

have you also pressed save before testing?

trail anchor
trail anchor
#

Come on bro :/

rain heart
#

I'm sorry KEKW i forget that multiple times

trail anchor
rain heart
#

@trail anchor not getting any response from my end, are you sure it's running and possibly portforwarded if using it on a local network?

trail anchor
#

Positive

#

Just telnet the port?

broken tulip
#

How do you use easy application bot

rain heart
abstract mothBOT
#

@broken tulip

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

broken tulip
#

Hope

rain heart
broken tulip
#

Do u know how to use any application bot

rain heart
#

just times out

rain heart
trail anchor
#

oh duh

#

I set the WAN to only the one provided on the docs page

#

lemme open that up for you

#

@rain heart Should be good now

rain heart
#

and what's the context of the webhook? The value you have entered on the first parameter?

#

of the addBotListener

trail anchor
#

GuildWebhook

rain heart
#

went through

trail anchor
#

I got it

rain heart
#

have you added /GuildWebhook to the end of the url?

trail anchor
rain heart
#

yeah that's the validation issue

#

one sec

#

yeah says null because your bot doesn't have me cached and/or can't find me

#

just print out the user ID for testing

#

should be 669452973755072524

trail anchor
#

rebuilding

#

still building, lol

#

Ready

rain heart
#

got it?

trail anchor
#

Fully, yeah

rain heart
#

any errors?

trail anchor
#

None besides finding you by ID in the server

rain heart
#

still worried about the validation error though, can you print out the data by using BotWebhookEvent#getRequestString() received by the webhook?

trail anchor
#

Ready

rain heart
#

yeah that's correct

#

remove both options again and see if it works/still fires

trail anchor
#

Ready

rain heart
#

sent

trail anchor
#

Nothing

rain heart
#

weird, one sec

#

are you still using the getUserById() method on the onWebhookRequest ?

trail anchor
#

No

#
eb.setTitle("Wow! A Vote for our Server!")
            .setDescription(voteData.getUserID() /*botInstance.getJda().getUserById(voteData.getUserID()).getAsMention()*/ + " [TESTING] just voted for ...yadadadada")
            .setColor(new Color(255, 0, 0));
rain heart
#

replace your current addBotListener with

addBotListener("test", event -> System.out.println("test"), "auth");
#

really weird why it doesn't work

trail anchor
#

Those exact values?

#

No actual auth?

rain heart
#

the auth is there

#

just a lambda for testing

#

to just print out "test"

#

oh wait

#

i see the issue

#

you're using a GuildWebhook

trail anchor
#

yes?

rain heart
#

are you trying to receive one for a bot or a server?

trail anchor
#

For a server

rain heart
#

oh my bad then, one sec

#

did you get anything this time?

trail anchor
#

Ready, just finished build

rain heart
#

now?

#

wait I'm making the request to my local one

#

liol

trail anchor
#

Got it

#

wait

#

no lol

#

Can't read

rain heart
#

still nothing?

trail anchor
#

still nothing

rain heart
#

debugging time, probably an issue with my code, my bad

trail anchor
#

all good

vast moat
#

Can Someone tell me how can I get the user object using discord.py

#

that the webhooks send me

rain heart
#

@trail anchor can't really find what's wrong, tested the guild webhooks, works perfectly with test data

trail anchor
#

Would having the entirety of both classes help?

rain heart
#

yes that would help, otherwise i could send you a test version of the topggwebhooks4j with a bunch of test stuff

restive otter
restive otter
#

Well, you mentioned discord.py so you must have access to the Client object. It doesn't have to be Client, its subclasses also work.

vast moat
restive otter
#

Threading, though just use the official sdk.

vast moat
#

sdk?

restive otter
#

I need help adding mee6 bot to my server. Any help?

vast moat
restive otter
#

Ahh mb

night matrix
#

So I noticed that isWeekend is true for votes currently, despite it being Friday in every timezone currently - What is the actual time-window for isWeekend?

rain heart
#

Friday-Sunday is considered weekends

dawn solar
rain heart
#

nope can't help with it

dawn solar
#

Ok, I wrote all the code for it, enabled port forwarding and put the webhook details into top.gg but it still didn't work and did nothing when anyone voted

rain heart
#

@restive otter please don't advertise

#

thanks

upbeat imp
#

Someone’s looking for a mute aeyes

rain heart
#

oh wow

#

ok

#

-b 513778925034274863

abstract mothBOT
#

dblMod Banned dream killer#3012 (@rocky nest)

upbeat imp
#

😂

cosmic gyro
#

how generate api token?

rain heart
#

bot page settings -> webhooks

cosmic gyro
#

thanks

restive otter
#

How to use the api?

rain heart
restive otter
#

Ty

restive otter
#

Whats the package name?

#

To npm i

#

?

rain heart
#

should be mentioned on the docs

restive otter
#

Okay

vast moat
#

Can someone tell me what I did wrong here?

#

I am not getting the test webhook request

night ingot
#

Is the port that you specified open?

vast moat
#

I was got test responce for like 2 times

#

But after that I am not getting any

vital rain
#

How can i make it so if someone votes my bot, this event takes place
db.set(`${vote.user}`, 1)

frigid urchin
#

how do i make the webhook for the bot

vast moat
#

Someone told me

frigid urchin
#

wait but where do i get the link for the webhook from?

willow spindle
#

thats not how that works

vast moat
willow spindle
#

you need a webserver for receiving requests from top.gg. You can use official libraries if you want

vast moat
#

I guess

frigid urchin
#

wait so then how does it work if i want to use the webhook to find out if someone voted for my bot

frigid urchin
vast moat
#

So you need to put something
that listenes to top.gg Post request

frigid urchin
#

oh ok

vast moat
#

that listenes to top.gg Post request

frigid urchin
#

what about discordbotlist

vast moat
willow spindle
#

ask discordbotlist

vast moat
#

and I highly dought that I saw something like that

willow spindle
vast moat
willow spindle
#

really

#

how

vast moat
#

And Also their api is hard

vast moat
#

O lol I never really thought of seeing their server then

frigid urchin
willow spindle
#

this is not our problem, sorry

frigid urchin
#

yeah but the api is similar enough right

rain heart
#

Top-gg != Discordbotlist

frigid urchin
#

i know

#

but anyway i also submitted my bot here

rain heart
#

Nothing similar at all, nor will anyone help you with api related things from there

#

Your bot needs to be approved first

frigid urchin
#

so hopefully if its approved ill need to know how to use this api

wintry oracle
rain heart
#

apollo indeed

wintry oracle
#

nice

supple karma
#

can anyone help me Setting up webhooks ? i am not understanding the auth thing

quasi raptor
#

Sa

vast moat
supple karma
#

who is doing the post request ? me or them

rain heart
supple karma
#

yes so what exactly i have to do ?

frigid urchin
#
import requests, json, asyncio, time
from flask import Flask, request, Response
from threading import Thread

app = Flask(__name__)

@app.route('/webhook', methods=['POST'])
def response():
    print(request.headers.get('authorization'))
    if request.headers.get('authorization') == "a":
        print(request.json)
        '''asyncio.set_event_loop(asyncio.new_event_loop)
        loop = asyncio.get_event_loop()
        loop.run_until_complete(discord_webhook(requst.json))'''
        return Response(status=200)

def run():
    app.run(host='0.0.0.0',port=8080)

t = Thread(target=run)
t.start()
#

for some reason the webhook wont send the json data

frigid urchin
#

oh

#

so i should just call run?

vast moat
#

I just learned and did it today

#

So I am pretty fresh

frigid urchin
#

its still not sending the json data

hardy remnant
#

is anyone have good tutorial to send random memes from reddit via custom api?

frigid urchin
vast moat
frigid urchin
#

yeah so what am i doing wrong

vast moat
#

And remember gou set the auth correctly

#

And you have a open port

#

@frigid urchin

frigid urchin
#

yeah i have an open port and the auth works

#

well i think it does

vast moat
#

Remove the auth and try once

frigid urchin
#

but basically if i put a print statement right after declaring response response doesn't send the print statement

vast moat
#

Using test

hardy remnant
frigid urchin
#

still not working

frigid urchin
#

idk how then

hardy remnant
vast moat
frigid urchin
#

wait i thought it was post for webhooks

#

its still not working with get

vast moat
frigid urchin
#

oh

#

can u send me ur code pls

vast moat
#

Wait let me give you mine

frigid urchin
#

ok thx

hardy remnant
#

does have anyone open-source api? XD

frigid urchin
#

wait so ur able to get the member who voted from ur webhook right

frigid urchin
vast moat
#

@frigid urchin

frigid urchin
#

ok

vast moat
#

Here

frigid urchin
#

thx

vast moat
#

Me on phone

#

So please don't kill me

#

Electricity went down here

#

Currently power cut

#

Though i shouldn't show you my auth

frigid urchin
#

wait where did u learn how to do this

#

@vast moat

vast moat
#

I learned just how to recieve post request

#

With headers

frigid urchin
#

oh

#

wow

#

th

#

x

#

ill read them ig

vast moat
#

You can also use python sdk

frigid urchin
#

oh

vast moat
#

But for me thats confusing

frigid urchin
#

oh ok

vast moat
#

As i don't have a bot object

frigid urchin
#

oh

#

i gtg now cya

#

thx for ur help

wanton sluice
#

how to create in js the api thing i need to add server count any help

scarlet cobalt
#

One message removed from a suspended account.

sullen nymph
#

Could literally run 2 webservers where one would be the middleman iara_sleep_nap_tired

frigid urchin
#

wait im so confused why its still not working

#

it works perfectly fine on requestbin

#

heres the code

#

for some reason hello doesn't even get printed

#

so i don't think the error is in response

#

but ive looked at other examples and theirs works even though they do the same thing

night ingot
#

Are you sure you entered the correct url in the edit page?

frigid urchin
#

yeah i did

restive otter
young rapids
#

opps

#

sry

restive venture
#

Hey guys I am new

jovial kiln
#

Welcome

#

Do you need help with something?

#

oh that was 5 hours ago

#

oops

sullen nymph
restive otter
#

How to make a Bot?

keen seal
#

If a bot is not yet approved by Top.gg, can you still attach and operate a webhook with Top.gg? Getting an error "there was a problem saving the webhook

#

Thank you

restive otter
#

What is a http header?

lucid drift
# restive otter What is a http header?

headers are additional information sent to the api,
such as the token,
and yes thats the token, you need to send it with your request so the site can verify that you are the one sending the requests

#

depending on the language you are using, and http library, you can easily search how to add headers to your request

restive otter
#

Ok, i'll try thanks

rain heart
#

-b 781727349431205919 ads in multiple channels

abstract mothBOT
#

dblMod Banned sunny_$#0398 (@analog sigil)

normal oriole
#

Oh, sorry for ping ;-;

rain heart
#

all good

restive otter
#

I'm a bit confused with this authorization thing

#

The autoposter is working

#

But where exactly am i supposed to put the top.gg id?

#

I put it here

#

this isn't doing anything

#

and this gives me the 401 not authorized error

frigid urchin
acoustic lark
#

Do I need to changed the self.bot = bot?

#

The 'DBL_TOKEN' is a variable

night ingot
#

Why would you need to change that?

sick perch
#

Where does the notification arrive that the bot has been approved? Or not

acoustic lark
#

idk just that I thought maybe to ur bots name, bc I can't get the API to work and I have no clue why

night ingot
sick perch
night ingot
#

and you don't actually have 'DBL_TOKEN' as the value

acoustic lark
#

I have made a variable called DBL_TOKEN so I done DBL_TOKEN=<my bots token>

rain heart
#

you're defining it as a string

acoustic lark
#

yeah

rain heart
#

not a variable

night ingot
#

You're setting your token to literally 'DBL_TOKEN', not the variable

#

Remove the quotation marks

rain heart
#

exactly

acoustic lark
#

Sorry I put DBL_TOKEN=<'my bots token'>

rain heart
#

that's not what we're referring to

acoustic lark
#

I passed it through as a string

#

oh sorry

night ingot
#

Yes, but your self.token is not defined correctly

acoustic lark
#

kk

night ingot
#

you're setting that to a string too

acoustic lark
#

So make that DBL_TOKEN not 'DBL_TOKEN'

night ingot
#

If that's your variable's name, yes

acoustic lark
#

Okay thanks

rain heart
#

DBLTOKEN = 'DBL123'

print(DBLTOKEN) # Print the DBLTOKEN variable
print('DBLTOKEN') # Literally print "DBLTOKEN"
#

is what you're doing

#

you need the top one, not the bottom one

acoustic lark
rain heart
#

correct

acoustic lark
#

Okay ty

acoustic lark
#

It is not working, not sure why I will double check that My variable is working

rain heart
#

check for errors

#

check that you're properly calling it

acoustic lark
#

There are no errors

#

Is this all I need for the server count?

night ingot
#

That should be all

#

You need a @commands.Cog.listener() decorator over the on_guild_post event for that to print anything though

acoustic lark
#

kk I will add that now

night ingot
#

That will only make sure it prints anything though

acoustic lark
#

Like this right?

night ingot
#

Mhm

acoustic lark
#

Will I need to do

`@frail rapidss.Cog.listener():
async def on_guild_post()
  print("Server count posted successfully")`
night ingot
#

That's not how it works, no

acoustic lark
#

Without the @ and the ID on it just @ commmands

night ingot
#

just @commands

#

literally @commands

acoustic lark
#

like this?

night ingot
#

Yes

#

no

#

remove the :

#

and put it after the method

acoustic lark
#

So on this

night ingot
#

yes

#

like you had it in the first screenshot

acoustic lark
#

Okay ty

acoustic lark
#

Not working still no errors

night ingot
#

And you're sure the dbl token is correct?

acoustic lark
#

What imports do I need just DBL

#

dbl*

night ingot
#

Yeah

acoustic lark
#

Do I need to import discord if not I will check on a different coding IDE

night ingot
#

If there were missing imports you would have gotten an error

acoustic lark
#

true

vast moat
#

Can someone tell me why am I not getting a post request from this?

acoustic lark
#

Just made this in pycharm should this work, My discord bot is not coded on pycharm

vast moat
#

I am not getting the post request for bot

night ingot
#

Well as you can see that's not going to run since you haven't imported commands from discord.ext

vast moat
#

but getting it for server

#

In webhooks

acoustic lark
#

kk thanks

vast moat
#

Can someone tell what am I doing wrong?

#

Does they work the same?

#

Here is the code

vast moat
#

From docs this is the webhook path then what will be the full path

night ingot
#

The full path is
http://<your public ip>:<port>/dblwebhook

#

or if you're hosting on a server, the public ip of that server

vast moat
#

okay

#

That means I have to find out the public ip of heroku

vast moat
#

??

#

Like I can get a Post request for server votes

#

With flask

frigid urchin
#

how would i make it so that i send the user a message that they have been given the reward for voting

vast moat
#

but the same app is not getting the test post request for bots

frigid urchin
#

and i wanna be able to trigger this function from another function

night ingot
frigid urchin
#

hi bartick

vast moat
vast moat
night ingot
acoustic lark
#

Will this work I some removed some of the code bc it was erroring in pycharm

vast moat
#

it will

#

I am also doing the same

#

I mean just did

#

And it updated my guild count

acoustic lark
#

Okay thanks

vast moat
#

@night ingot Sorry for the ping though. But I figured it out. The Test vote (webhook test) for bots is not working. But the normal vote is working just fine

#

And Do you know why the bot vote counter not increasing?

night ingot
#

Probably just takes a while to update

vast moat
#

okay

acoustic lark
#

What does the webhooks do?

#

Okay thanks

acoustic lark
#

Still not working my API

#

I reset it

#

I am tryna post my guild count

#

okay ty

sullen nymph
#

Did you load the cog

acoustic lark
#

I removed it (in pycharm) bc It was erroring but on repl.it I loaded the cog, I tested if it was just repl.it playing up and made it in pycharm but still not working

#

As in i removed it in the @ commandss.Cog.listener()
async def on_guild_post():
print("Server count posted successfully")

thorn gate
#

hi um whenever someone votes my bot on top.gg, the webhook is getting recieved multiple times... i tried resetting the webhook secret and checking other stuff and it doesnt seem to work...

night ingot
acoustic lark
#

Have u made the webhook more than once?

night ingot
thorn gate
#

oh ok thanks

acoustic lark
#

API still not working.

#

No errors either

#

does urs look like this?

night ingot
#

Are you loading that cog?

acoustic lark
#

As in the class topGG(commands.cog)

night ingot
#

No as in, are you loading the cog from your main file?

acoustic lark
#

Not 100% sure wut u mean new to coding?

#

Ima try It passing it my DBL token through as just the token

#

So <'my dbl token'<

night ingot
#

Add a print in the setup method so you can make sure the cog actually gets loaded

acoustic lark
#

Okay

#

like this right?

night ingot
#

yes

acoustic lark
#

Should It show once I boot up the program?

night ingot
#

That should print when you start your bot, yes

acoustic lark
#

No it has not, must not be loading.

#

Should I re-enter the API and see if that works?

night ingot
#

What? no, if your cog isn't loading, nothing you do in that cog's file is going to change anything

acoustic lark
#

oh kk

#

Any way to make it load? (the cog)

night ingot
acoustic lark
#

will do

#

Will I need to do something in the cogs files?

topaz axle
#

does anyone know how I will be able to use a voting webhook with Discord.JS sharding? it seems it requires a Client object to use a dbl webhook, but I can't use a client with more than 2500 guilds in my main index.js file...

frigid urchin
#
#Host the webserver to recieve the info about users that voted for Bubble
app = Flask('')

@app.route('/webhook', methods=['GET', 'POST', 'OPTIONS'])
def response():
    global usersVoted
    if request.headers.get('authorization') == "12619611":
        self.giveVoteReward(request.json["id"])
        return Response(status=200)

def giveVoteReward(self, userID):
    global economyCol
    economyCol.update_one({"_id" : userID}, {"$inc" : {"balance": 1000}})
    print("success")

app.run(host='0.0.0.0', port=8080, debug = True)
#

error: No module named economy

#

this is outside a class but the file has a class named economy

#

could someone pls help

kind path
#

hi, i've created a webhook integration into my server and set the url into top.gg page, now how can i get a message every time someone votes?

#

ye is it
i tried but i didn't got any message

#

wait i actually got it

#

but it shows.. weird af

#

right

#

nvm i'm dumb

#

^^

cold root
#

hey

#

ummm

#

in the place

#

http:// 0.0.0.0 :19132/dblwebhook

#

wait nvm

#

wait

#

WAIT

#

I NEED HELP

#

why does it say 0.0.0.0 at that place, and not my ip or smth?

solid crest
#

ok so i think i have some trouble with opening my port
so in the router settings (check ss below) i set up my port forwarding with my public ipv4 first. This gave error message:
Intranet IP address and LAN IP must be in the same network segment
I contacted some other ppl and they said i needed to take my computers private ip address (so a 192.xxx.x.xxx)
I did and opened the port on the local ip, as you can see on the photo
In the top.gg webhook page i use my ipv4 ip
still nothing comes through and doesnt print the data, anyone that can help?

i checked 10 times if its being forwarded to my correct device, still nothing. my router just doesnt want to open the port, any ideas?

https://cdn.discordapp.com/attachments/782034872830918666/832352329725378610/unknown.png

solid crest
#

ping me if you reply, gonna go offline for now so i can check mentions later

thorn dawn
#

Also how do I use the top.gg vote api

#

It's very confusing

night ingot
#

Which part confuses you?

thorn dawn
#

And the code too

night ingot
#

The entire thing?

thorn dawn
#

Yea

#

It always confuse me when I looked at it

keen seal
#

Does anyone know of a way to get a free endpoint for webhooks without exposing localhost?

night ingot
#

You won't be able to receive webhooks without opening up your network to them, no

thorn dawn
#

Anyone kind enough to explain me the voting part on the docs?

night ingot
#

Pretty sure no one is going to explain the entire thing, it's better if you ask more specific questions

thorn dawn
#

Also how do I make a webhook which checks that

night ingot
thorn dawn
night ingot
#

yes

#

and :yourbotid to your bot's ID

thorn dawn
#

:o

#

ooooh

#

But how do I add something when user votes

night ingot
#

What language are you using?

thorn dawn
#

Python

#

\🐍

night ingot
thorn dawn
#

Still confused

kind path
# thorn dawn Still confused

a fast way can be, into the webhook url on top.gg, you can place http://yourvpsip:7000/dblwebhook, and in the code you can use ```py
dbl_token = 'your-token'
bot.dblpy = dbl.DBLClient(bot, dbl_token, webhook_path='/dblwebhook', webhook_auth='your-auth-password', webhook_port=7000) #webhook_port is the number you have set into the url

#

it return json, so on the on_dbl_vote event you can use the data thing to get what u need, as like the username of who has voted (it returns the member ID, so you need to use fetch_user or get_user to get the username)

#

and to give it a reward.. idk, if you have a db, do stuff with your db in the on_dbl_vote event, ez

restive otter
#

Where do u get the top.gg token?

rain heart
#

read pins

restive otter
#

oh ok ty

topaz axle
#

anyone know how to show the correct server count on top.gg after implementing sharding in Discord.JS?

frail shale
#

do anyone know how to disable or set top.gg webhook not to retry if the server didn't return status code 2XX

#

cuz i don't really know how to handle the thing

#

like return 2XX status code

rain heart
#

you have to return 2xx yourself

#

if you don't, it will continuously retry

#

you can just do response.code(200) no?

vagrant mountain
#

What should i do now?

rain heart
topaz axle
spark raven
#

sorry

solid crest
#
    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        print("Received a test upvote:", "\n", data, sep="")

doesn't work i setup everything correctly in the top.gg webhook page, in my code and my port is open (i check via an online port checker for double check


    def __init__(self, bot):
        self.bot = bot
        self.token = 'MyRealToken'
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/dblwebhook', webhook_port=5555)

still nothing

#

and if i type in the ip with port and webhook path i get returned this (in browser):
405: Method Not Allowed

topaz axle
#

How do I post my server count to top.gg whilst using sharding? Right now it just displays the server count of one of my shards, not the total number of servers.

wide wigeon
#

using the webhook code provided

const Topgg = require('@top-gg/sdk');
const express = require('express');
const app = express();
const webhook = new Topgg.Webhook(topggauth);
app.post("/dblwebhook", webhook.middleware(), (req, res) =>
{
    console.log(req.vote.user);
});
app.listen(1030);

doesn't work.

  • console isn't logging anything
  • port 1030 is open
  • my ip is public
  • canyouseeme.org can make a connection to my ip with port 1030
  • listener is listening, shows up on Resource Monitor
  • Wireshark isn't picking up anything

What am i doing wrong? thinkok

  • Whitelisting port/topgg ip doesn't seem to change outcome
frail shale
rain heart
#

I don't code in js, that's my assumption

frail shale
#

o

#

oops it does not work any other solution ?

#

ahhh its working well last time but dk why dbl added retry function

granite turtle
#

Hello, Does Bot with other language (Not English) is allowed?

gusty hamlet
#

yes

jaunty steppe
#

Out of curiousity, why is the ratelimit retry_after an hour? isn't that a bit excessive?

rain heart
#

because the decision was made to have ratelimiting blocks an hour long

#

as long as you're not hitting ratelimits, you should be fine

jaunty steppe
#

Fair enough

jaunty plank
#

It's also pretty easy to avoid hitting ratelimits. Huge bots use the api and don't hit them.

jaunty plank
cold root
#

hey

#

I got this

#
dbl.on('posted', () => {
  console.log('Server count posted!');
})```
#

But its not responding.

#

(ping me when replying to me.)

jaunty plank
cold root
#

auth?

#

ummm

#

I think

#

is it the place where says webhook

#

and needs URL and password thing?

jaunty plank
#

Yep

#

Otherwise how will the webhook know where to send to?

cold root
#

ya I did fill it up...

cold root
jaunty plank
#

That's your code, the website doesn't know where to send it to.

cold root
#

yes it does tho.... I filed up the form and everything

#

the webhook url

#

port

#

host name

jaunty plank
#

Ok, where are you hosting? A vps? Home? Nat server?

cold root
#

my computer

#

But soon it will change, but not now...

jaunty plank
#

You'll need to port forward

cold root
#

I did...

#

I got it setted up

#

Thats what portTopgg is

#
const portTopgg = config.json```
#

and then in config.json its

#
"portTopgg" : "xxxx"```
jaunty plank
#

That's not port forwarding.

cold root
#

no

#

no no n ono no

#

I already know

#

I portforwared that port @jaunty plank

#

on my router thing

jaunty plank
#

Try using postman to it.

cold root
#

whats that

jaunty plank
#

Yeah. Let's you make your own requests.

cold root
#

o

#

alright, thanks

#

idk how to use it..

frigid urchin
#

what does it mean by no module named economy?

#

this is in a cog

#

wait is it becuz i set debug to true

#

dude i tested it without the debug

#

and it worked lol

solid crest
#
    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        print("Received a test upvote:", "\n", data, sep="")

doesn't work i setup everything correctly in the top.gg webhook page, in my code and my port is open (i check via an online port checker for double check


    def __init__(self, bot):
        self.bot = bot
        self.token = 'MyRealToken'
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/dblwebhook', webhook_port=5555)

still nothing

dusk roost
#

not sure if this is related to the other webhook problems but..
trying to use the 'test webhook' feature, wasnt receiving the web hook (ip/port exposed via ngrok tunnel), although it did work fine via a manual post request via postman

went ahead and tried to see if it was just a networking problem on my side, used https://webhook.site/ to generate a unique url for capturing requests. once again, a manual POST request with postman worked fine, but the 'test webhook' button didnt see any results

is there an outage right now?

untold apex
#

The vote webhook works for me, but the authorization value I specified isn't sent with the request. Is this broken? (I did save it properly)

dusk roost
#

are you talking about the test webhook, or the live one?

untold apex
#

The test one

#

I haven't used the live one yet

dusk roost
#

weird..

untold apex
#

I just started trying it out

#

I'd like to use the authorization for security, but I guess it'll work without for now

dusk roost
#

ok weird

#

its working now

untold apex
#

But would be amazing if someone could help me

dusk roost
#

@untold apex are you checking the headers?

#

or the body

untold apex
#

But it's in neither

#

These are the headers and raw headers that come with the request

dusk roost
#

i dont see it in my test webhook either

untold apex
#

Do you receive it in the live one?

#

Oh no nevermind

#

I guess I'm blind

#

It's in the raw headers

#

also the normal one

#

Ok then nevermind

#

It took it's sweet time setting the value then

#

Thank you for your help though!

#

(it didn't work a minute ago)

dusk roost
#

just started appearing for me now too

#

LOL

untold apex
#

xD

dusk roost
#

¯_(ツ)_/¯

untold apex
#

indeed ¯_(ツ)_/¯

hardy karma
#

using the webhook feature, is there any way to get an automatic message posted in a channel when the bot gets upvoted?

#

i know that discord has the built-in <webhook>/github to handle github webhooks; is there something similar for top.gg?

vernal trench
#

uh is there a way to fix this in url
{"error":"Unauthorized"}

untold apex
untold apex
dusk roost
#

is the cooldown between votes exactly every 12 hours? or is it every 12th hour of the day, e.g 12am, 12pm?

balmy hamlet
#

every 12 hours

dull thicket
#

Can I use top.gg to provide stats for my website? I just want to get the server count? Is there like a public api I can use so I can have some js get the server count of my bot?

night ingot
#

Top.gg doesn't have your server count

#

You provide that yourself through your bot

#

But if you for some reason want to get the servercount from Top.gg's site you can use the API
https://www.top.gg/api//bots/:yourbotid should have a field called "server_count"

#

But that obviously won't work if you don't post your stats through the API first

#

And it only updates every 30 minutes

solid crest
#

what exactly is the webhook url
Is it the http://yourip:openport/dblwebhook
?

#

i opened that port too btw

night ingot
#

That should be it, yes

#

If you set /dblwebhook as the path in your code

solid crest
#

yeah but i dont receive test webhooks, maybe i did something wrong?

night ingot
#

Are you sure the port is actually open?

solid crest
#

yeah i checked with an online port checker too

night ingot
#

Would you be able to show your code?

solid crest
#

ok give me a second

#

the full code?

night ingot
#

The code of your webhook listener

jaunty plank
#

Without the auth and token

night ingot
#

^^

solid crest
#
import discord
import asyncio
import dbl
import logging

from discord.ext import commands, tasks


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

    def __init__(self, bot):
        self.bot = bot
        self.token = 'token'
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/dblwebhook', webhook_port=5555)

  
    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print("received an upvote")
        print(data)

    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        print("Received a test upvote:", "\n", data, sep="")

def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(Vote(bot))
night ingot
#

Yeah that looks right

solid crest
#

doesnt print anything on my console

#

the blurred is my public ip

night ingot
#

I assume you've also hit "save" after you entered that?

solid crest
#

yup

night ingot
#

Hmm, okay

solid crest
#

also

#

if i fill in the webhok url in browser i see this

#

405: Method Not Allowed

night ingot
#

Well, then you know the webhook url is right at least

#

Does it print anything if you actually vote for the bot?

solid crest
#

nope

#

in that cog i have a "vote" command and that works

#

cog is loaded in perfectly

#

and no errors in console

#

double checked the token, correct too so ehh

#

also, the auto guild count update works

frigid urchin
#

this happens with my webhook

#

code:

app = Flask('')

@app.route('/')
def home():
    return "I bet you are here since you want to invite Bubble to your Discord server."

@app.route('/webhook', methods=['GET', 'POST', 'OPTIONS'])
def response():
    try:
        if request.headers.get('authorization') == "12619611":
            giveVoteReward(request.json["id"])
            return Response(status=200)
    except:
        print("An error occured with the webhook")

def giveVoteReward(userID):
    global economyCol
    economyCol.update_one({"_id" : userID}, {"$inc" : {"balance": 1000}})
    print("success")

def run():
    app.run(host='0.0.0.0',port=8080)

def keep_alive():
    t = threading.Thread(target=run)
    t.start()
dusk roost
#

spent a good hour or so because of that earlier

solid crest
#

i mean that is not the case tho, cus the code doesnt work still, but my port is open and checked that and the webhook address is correct too

dusk roost
#

not in your case, just something that happpened to be and possibly another guy earlier :p

solid crest
#

yeah yeah

#

do you maybe know what the problem is in my case?

frigid urchin
#

it was cuz i was tryna run the function i made but since i was testing it wasn't working properly cuz it wasn't sending a user lol

dusk roost
#

also, are you sure thats a public ip address

weak drift
#

my friend wants to know if you can check if a user has voted for a server instead of a bot.

main prairie
#

hi, when sharding with my bot, how would I update the autoposter and vote listener for top.gg, if anything even needs updating?

solid crest
#

and yes

solid crest
#

copy pasted the ip from there

dusk roost
#

Can you try sending a mock post request to it

solid crest
#

how do u do it?

weak drift
#

does anyone know if you can check if a user has voted for a server instead of a bot.

solid crest
#

ye just fill the webhook in ur server im guessing?

sullen nymph
frigid urchin
#

Wdym I am

#

Oh well the try statement doesnt really matter it's just in case of error

sullen nymph
#

Yeah and in case of error guess what happens

#

You don't respond

#

Because an issue is occurring

#

Probably

frigid urchin
#

oh wow its that important?

empty peak
#

Is there an endpoint for the last 1,000 votes for a server like there is for bots

wide wigeon
#

can anyone help me with webhooks? they still arent working for me

blazing hound
wide wigeon
#

your listener is listening but webhook's not showing up?

#

yeah

#

i dont get it either lmao

restive otter
#

i am having problems with the api it was working just fine and correctly before but now its just not

obtuse roost
#

I can't use this ! Can anyone assist me please.

rain heart
obtuse roost
rain heart
#

Post your code and what your attempts were, then wait

obtuse roost
#

Okay !

#
import discord,dbl
from discord.ext import commands

class TopGG(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.token = 'my_token' 
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/dblwebhook', webhook_auth='MyTestPassword', webhook_port=5000)

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

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

    @commands.Cog.listener()
    async def on_dbl_test(data):
        print(f"Received a test upvote:\n{data}")

def setup(bot):
    bot.add_cog(TopGG(bot))
    print("TopGG Loaded ! ")
#

And on bot page :

Webhook Url : "https://discord.com/api/webhooks/833565640379334697/mqJKmFDHgTTJV7slMuX8tzMu-DCptXR6xatlq_hbvpxWqUTnxNgdqh57XLYVe7f73WAX"

Auth : MyTestPassword
#

@rain heart

rain heart
#

You cannot use discord webhooks

#

Discord webhook is not a webhook you need

obtuse roost
#

then

rain heart
#

http://yourip:port/dblwebhook

obtuse roost
#

Local IP ?

rain heart
#

No

#

Public ip, for top.gg to make a request to

obtuse roost
#

I have hosting my bot on heroku.com and replit SweeT_Sharmai where did i find that public ip.

#

@rain heart

rain heart
#

can't help with that

#

never used it

obtuse roost
#

Is it same with server page ?

obtuse roost
rain heart
#

?

#

is what same?

obtuse roost
#

I need to use https://myip:port/dblwebhook/ for server voting logs.

#

or can use discord webhook url.

rain heart
#

you cannot use a discord webhook

#

again

#

you need to host a webhook yourself

#

the code you're using is supposed to handle these requests going into your webhook for you to reward users, have logs etc

#

Which is why it's obvious you should use your own webhook url than discord's, as you want to receive them, not discord

solid crest
#

i have a webhook host myself (just openened my port on my router checked if its open)

#

and i have it in top.gg as http://myip:port/dblwebhook/

#

and in code it is k

#

but i don't get the requests

rain heart
#

not https

#

http

solid crest
#

yeye sorry

#

i have that

#

still nothing

#

for my code ^^

rain heart
#

Use postman to test it

#

What's the IP you're using? It cannot be 0.0.0.0 or localhost or 127.0.0.1

solid crest
#

yeah i filled in my browser and i get this then: 405: Method Not Allowed

solid crest
rain heart
#

You cannot make a GET request to it

#

Use Postman to make a post request

#

As you're POSTing data to it

solid crest
#

how can i make a post request?

rain heart
#

Use postman or reqbin

#

Reqbin is self explanatory

solid crest
#

via reqbin

rain heart
#

What could "unauthorized" tell you

solid crest
#

that it cannot connect hmm

rain heart
#

unauthorized

#

Let that go through your head

#

Then think how you could fix that

#

I can (partially) guarantee you your webhook kinda works though, just you bit confused with authorizing

solid crest
#

ill see again thank you

devout sparrow
#

hey, how can I get my bot vote thing

#

as in when someone votes they get smth

#

got it

warped lance
#

How can i get votes?

junior lintel
warped lance
#

I DONT UNDERSTAND

junior lintel
#

What do you not understand?

rain heart
#

Fully read the docs

solid crest
rain heart
#

Authorization is what authorizes a request, add a Authorization header on reqbin with your webhook auth

junior lintel
junior lintel
#

Okay.

#

You might still be able to make some sense of it by looking at the example

warped lance
#

WHat is my express app?

solid crest
#

ook so i checked right,
i have my webhook authorization (on top.gg) set to my lets say for example "code"
in my code i passed in the self.dblpy the webhook_auth="code"
but still doesnt work tho
in the reqbin i added in the header
{"authorization" : "code"}
same error

warped lance
#

I use js

rain heart
warped lance
#

How to use vote in discord.js

solid crest
#

the blurred is always my public ip and is everywhere the same ^^

warped lance
#

HELP ME I DONT NOW HOW TO GET VOTES

sharp totem
#
import dbl
import discord
from discord.ext import commands, tasks
import os
import asyncio
import logging

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

    def __init__(self, bot):
        self.bot = bot
        self.token = "my_token"
        self.dbl_auth = "auth_code"
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth=self.dbl_auth, webhook_port=5000)

    @tasks.loop(minutes=30.0)
    async def update_stats(self):
        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))
        finally:
          print("guild post attempt done")

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

Hey guys, I wanna know 2 things:

  1. How the use of logger affects my code! Is is necessary to post guild count or just for logging purpose of top gg API.

However it is posting count.

  1. My on_dbl_vote event is not working
#

Please Help !

restive otter
#

It's not necessary and afaik it does nothing if it doesn't have any handlers.

sharp totem
#

But why my on dbl vote event not working

#

It is not printing any data on vote

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

Also what will the logger return?

rain heart
#

That doesn't look like any vote event related thing unless I'm wrong

exotic oyster
#

Hey how do i show the number of servers my bots in on top.gg frontpage

rain heart
#

-servercount

abstract mothBOT
vernal trench
#

Is there a way to let the api return a Boolean if a user voted?

rain heart
#

Yes, use the check endpoint

#

Read the docs above

vernal trench
#

iit doesnt return a boolean

#

bool

stiff birch
#

is it possible to get server vote tracker ?

night ingot
stiff birch
night ingot
#

You need an approved bot to use the API, so you'll need to wait for that to happen then

stiff birch
#

so it's not possible to use private bot for this

dawn solar
#

I can't get my port open.

#

I've added port forwarding on my router but it still says port closed when you use a lookup tool

vernal trench
#

i want it to return a bool. is that possible?

rain heart
#

1 is a bool

#

1 is true

#

0 is false

vernal trench
#

ok

rain heart
#

read the manual of your router, helps the best actually

dawn solar
#

According to that I have done it fine

#

I used the online manual to do it

tranquil fox
#

hi, i can't fine where is the api

rain heart
tranquil fox
#

thx

violet viper
#

Hi! How would I know that on the weekends, it's double rewards?

night ingot
#

There should be a field in the vote data called "isWeekend"

sharp totem
#
def setup(bot):
    global logger
    logger = logging.getLogger('bot')

what will the logger return or holds?

violet viper
sharp totem
#

@rain heart can u help me out

rain heart
#

no py knowledge

sharp totem
#

Anyone else?

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

Why my event not working?

night ingot
#

Is your webhook path correct? Is the port open?

sharp totem
# night ingot Is your webhook path correct? Is the port open?
import dbl
import discord
from discord.ext import commands, tasks
import os
import asyncio
import logging

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

    def __init__(self, bot):
        self.bot = bot
        self.token = "my_token"
        self.dbl_auth = "auth_code"
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth=self.dbl_auth, webhook_port=5000)

    @tasks.loop(minutes=30.0)
    async def update_stats(self):
        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))
        finally:
          print("guild post attempt done")

    @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))

rain heart
#

did you enter the correct url in your bot page?

#

did you portforward incase you're hosting from your home network?

sharp totem
#

Im using flask api

#

Port 8080

night ingot
#

But you entered port 5000 in the client?

sharp totem
#

Okay

#

I need to change it

sharp totem
night ingot
#

You don't need to use flask if you're using the built-in webhook client from dblpy though

sharp totem
#

Then?

rain heart
#

0.0.0.0 is not the correct ip

#

it is your public ip

sharp totem
#

Yep just an eg

night ingot
#

First of all you need to decide if you're gonna use flask or dplpy to listen for webhooks

sharp totem
#

dblpy @night ingot

night ingot
#

Yes, then that url would be correct, replace 0.0.0.0 with your public IP

#

and add /dblwebhook at the end

sharp totem
#

0.0.0.0/dblwebhook

#

Like this?

#

OR > 0.0.0.0/port/dblwebhook

night ingot
#

http://<your public ip>:5000/dblwebhook

sharp totem
#

What if I'm using flask to listen

night ingot
#

Then it's the same, but different port and different path

#

Also the event from dblpy won't work if you're using flask, so you'll need to set up your own logic for that

wintry warren
#

How do I get webhook password?

night ingot
#

You set the webhook auth/password yourself on your bot's page

#

it's there to verify that the webhook is coming from Top.gg and not someone else

west flint
#

Hey, i have a quick question. How i get or find a API Token for the API?

rain heart
#

bot page settings -> webhooks

solid crest
west flint
#

okay

rain heart
rain heart
#

Your authorization is wrong on some point

#

the webhook works, just your authorization being shit

#

post your code please, even if i dont know py

exotic oyster
#

i need assistance with rewards on vote, can someone pass a github/video link? *discord.py

rain heart
#

is the best you can get

bronze epoch
#

how can i add shards in my website?

rain heart
#

by posting stats, see the docs above

bronze epoch
#

which section exactly?

rain heart
#

posting stats

#

use the search feature on the docs

#

or search for "shards"

bronze epoch
#

ah ok ty

#

@rain heart Its showing no result found

rain heart
#

search for stats then

bronze epoch
#

ok i got it

#

isnt this server count?

rain heart
#

server count is in the same category with shard count

#

both posting stats

rain heart
#

-b 663069883009073202

abstract mothBOT
#

dblMod Banned PROFESSOR#1628 (@autumn verge)

sharp totem
#

It just started now

rain heart
#

whatever you've entered

sharp totem
#

Few minutes ago it showed me the json

rain heart
#

it isn't existent

sharp totem
#

I was telling about on dbl test and vote

sharp totem
#

Post request 404

rain heart
#

can't help then

sharp totem
#

why?

rain heart
#

post your code and wait for someone who knows your programming language

sharp totem
#

wait but you may know the reason for such error while post requesting the data

sullen nymph
#

Under the stars

#

There flies a bird

#

It flies around

#

And yells at you...

#

SEND YOUR CODE

sharp totem
#

It is in top.gg website lol @sullen nymph

rain heart
#

what are you trying

sullen nymph
#

That absolutely says 0

#

aka

#

nothing

sharp totem
#

what?

sullen nymph
#

What have you tried, which examples are you using

sharp totem
#

manual server count post

#

with on dbl vote event webhook

rain heart
#

but what tells you 404

sharp totem
#

someone votes and when top.gg tries to post request

rain heart
#

"what tells you 404"

#

answer me that please

sharp totem
sullen nymph
#

What's your webhook_path

rain heart
#

then your webhook is making a request to something non existent

sharp totem
#

Instead of the data json I am getting this

rain heart
#

read what shiv said

sullen nymph
sullen nymph
#

Duh

sharp totem
#

I am getting the post request anyways

sullen nymph
#

set it to /dblwebbook

#

webhook

#

Typing is hard

sharp totem
#

what?

rain heart
#

your webhook is literally http://yourip:port/http://localhost/dblwebhook

#

according to your path

#

only set it to /dblwebhook

sharp totem
#

My application is getting the post request and the problem is instead of the data containing the vote details it sends my app 404 Error

rain heart
#

read what i just said

#

please

#

your path is set to http://localhost/dblwebhook, which automatically makes your whole webhook url http://yourip:port/http://localhost/dblwebhook

#

only set it to /dblwebhook

#

is it related to the top.gg api?

hearty lintel
#

webhook_path is only the path not the full url

rain heart
sharp totem
sullen nymph
#

Under the dark sky there is a light
It flies around like a shining star
And the star shall say to thee once more
Read the fucking docs, you utter cock

rain heart
#

path

#

not related to the api

sullen nymph
#

/path is your path

#

It's not your URL

#

It's a route

rain heart
#

not related to the api

sullen nymph
#

specifically for top.gg requests

rain heart
#

again

#

not related to the api

#

-api

abstract mothBOT
#

This channel is ONLY for the Top.gg API!
This channel is only for: suggestions/help/bugs to do with official API libraries and API docs found at: https://docs.top.gg
Any Off-Topic conversation may get deleted and muted.

If you need help with development about your bot or development in general, feel free to use #development.

north trellis
#

lol

#

anyways

sullen nymph
#

http://69.42.13.37:1337/mypath
/mypath is your webhook_path

rain heart
north trellis
#

the server count on my bots top.gg page is wrong. it doesnt seem to be throwing any errors either because we made it send a message when an error occurs

#

why is the count not working?

hearty lintel
#

it doesnt update right away if you're expecting that

sharp totem
#

http://my_application.cu/dblwebhook my current webhook URL

rain heart
#

post your code please

#

@sharp totem

north trellis
rain heart
#

your constructor

sullen nymph
#

Yes so set your webhook_path to /dblwebhook for fucking crying out loud

hearty lintel