#topgg-api
1 messages · Page 135 of 1
yes
you have to make sure your ports are open
ok
it is
that should work for you then
found it
again, you're not making a solution for kofi, you're going to make a solution for HTTP requests
webhooks are HTTP requests
after i filled every information
just keep that in mind, else you might get lost
well, you put what u wanna do when someone votes inside the webhook event
like setting onReady event
thanks, i will look into this!
again, you'll be setting an actual webserver, so you might need to change your dbl webhook event to be handled by http.client
else you might face some weird issues
help?
the tutorial covers it
send link
yes i understand that now. gonna make a dynamic solution to handle all http requests.
but im wondering how im going to handle events you know? @knotty garnet like how i would make a custom listener
I'm just gonna look it up
the tutorial covers it
just search around if you need more references, http.client is not the only http handler
but it's the more widely used afaik
@knotty garnet wait can i also use the flask one?
I guess so
I'm not well versed in python, if you're already familiarized with another http handler feel free to use it
hmmm
basically anything that do X stuff when someone accesses Y url you're fine
@knotty garnet thanks! gonna work on this later
yw
dbl webhook's auth is anything you want it to be
like d09wdfu9d0sugfv8dhascne9 acception?
it's just a thing dbl will send u on every request so you can check if it's legit from dbl
ok
just make sure it's the same both on ur code and on the site
ok
there some error
on my console
@knotty garnet can you help me fix?
i host on repl.it
@knotty garnet do you think i need to ports for topgg and ko-fi?
or should i just separate them with two different paths
/kofi /topgg wdyt
Single port, multiple endpoints
Opening one port for each service would be highly inefficient
okay okay, another question
i won't need the token anymore if i don't use the api right? the dbl one
The token is for dbl api (like server count poster)
You still need to use the api if you upload the server count
You'll just not need to use the webhook part of it
from discord.ext import commands
import dbl
class TopGG(commands.Cog):
"""
This example uses dblpy's autopost feature to post guild count to top.gg every 30 minutes.
"""
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) # Autopost will post your guild count every 30 minutes
@commands.Cog.listener()
async def on_guild_post(self):
print("Server count posted successfully")
def setup(bot):
bot.add_cog(TopGG(bot))
so im still okay with using this?
while having a webserver on the side?
what is forbidden??
What endpoint can check if a guild is available in topgg?
yes
i am using a express webserver myself to see when someone votes, and the req.body comes out as empty for whatever reason
here is my code around the post route
how can i fix this?
like i need to get the user from the post request
but nothing in the request has that property
...
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_port=2727)
...
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("Received an upvote:", "\n", data, sep="")
@commands.Cog.listener()
async def on_dbl_test(self, data):
print("Received a test upvote:", "\n", data, sep="")```
I've set the Webhook url on the website to http://12.3.45.678:2727/dblwebhook and am still unable to receive a test update response in my console. Idk whats the thing i am doing wrong
nvm fixed
,
I'm trying to make my bot console logs when someone votes but when I use the test button on top.gg Webhook page it doesn't log anything is it because I put the wrong url? but I tested it using an api tester website and it worked or is my code
const express = require('express');
const app = express();
const bodyParser = require("body-parser")
app.use(bodyParser.json());
app.post("/votes", function (request, response) {
response.sendStatus(200) // tells the website that sent the POST request that everything was OK
console.log(request.body) // log the actual data being received
console.log(request.headers)
let user = client.users.cache.get(request.body.user)
console.log(`${user} has voted`)
let auth = request.headers.authorization
if (auth === "my auth") {
} else return;
});
app.get('/', (req, res) => {
res.send('Cats cute!')
})
app.listen(2000, () => {
console.log(`running`)
})
port 2000 the website says "Error: I could not see your service on my ip on port (2000)"
hmm ok I tested the Webhook using api tester website (https://reqbin.com) and it was working fine or it doesn't have anything to do with this?
oh okay I'll try to port forward it
I'm using hosting something.host will I still need port forwarding?
Hello, doesn't the top.gg/sdk API have a way to see the ping?
a way to see the ping of the api with the client
the ping between bot <---> top.gg?
Make sure your port is forwarded and open
Apart from that, make sure your URL follows the format of http://ip:port/path
Yes
store current millis -> make a request to top.gg -> compare with the new current millis
long before = System.currentTimeMillis();
//Make some request to the api
long ping = System.currentTimeMillis() - before;
some java example
can't it be https?
Not sure about that i use ubuntu 20.04
ok that means i dont have to do it https, i neither own a domain nor anything else.
how can i get dbl api key can someone help me dm or here
bot page settings -> webhooks
thank you
just make sure you either use cloudflare or keep your ip secret
Keeping ip secret?
yeah, else you might face ddos
that public one is the issue
I've not shared it with anyone so I'm fine
yep
Nonetheless i tried doing it today with my public ip but there was no success. Here's the code.
is your port open?
try using https://apitester.com to send any request to it
or postman whatever
Okay thanks
I guess if it's not open I'll have to specifically add that port to my server settings then.
if using ubuntu, check udp
whats the data return from a non test vote?
oh ok ty
const AutoPoster = require('topgg-autoposter')
const ap = AutoPoster('topggtoken', client) // your discord.js or eris client
// optional
ap.on('posted', () => { // ran when succesfully posted
console.log('Posted stats to top.gg')
})
What should I put at the client part?
the comment says it 
Oops, sry
i want to have a voting system which tells who voted in a particular channel.
so how to use the webhooks things ? (i have vsc and 0 experience of coding)
if you have 0 experience in coding, this'll be pretty difficult to implement
also you'd need an approved bot to access it's API
Hi so it doesnt work for unapproved bot?i tried the votes api it works but does nt work when i try the get bot api
yes it is approved..sorry i thought verified..so do you know why it may not be working?
yes i am using the same authorization as the votes api which works...using postman
404
yes..get method
ok it seems there is issue in docs
https://top.gg/api/bots/795368963302621204
this is correct url
Please correct this
@normal nest if you put it in the github as an issue, im sure it'll be looked at
.networth {DerpyTelly}
Sure will do that.
= 0
how can I look to my networth
How I can make a voting reward :D
use webhooks
I make my bot set user value with it?
huh?
The bot's server count is currently 800 but why does it appear here to be 510
-botinfo 763772564962148402
Which language
Im late af as well

@wise silo are you using the new one in https://docs.top.gg/
-botinfo 795323591850983425
-botcommands @graceful merlin
@graceful merlin
Hey! Bots aren't given permissions to send responses in this channel. Please use #commands to run commands.
Next person to use Luca's commands in this channel gets muted
i did it! thank you!
How do I get my bot's topgg token
Your Bots Edit Page > Webhooks > Get Token
thanks
plz write
What?
1 official, see pins
Yep, and the auto poster(also in the same pin)
I have a question while I'm on top-gg / sdk, I'm calling him by express using the API name for req. Can I just call vote and add some value to the user who voted for my bot?
You'll want to store that in a database of your own.
yes
mongodb
I'm trying out of storage first, using just my savings box to add coins to a user
and can I pull other functions from this dependency / api? I am trying hasvoted
Any methods listed on the docs can be used yeah
sorry for the horrible translation, i'm brazilian
ok how do i make it so if someone votes multiple times they can get the role for how many times they voted (for example voted 2 times gets the 2x voted role)
youll need a database to keep track of how many times each user voted
Youll also need a discord bot, which gives the correct role
ive alr got the vote tracker bot so thats 1 but do you have any recomendations for bots that give roles automatically
I'm trying to setup a webhook for votes and I get the following error every time I try to save There was a problem saving the webhook :Thonk:
Bot?
Yeah it's a bot.
It is approved
You do not have the developer role though
How can I be given the developer role
We had an issue with this before as I'm not listed as a developer, even though I'm listed as an admin
What webhook are you trying to add?
it cannot be a discord webhook
you have to make one yourself
It's just a webhook to zappier.com
DM the url, I'll tell you if it is valid
can you check what the inspect element console says when you try to save it?
So, I am trying to do the webhooks for voting detection, and I am trying to use dblapi for it because that is what I have seen on how to get vote detection, and on the top.gg document it says I have to put the code in index.js. Which index.js would I put the code in since in dblapi there are 2 index.js in the module, and there is the index.js that isn't in the module that just runs the bot.
Anyone know how to add a bot to an sever
bot
quick question
why do we need to create a webhook for the bot votes
why not events
webhooks are a form of events.
thats not what i mean
you see if im using the top.gg sdk it doesn't allow me to receive the events like client.topgg.on("voted")
i have to create a http server
something like that
that gives you more control over the server
sure, most http servers have events
the one listed on the sdk uses an http server event
its also more lightweight for top.gg, and increases reliability.
hmm
its overall a very clean and powerful way of handling it.
hmm ok
@everyone
ah pong
I want to have the command used by voting How Do I?
I dont understand, what do you mean?
For example, what did you not understand?
For example, I want voters to use the help command. You understand?
ah, a man of culture
yessir, use the API to check whether someone has voted in the last 12 hours or not and lock the help command if not
Why the fuck would you votelock the help command
Do you think that's a good idea
Do you think it's allowed
cc @restive otter
any alternatives to fetch_user? it takes long to fetch multiple users
How can I show the total number of votes for my bot?
sHIW dude, can u help me
wdym by "or x"
also get_user doesn't work for me
fetch user takes long
i just need to take username
I suggest going through https://docs.top.gg
thanks a lot
Fetching a user shouldn't take too long
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
Hey dude, sHIV. I read this link but i don't understand cause i have bad English so sorry for this can u help me for my question?
Make a request to the API
Read the outputted JSON
Get the first element in the results array
Read the value in points for total votes and read monthlyPoints for votes in current month.
/poll "Кто за перенос базы?" "Алькатрас" "Тисы"
fucking idiot
Hi
For api , I need to get my bot added on top.gg?
yes
events.js:173
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (net.js:1226:14)
at listenInCluster (net.js:1274:12)
at Server.listen (net.js:1362:7)
at Function.listen (/rbd/pnpm-volume/e34fee2b-1bee-48e8-b280-5dfbc30c3da0/node_modules/.registry.npmjs.org/express/4.17.1/node_modules/express/lib/application.js:618:24)
at Object.<anonymous> (/app/bot.js:124:22)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
Emitted 'error' event at:
at emitErrorNT (net.js:1253:8)
at processTicksAndRejections (internal/process/task_queues.js:83:17)
at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:58:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:828:11)
at internal/main/run_main_module.js:17:11```
help
Use a different port
can anyone say how to get crowdin api?
-api
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
ohk
Can someone tell me why its not sending the test webhook?
And I really didnt understand what value I put in Auth
Are you sure the port you specified is open?
Are you sure the webhook URL you entered is correct?
Are you sure the Authorization key you entered matches the key in your webhook code?
Not exactly
Okay
It's a piece of text that you come up with and use
like a password
set it in webhook settings if you're using an official library and make sure the same text is entered in the Authorization key
Okay thank you for helping
Hello there I think I spotted a bug with the "force dark theme" option on a bot's page
Whenever this option is on, the bot's mini-description is displayed in a very similar color to the background making it almost invisible
This is outside of the detailed description field so I don't think I can change it's color myself
OwW Free Code thx

That's an error dude
im bot later error send
-bots @wary plover
-bots @rain heart
In python top.gg sdk, await dblclient.get_user_vote() returns a boolean telling if that user has voted in the last 12 hours or not. Right? and does the function also has the same 60 requests/60 seconds ratelimit?
hey, is there some sort of way I can run code when a user votes? I'm using java
Webhooks
any tutorial i can see?
how?
I’m not good with Java so I wouldn’t know where to link you other than the top.gg docs
Find HTTP server Java
Docs explain how to set it up on top.gg, what you do on your bots end is up to you
ok, i just wanna give the user coins
Then you set up a http server and when top.gg sends a post with the data, you parse it on your bot and do the code to give coins
aight cool
just wishing there was an onVote() method I could implement 
Uhh wait don’t the libraries have smth like that, haven’t used em
Dunno if there is a Java one
There is
Oh wait it might not have it?
I'm using JDA
Javacord has the webhooks
I saw it in @rain heart 's example
also wondering if he could help me
sure what's the issue
i looked at your Loggers bro thingy
and it was in Javacord, I am using JDA
so if there is a way to receive the vote data without javacord..
You could do it the same way, just with different executing on the Vote class
You dont need javacord, one sec
??
If you want to get the realtime vote, use webhooks
my users have been begging for vote-rewards for the longest time
you could use springboot to setup a webserver together with ur bot
it's dirty easy to setup it
Im not setting up a webhook because I keep failing at that
ok, any tuts?
why I can't just use the get_user_vote()?
really i don't want anything too big, im just going to use it to receive vote data
https://spring.io/guides/gs/spring-boot/
jump to "Create a Simple Web Application"
this guide is designed to get you productive as quickly as possible and using the latest Spring project releases and techniques as recommended by the Spring team
everything at the start is building spring from zero, the part where u need is that one I said
isnt this javacord?
nah its not
oh, nvm
could be
got a bit inspired from builders
just read that tuto, it'll guide u through creating a simple http listener
do u use maven or gradle?
maven
ok, then the tutorial will be on-point to your case
haha
aight cool, but how do i receive stuff once ive done all of that
this will be your endpoint
if u set it to /dbl then the url will be http://ip:port/dbl
ip:port are your VPS' ip and port
so is that what I should set it to receive the vote data?
yep, once top.gg sends a vote request to http://ip:port/dbl, springboot will look for a mapping to /dbl then execute whatever is inside it
im hosting locally on raspberry pi
then it's your public ip
Whats My IP shows your Public IP Address and LAN, including ability to Trace IP and view WHOIS History. View Screen resolution and browser version
access that site from ur rasp
this is my endpoint method
I recommend those params
ooh ok, and the port?
windows
hm, idk how to setup ports there, but search online about it
there might be many tutos for that
also make sure to port-forward on your router
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
these are the dependencies needed?
do i need that starter-test thing?
ok cool
also:
create an applications.properties file inside resources folder and put that text inside it
for the sake of your sanity
why
Because springboot logs every transaction
Your console would be spammed really quick
The first three lines there limit how many threads springboot (lets call it sb) will use
The fourth line sets loglevel to ERROR
And the last line redirects all errors (404, 500, etc) to /error so you can create an error handler later on
Didn't u use maven?
yh
Like, you were supposed to but those maven stuff inside ur pom file
it says "Plugin 'org.springframework.boot:spring-boot-maven-plugin: ' not found"
Yes, that's not a lib but a plugin
You need to put those stuff in ur pom file
Not download
ngl i misread that
do you not have like a dependency manager (e.g. maven) for the bot?
Manny pls tell
Ohh
UwU
@knotty garnet so what do I put in my pom file?
I'm back
did u reload maven?
actually, could u show me ur entire pom file?
@bronze axle
ill just send a message file?
plugins should be after dependencies, but that shouldn't cause issues
try reloading maven
if using intellij, click the refresh button in maven tab
ok its reading the pom
also, note that intellij sometimes doesn't load maven repos to the cache, so it might show error but the code still runs
so should i invalidate cache and restart?
yea cause i refreshed and its stil showing the error
yea the code runs fine
now u need to create an app class
So I've tried sending requests to my server using the udp address and it says its blocked.
ok
just create a class, and in its constructor put that line which is inside main
do not create a method called main there
whatever u want
it'll be a simple class with a single constructor inside
remember to put that @SpringBootApplication annotation above the class
this right?
is your class named Application?
nonj0
oooo ok
this is my class
here's where I call it
you don't need to put the main method inside it, you can call somewhere else
if you do put a main method there, you just do YourClassName.main(args);
so can it just be a normal method?
yes, but gotta be static
cool
and you gotta pass String[] args to it
ok cool
Hey
let's go one step at a time
do that then start ur bot
you'll see a giant "Spring" ascii art popup in ur console
if it does appear, then you did everything right
yup i saw the ascii
inside the SpringApp?
no
a new class
BUT
it gotta be in the same folder as SpringApp
or in subfolders
yup i made a new package called springboot
like this for example
my http handlers are in endpoint folder
and Application is springboot
so should I make a subfolder?
ok, and what should i call this
yep
aight and should I call this class Controller ??
call it something suggestive like DblHandler
I like to use Handler keyword to identify classes with endpoints
but again, up to you
should I copy it as is?
no, I mean, just show a print of how you've done
ive improvised a little
it should look like this
except for the class name and path
argument names are also up to you
ok
done?
yup
show me
done
no
you'll need to port-forward in ur router
I can't say exactly how to because it depends on router model
ok so my IPv6?
Your IP Address plus Port Scanners, Traceroute, HTTP Compression Test, Ping, Whois, DNS, IP Geo Location, Password Generator and many more tools and how-to's
ipv4
ok
all u need to do now is open a port
so how do i do that?
as I said, you'll need to search that urself since it's model/brand dependent
but for all cases, access 192.168.0.1
or whatever is ur router config url
ok
let me finish up with the port rq
what port number is the best?
6969?
or 80
never 80
it can be any port u want, as long as it's not used anywhere else
but below 1000 is a danger zone
max is 65535 iirc
put everything the same then
which protocol
actually, found a pretty nice site https://portchecker.co/
Port Checker is a simple tool to check for open ports and test port forwarding setup on your router.
Verify and diagnose connection errors on your computer.
cool
which were the options?
TCP, UDP, TCP/UDP
tcp iirc
Its like all the ports are closed
did u use portchecker?
yea
you should set it to HTTP
it switches back to FTP
it says its closed
I mean, on the port forward
ok i set it all to 80
now try
i havent saved the port
they're working on a solution for status checks since all bots were removed from here (they can't track bots that aren't here)
i thought 80 wasnt secure
oh okay, why wouldn't my bot be here?
because discord limits bot count to 50 per server
you see, top.gg has way more than 50 bots
that makes sense
oh ok
more like a discord issue, but yeah
ok so the port is still saying closed
@topaz axle #site-status message
Also, only selected bots chosen and voted by the community will be added here
thank you very much
and you @knotty garnet
ok i undisabled
enabled then
yes i set to default
see that guide I've sent
yh
it has firewall config stuff
this
hehe
may I ask u, why are you running windows on rpi?
i am familiar with windows and i didnt originally buy the pi
I see, but if you plan on using it as a dedi you should consider using ubuntu instead
windows is a memo hog
yh ive been told that
some people just say i may as well switch back to raspbian
do i only need to put in port 80?
ok i did it
see if it's open now
also, you could just ping ip on cmd
on another pc obviously
but try that site
like this
I'm a bit clueless then, it was supposed to be able to connect to that port
should i specify a port in Remote Port
if you do netstat -a -n on cmd does it show 0.0.0.0:80?
i dont see 80
on External address, not local
yeah, looks like it's not open at all
btw, no, it should be listed under "Local Address"
which isnt
and i know for sure i saved the port
did u restart the rpi?
make sure your java application is running first
he can't ping the port
i havent entered the port into the app
like, it's closed
ok my bot will go offline
i did tell my users before starting that the bot might go offline
try restarting then
ok il save intelliJ first tho
intellij saves on each time u change current app
ctrl + S does nothing at all there
you can disable that auto-saving feature
yea i dont plan on doing that lol
yeah, google docs is always auto-save
and btw i can use this spring boot thing for other stuff right?
on what
the router port forwarding
yea i set all the ports on the thing to 80
both start and end on both external and internal
I'm clueless then, we'll need help from someone who know how to properly open a port on windows
idk why they make it so difficult
Block edge traversal?
the video says I should change to Allow Edge Traversal
never heard that
@bronze axle you want to open port 80?
yea
search for Firewall on windows search
open it, then Advanced Settings
then you have access to everything the firewall has
click on New Rule in Entry Rules
choose Port > select the protocol you want > type on local ports what port you want
if you want pics, i can send them
pics please
my Windows is in another language, but I'll send you closed captions xD
search for Firewall on windows search
ok
advanced settings
ok
in Entry Rules, choose New Rule
ok yh, this seems similar to what i did but go on pls
choose Port then Next
yup
@knotty garnet said i should use TCP
choose it so
ok
and insert 80 in the local ports
yes done that
normally it's TCP ain't it?
im using it for my bot's spring boot, to get vote data
your bot's online?
yes
if you select the 1st, EVERYTHING can enter through that port
oh ok
and that's bad xD
ok now its on Users
just a thing, do you share your PC with other Windows Users?
no
ok
on Profile let everything ticked and Next
on Name put 'Port 80' so u can know
after all that do the exact same in the Exit Rules
OH I DIDN'T DO EXIT RULES
probably u want to get info from your PC
and don't let any enter, if this concerns you, u can just delete the Entry Rule u just did
oof still does not work when i do netstat
netstat -a -n
huh
2 secs
TCP aaaaaaaa aaaaaaaa:80 CLOSE_WAIT
TCP aaaaaaaa aaaaaaaa:80 CLOSE_WAIT
TCP aaaaaaaa aaaaaaaa:80 CLOSE_WAIT
TCP aaaaaaaa aaaaaaaa:80 CLOSE_WAIT
TCP aaaaaaaa aaaaaaaa:80 CLOSE_WAIT
TCP aaaaaaaa aaaaaaaa:80 CLOSE_WAIT
they're as CLOSE_WAIT, ain't them?
TIME_WAIT
oh
well, from this point forward, I don't know shit
has your router Port 80 open?
you mean for port forwarding?
yeah
uh huh its open
well, idk
yh
what's your router config
no i mean your router config
e.g. take ss of your router firewall and port forwarding rules
You need member intents for that
@deep cape for something.host you can listen on :2000 and everything on service-XXX.something.gg will go there
0.0.0.0 means being able to connect to anywhere
For you it is going to be your external ip
If you have portforwarded that is
i port forwarded port 80
Do you use that port already?
no this is my first time port forwarding
i actually suggest using a non-standard one such as 5000 or in your case above 8080
its free right?
wdym
so i can only use the port for one thing?
because it cannot have multiple connections coming through it
correct
you have about 65535 ports to use
15% being used by your operating system
for things such as microsoft related stuff and applications you have installed already
if hosting from home you need to port forward, if you have a firewall youll need to let it through the firewall
how do i set up the webhook?
i did the portforwarding
POGGERS!
oof KuuHaKu was guiding me
this is what i have so far except the onVote method just prints the payload
ok, you're here again
did it print?
according to the latest docs updates, must the webhook response only return http 200? what about the other http ok codes like 204? cc @willow sphinx
since there is usually no response that needs to be sent back by the server
Honestly, I would suggest just trying a 204 and seeing if it repeats it after a minute or not.
well.. its better to get the official answer I guess
it seems the only reason it requires a 200 is because it repeats the request if it doesn't.
https://sourceb.in/HLTbl7J18k
look at this error
never seen like this before
even my bot not working
the cmds
only cc prefix working
default prefix not working
i am sure it is related to top.gg
judging from what 
it should accept 204 but it doesn't currently
I just updated the docs to reflect the current state, yukine said he's gonna rewrite the webhook codebase this weekend so it should work as intended soon
ah ok, thank
how to fix it?
where can i found api docs ?
@commands.Cog.listener()
async def on_dbl_vote(self, data):
channel = self.bot.get_channel(811870894954905632)
logger.info('Received an upvote')
print(data)
await channel.send(f"recived a bot : {data}")
this doesn't work
Did you add a valid webhook url to your bot page settings?
yes
Did you test it with a request client?
not yet
import dbl
import discord
from discord.ext import commands, tasks
import asyncio
import logging
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))
this is everything I could find
what do I add to path @rain heart
It should send you a message on the channel you want it to send as per your code. It's like dummy data@restive otter
Also if you make that work could you please share what did you do to make it successful? I'm also trying to add webhook in python but no success.
ok sad it doesn't send anything
Oh rip
the documentation is hard to understand
like how am I suppose to make it send a message what should I do
like for example this is webhock path right ? https://discord.com/api/webhooks/811870958222704650/nFSzZRhPu_Rb-kP_cH3zySYfydGfvESo3ls5zaX4PGWXBaz1rY8ayoHxVNVn1KvB5vI2
I will delete it after
what should I do with this I put it in path and in webhocks on the website
@dire imp
Is that what ur putting in webhook path?
But I think your webhook path should be something like this http://12.34.56.78:port/dblwebhook
I think it is
than what should I put
Then the server should have an ip address and a port. Put it in a format like this http://yourip:port/dblwebhook on topgg website.
I'm not sure where u can find your ip since i m not using repl.it anymore
i do agree that the documentation in official topgg website isn't very helpful
Ohh okay let me know if that works?
Yes exactly
Yep same here.
?
I also followed to the same exact procedure
what do we use for rpel.it
for webhocks
I tried for 2h to use something and failed
@empty gazelle
I tired my anme and project
than port
I tired everything
//Server
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
res.send('voting system being hosted for 24/7')
})
app.listen(port, () => {
console.log(`Server is Online`)
})
// Code
const Discord = require('discord.js')
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL(
"TOKEN",{ webhookPort: 5000, webhookAuth: "PASSWORD HERE" },client);
dbl.on("error", e => {
console.log(`Oops! ${e}`);
});
dbl.webhook.on("ready", hook => {
console.log(
`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`
);
});
dbl.webhook.on("vote", async (vote) => {
client.users.fetch(vote.user).then(user => {
const thanks = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTitle("Thanks For Voting! :)")
.setDescription(`Thanks you so much for voting , it helps us grow a lot !`)
user.send(thanks)})
})
I used this
still NOTHING
stop using dblapi.js
When i tried to put the first link and tried sending a test webhook it gave me a 404 not found error on the webpage
Btw I’d strongly recommend not leaking your VPS IP or discord webhooks :)
not mine 🙂
@restive otter use @top-gg/sdk
how
than
read the pins
but I don't know how to make the webhock not code
what pins
#topgg-api message this message
what is this const app = express() // Your express app

I don't code in js
then cant help you
You need to have at least a little bit of experience
bruh I made a full bot in py but because the py documentation is so shit I had to make in js
There’s a python library
P.S. you could just contact me for help with it
Can i dm you shiv?
Aye feel free to
use @top-gg/sdk on npm
Ok
I have many doubts in this api
did the api change?
is this normal or?
it's just down ig
ok lol
should be fixed soon
i need to handle that error better - its typing tons of html in my console
!play
yes
Ah ok was just about to ask if I was the only one with a gateway timout lol
guys
i have created a check command since a whale ago
and now it doesnt work
nothing wrong
is that a normal error?
this was a 3h ago
and this now


