#topgg-api
1 messages · Page 118 of 1
Dont beg
I will learn it too
Learn now
lmao
Well, where should I start? Do you know any site?
.........
Yes, google
does anyone know dblpy here?
where should i start
so i'm using this api but when i try to post the server count it says "Error: 404 Not Found" anyone knows how i can fix this? or is it because my bot is not yet accepted?
Hmm can you show your code
it is bcause ur bot is not accepted
alright thanks
'\
How did you know that
if it is accepted and not working send ss
sorry there was a lag while i was typing the whole thing
it's not accepted (yet)
then that may be the error
Then thats why
i think they have provided the code needed to post the guild count on their website
so u cant go wrong with that
@willow spindle pls tell me if you know how to solve this
I don't know python
Hey
How can I learn shortly how to make my bot sending a thanks message when someone vote for him (ping me when you answer pls)
Thanks for your help
which language?
javascript (ping me, there is no problem to ping me)
Once you have the webhook setup, its just fetching the user and user.send
https://top.gg/api/docs#jslib
@queen current
const DBL = require('dblapi.js'); const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); }); dbl.webhook.on('vote', vote => { console.log(`User with ID ${vote.user} just voted!`); });
yes I see this
Then on your bots edit page in the webhook section fill in the url and auth
but it's saying there is a error in a file in the dblapi module
What error
Don't remember, I tried this a month ago kind of
sorry
I can do this again wait
401 Unauthorized
at this line ⬆️
Unauthorized would be a bad token, or a bad authorization.
You need to make sure your authorization is correct mainly, your token doesn't need to be correct if your just using the webhook.
Yeah
Authorization is whatever you make it(its like a password.
what I need to change
Nope that's just an event
Hook.hostname is in an event
ok
so I replace 'password' with a password that I paste on 'Authorization' on the website
You need to fill in the url and auth on the site.
The url will be something like http://ip:port/dblwebhook
And yeah, id look into making it something secure though, since its the password the webhook will use.
WHEEre are you hosting?
it's the host ip?
yea
It always logs 0.0.0.0
0.0.0.0 just means any ip available to the code.
You'll want to use your proper ip
ok
I'm french and bad a english speaker
ok
so I haven't any error !!!!
so that's an event, if someone vote, it's console.log
Am I right?
@jaunty plank sorry but I'm very excited at the ideea that it can work
Do you have any firewalls?
wdym is the library not compatible with python3.9?
Yeah, it's not 
You said your hosting on a vps right?
So wheres it hosted.
Why are half of my requests forbidden?
I'm using @restive otter/sdk
ooops i tagged someone
Nah that's all the test requests
from top.gg
why would that be bad requests?
Just used this
does it have ratelimits?
Yes
then there's something screwed up with the auth of the request
nah it's the same request all the time...
how...
And why am i getting get requests from top.gg??
So is there something wrong on top.gg's side?
but shouldn't it be a post request?
Thats kinda weird...
And why are half the requests without a correct authorization header getting through
maybe that's just random requests from people who accidentally access it
or test it
would explain both the 403 (post request without authorization) and the get (accessing the url from a browser)
well ok i get why the get request... but the successful post requests without the proper auth? I changed my auth token on top.gg and saved it... But some of the requests are still going through even though the auth is incorrect...
The auth did not change for some reason...
did that 10 times... also refreshed the page
Yup, it is not getting updated on top.gg
still sending me requests somehow
very weird, try making a test request using postman maybe
so what should be my body?
{
"bot":xxxx8172109165xxxx,
"user":xxxx3598873234xxxx,
"type":"test",
"isWeekend":true
}
This right
yeah use that as test data
Uhh wait that worked...
sooo what's happening with top.gg?
it's using wrong auth half the time?
403 is wrong auth right?
once i changed the value, it worked perfectly
correct
502 is always wrong request method
weird...
indeed
atleast no one can post votes without the proper header that's good to know
or maybe i just got ratelimited to changes on their site or something...
And i'm still getting weird get requests although no one has the url except me and i'm not opening it in a browser...
you can't get ratelimited from webhook requests
unless ngrok ratelimits requests which i highly doubt 
Ahh i mean requests to update settings on dbl...
shouldn't cause an issue either
sooo it's not updating anything which save on top.gg....
so it's using the old header and url...
but that shouldn't cause half of the requests to be unauthorized...
i can only suggest try testing webhooks in like 1-2 hours again
maybe you did get ratelimited in any way
Api ne
what?
It's sometimes using the old url and sometimes the new one... Weird...
yeah try it later then
yup...
really weird, haven't seen that before
Yup i spot an error which it gave 1000 years later after i clicked save...
nah now you actually got ratelimited 
Nevermind it took like 40 secs to load...
check your console when you try to save
not ratelimited... Their servers are prolly having a bad day today....
?

Ummm that's bad
https://top.gg/api/docs is the place to get started
nah that error has always been there
ahh ok...
then use the new library
i got a 502 yup i am ratelimited
what library?
wait thats a bad gateway...
bad gateways happen from time to time
Thx
Hmmm okay...
ANd now it worked finallyyyy!!!
Thank You So Much! ♥️
i guess the webhook requests from top.gg were just stinky
ig... some things took too long to update everywhere...
appi oiu hiriin quuyr le
English please
дай мне кувшин вина
There you go
Одно пиво, пожалуйста
There you go
почему ты переводишь это предложение
I dont know [я не знаю]
ок
@lucid rock hangi bot çalışmıyorsa o botun destek sunucusuna gidip yardım alabilirsin
That is something you define for yourself
it has to be the same on your bot page settings and your code
Yup
Okay
is that a valid webhook url?
it has to be your webhook url which is most likely your servers ip or domain
and :yourport
read the webhook documentation from the library you're using
?
google it
@quartz quest what language?
Node.js
Thanks
Hello
Authorization
You can use this value to verify the requests are coming from us.
How do i get on that?
you can define it yourself
it has to be the same in your bot settings page
and your code
this is a very big article, I didn't understand anything3
Then you are not ready to do something with webhooks yet
i recommend coming back to it once you have more experience
I got an error saying "there was a problem saving"
what could be the problem?
^
the bot has not been approved yet, could that affect it?
the exact message is: There was a problem saving the webhook :Thonk:
it might be
yeah i can save webhooks the best guess is that it's not been approved yet
on your other bot can you save it fine?
yeah, it did
so thats probably the error
thanks!
I am trying to get the user that voted
but it is not working:
app.get('/webhook', async function (req, res) {
console.log(req.body.user)
await res.send('Successful')
})```
using express, what am I doing wrong?
it's a post not a get
are the backend or cloudflare servers having issues currently i have been continously getting 500 Internal server errors with the Node.js Package. the error body says server is cloudflare but there is a "database error"
why wont this recieve:
app.post('/post-test', (req, res) => {
console.log('Got body:', req.body);
res.sendStatus(200);
});
it just has a blank json object
i mean if you're going to send empty data, you wont get any data
i got this error when running my bot in local
at IncomingMessage.<anonymous> (/Users/smh/Documents/Bot/Music Bot/ChilledChino 2/node_modules/dblapi.js/src/index.js:118:25)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:4584) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on```
Is it just my slow internet or something?
There is a way to send a "test" vote to see if a webhook is working?
It's on your bot's edit page I believe.
Oh, yeah I just saw it. Thank you!
yep, your connexion looks reaally bad for a 522 error
ooh. thank you :D
Hey, how can I connect my discord.py bot to top.gg's website so I can track votes and pay in bot currency rewards from python?
Through webhooks
sdasdas
60/60s
wtf? how can i make vote reminders then
bruh thats so hard ratelimit
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
``` This should console log who voted right?
Use webhooks
@sullen nymph wdym webhooks?
Webhooks you can enter on your bot page settings
no but i want to make a vote reminder command
Create a webhook, receive votes in real time, check if user opted-in for vote reminders, if yes, send vote reminders
no an event for receiving vote
An event for receiving votes is iterally why you'd use a webhook
idk if im doing it right
hm idk if you are understanding what im trying to say, so i want to do like
-
i have made a vote reminder command to enroll user for vote reminders.
-
It will checks the list of users in vote reminders every 6h and tell them to vote for bot.
-
if i just use the api it will get rate limited as there will be many users in the vote reminder list
Why would you need the API in this case?
how will i check if the user have voted or not then
webhooks
how? can u give a example im confused
Correct
There is, go to your library on the navigation to the left
Section tools
Depending on your library, there's also something about webhooks
this is the only thing related webhook
but its for receiving votes via webhook
i think its this https://dblpy.readthedocs.io/en/latest/api.html
Yeah, receive votes via webhook, store them locally, and rely on them instead of fetching the API
what? we need to store that locally? bruh
In your case it's easier to do that

how to reward users when they vote for my bot ?
webhooks
like ..
how exactly ...

How long should it take until my bot publishes?
what to put in webhook URL ?
most likely your public server address you're hosting the bot from
the 0.0.0.0 is just replaced with your public ip address of the server you're hosting it on
okk
@rain heart can i DM you ?
about webhooks? can't really help you with coding it
const Topgg = require('@top-gg/sdk')
const app = express() // Your express app
const webhook = new Topgg.Webhook(mypasswordhere) // add your top.gg webhook authorization (not bot token)
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
if(req.vote) {
const vote = req.vote;
let uservotes = db.fetch(`votes_${vote.user.username}`);
if(uservotes === null) {
db.set(`votes_${vote.user.username}`, '1');
votes = '1';
} else votes = uservotes;
const channel = client.channels.cache.get(id);
if (!channel) return console.log('Bot Voting Log Channel ID Is Not Correct');
if (weekend === 'true') {
channel.send(`${vote.user.username} Baraye Bot Vote Dad!\nVotes: ${votes}`);
db.add(`votes_${vote.user.username}`, '2');
} else {
channel.send(`${vote.user.username} Baraye Bot Vote Dad!\nVotes: ${votes}`);
db.add(`votes_${vote.user.username}`, '1');
}
} // your vote object
}) // attach the middleware
app.listen(5000) // your port```
why this is not working when someone vote?
tag me for answer pls
@restive otter are you getting an error or is it just not posting?
oh i see
vote.user is just a user id the webhook provides no info like username etc
i can't get username?
just get the user form your cache
what do i need to do to set up my vps for recieving webhook posts
open your firewall for the port of your webhook p much
like if i leave it as <my.vps.ip>/dblwebhook will that work
if you have no firewall setup a) yes that'll be fine b) set up a firewall lol
im not getting error about vote.user.username
ok ty jpb
np
it's not giving anything when i vote
so you're not getting any post?
ah
ye
ok make sure your webhook port is open
wait lemme check
if you want to test if it's open add app.get('/', (req, res) => res.send('test'))
then go to the ip:port in your browser
my bot is running on heroku
and im using this link:
http://(my app name).herokuapp.com:port
does it work?
nope
seems like a heroku issue i suggest doing research on how to do it
it might only allow specific ports etc
http?
both of this is giving error
you should be able just to go to it in your browser
this pls
it gives me Your App Is Listening Port 5000
uh then i can't log votes in heroku D:
is there a php source to interact with top.gg?
try this @restive otter
Ok i truned my pc off
i am going to try it tomorrow
Hello, I want to show the server count on my bot's page
I put this line in the client.on("ready") event
const dbl = new DBL('my token here', client);
But I get the error "TypeError: Cannot read property 'run' of undefined"
I did write const DBL = require("dblapi.js"); before that too
Can someone help me with this?
the error is happening on that specific line?
or can you show the line the error is happening on.
This is the error @jaunty plank
whats on line 81
This command.run(client, message, args);
that error isnt for the api, its your command handler erroring.
When I remove the api stuff, it works fine
then you probably put it in the wrong place
const DBL = require("dblapi.js"); is at the top of the script
const dbl = new DBL('token', client); is in the client.on("ready") event
where else does it have to be?
is the error happening at startup?
Yes
did you accidentally delete a }) somewhere
specifically the one for your on ready event.
Yeah, it was missing there, but still the same error
put it back at the end of your ready code.
if its still erroring there then you probably accidentally deleted more closing brackets.
wdym back of the ready code
so everything you run in your ready event needs to be inside the ({ and })
const dbl = new DBL('token', client); is the last line in ready event
okay then }) on the line after that
Yeah, it's there
and same error when you save and restart?
Yeah
are you using an ide?
something with a problems section like this?
https://i.imgur.com/9HUkc0m.png
Yeah VS Code
Actually this time it didn't give any error
but it didn't update on the site either
the site takes time
hmm
give it 5 minutes, then shift+f5
or hit the refresh data button i think
How i create my own endpoint to get votes ?
your trying to make your own api?
@jaunty plank it gave the same error after 5 minutes in the IDE 😅
cannot read property run
so, that seems like a command handler issue still.
which is why i was asking if it was running at startup
someone ran a command i think, and the command handler errored.
umm
but then it works without the api
the cmd handler is fine without the api
and Im calling const dbl = new DBL('token', client); in the ready event, not in the message event
yeah, so hows it affecting your message event.
so I don't think someone using a command should affect it
but the error is happening in your command handler
index.js line 81
and the error specifically says, your command is undefined(potentially someone running a command that doesnt exist?)
which is why it not running on startup was important.
umm
well, my bad, I used a command that doesn't exist, and it gave me the same error
lol, np.
how would I fix it tho
@jaunty plank so does it send the servers data to top.gg tho?
it should send the server count, if you want to be sure its posting you can add the optional events
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
Nah, it doesn't send lol oof
and this happened on start
@jaunty plank This happened on start, when nobody used a command that doesn't exist
doesnt send any log either
if you're posting stats i suggest using the new library https://npmjs.com/@top-gg/sdk
@hearty lintel it literally gives the same error on start when using that module
.__.
yeah i'm just saying
the error you're getting is an issue with your code
i suggest using a proper IDE which can show you errors and describe them
It's VS Code
check the problems section
nothing there
paste lines 76-85
um
if(command.timeout){
if(Timeout.has(`${message.author.id}${command.name}`)){
return message.channel.send(`Wait ${ms(command.timeout)}econds to use that command again. DON'T BREAK ME!`)
}
else{
Timeout.add(`${message.author.id}${command.name}`)
setTimeout(() => {
Timeout.delete(`${message.author.id}${command.name}`)
}, command.timeout);
}
}
command.run(client, message, args);```
I made a timeout for that, doesnt really matter in this case I guess
what is a good interval for posting statistics?
30 minutes is the default
like it handles by it self?
Hey, how will I go about fixing that the bot also reads messages about commands that dont exist?
@tall salmon well i'm not sure what's wrong it's not an issue with the top.gg api so this channel isn't correct
Like I made a typo in -ping and mistakenly changed it to -pung, but the prefix is still there, so the bot reads that message
hmm
i need an https server running to get votes right?
ok
I have a question
When we call the postStats function in the client.on ready event, does it happen after 30 minutes or happens then and there and again happens after 30 mins?
In the setInterval
It's not logging and not updating on the site either
I've been waiting and it's not posting the stats
Which lib are you using?
dblapi.js
The auto poster should post for you.
It's not logging/sending anything
Is the constructor outside the bots ready event?
could someone help me with detecting votes for my bot?
@torpid compass There is a ready-made boat that can do this for you
I was going to use the API
but I don't know how to add it to your own bot
Pretty sure it should be outside the client ready event @tall salmon
I keep getting this error https://pastebin.com/1BPpfTF4
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
const dbl = new DBL("token", { webhookPort: 5000, webhookAuth: "password" });
dbl.webhook.on('ready', hook => {
console.log(`Webhook on`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});``` but when a person vote not worl
Work*
Your constructor needs to have an auth and port set.
I have the same thing @mortal crag
My?
@jaunty plank where can we find the WebhookAuth
You define the auth as whatever you want
ohhh
Just needs to be the same between both the bot and website
No, I use the Pssowrd
Of the bot page
(The webhook password)
Webhook password is the webhook auth
Where do I find the webhook auth on the website
Edit bot webhook section
Yep they need to be the same
@jaunty plank It updates on site but doesn't log for some reason
ahh thanks so much
Ah, then no problem, the log doesn't really matter.
erm
const DBL = require('dblapi.js');
yourDBLTokenHere = "my_token"
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
that doesnt recieve anything
when i test the webhook
with password "password"
what could have gone wrong in the code?
wait, nope, it worked, i was just forwarding to the wrong url lmao
please i beg lmao
@dusk hound does your voting work because mine doesnt
I think I did something wrong
Does your bot detect voting
so when someone votes it logs in the console or something
yup
how did you do it?
express 
?
Did you find a tutorial or something or did you do it yourself?
well i read the docs of the lib im using
and i made it so it sends a request to my webserver and my webserver sends a payload to my database
Do you know what to put here
you're server ip, port, and path
server ip -> 127.0.0.1
port -> 5000
path -> vote
```the server ip i provided wouldn't work.
do you know where I can find this stuff? I didn't find anywhere in the docs that told me I had to do this xd
Well, I don't use the api's listed on the api page. I use, top-gg/wrapper
Is their a endpoint to check when a user voted, or do I have to store it myself?
I used the Api to get info about bot, and got the "points" from it, and it says 271, while my bot has like 95. Anybody knows why?
Could someone help me with detecting my bots votes
You gotta set up an endpoint where dbl can send a request when a user votes
having errors with ```py
async def on_guild_post():
print("Server count posted successfully on DBL")
it says
method has no argument
self
in the function arguments
Anyhow
i cut out some of it
You people can't just crop any sensitive data out from the public, can you
sorry
All methods in Python must implement an argument that refers to a current instance, usually named self or cls. In this case your on_guild_post method doesn't have a self argument and a cog listener decorator
I did literally give you an explanation but it seems to happen that you are not familiar with OOP in Python whatsoever
well
Add a fucking self argument to your function
So like on_guild_post(self)
It should be ingrained into you to the point where you do and notice it without realization
Yeah no shit
I said apply cog listener decorator
The event won't fire at all otherwise
You people ever read documentation
SORRY
What does "on guild post" that doesn't even come from discord.py have to do with guild join or leave
on_guild_post is an event that's emitted whenever dblpy's autopost posts a server count successfully every 30 minutes (if it's enabled)
you would do autopost=True in the DBLClient parameters to enable it
yeah I find it kind of confusing too, since they say that it should be inside the class one time but outside (as a bot event) another time
I need help with the API, regarding "test votes".
That feature is mentioned in the image (at https://top.gg/api/docs#webhooks).
But I cannot find a way to trigger a test vote... please help
test votes are the votes you trigger with the test button on your bot page
There's 2 types of Votes: upvote (vote done through voting your bot on the page) and test (the test button)
where is the test button?
ooh thanks ill look into it
oh yeah i found it now thanks
@rain heart these are the parts i use to implement the api to my bot, but it does not work, did i miss something?
import dbl
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = os.getenv("TOPGG_API_TOKEN")
self.dblpy = dbl.DBLClient(self.bot, self.token)
@bot.event
async def on_dbl_vote(data):
print(data)
can't help you, no clue of python
what is the ip you entered though? make sure it's not either 0.0.0.0 or localhost or 127.0.0.1
dm me the url, i'll test it on my end with some test data
the url to what?
the webhook
you have to enter your webhook url in your bot page settings
no wonder it doesn't work if you haven't done that
The thing you seem to be doing now is listening to the event when someone votes. That is done through webhooks
the wrapper does not simply make that happen, you need to enter the webhook url inside your bot page
do I need a separate webhook or can I implement it into my bot?
yeah i looked into that but I couldn't find anything about webhooks
https://dblpy.readthedocs.io/en/latest/api.html#client in order to use webhooks, the documentation mentions that you have to enter a webhook path and port
on the client initialisation
!p klay
you could set the path to something like /dblwehook and the port to 5050 for example
your webhook url should then be something like http://example.com:5050/dblwebhook
this is needed for getting new votes
oh so it's just an https request?
that is what a webhook is, yeah
the dplpy library creates a small webserver to listen to requests to that webhook, then fires your on_dbl_webhook or on_dbl_test_webhook when a request came through depending on what type of vote it is
That shouldn't matter, unless you're using port 80 on your webhook of the bot
then it wouldn't work
okay so i have the library and I'm using it; how do I set or know what the path is?
https://mywebserver.ok/THISPART
but you do need to enter a webhook url or no?
inside the bot page settings
oh yeah 
SPECIFY YOUR FUCKING PORT AND AUTH
READ THE DOCS
thank you for coming to my TED talk
webhook_port must be set in order for the webhook to actually run
The rest is for it to work as needed
But how do I know what to put here if I'm using the library and the library creates its own webserver with path
yes but what path?
/dblwebhook
is that the exact default?
mhm
thanks
It's the default value to enter after ip:port (or domain) in the URL
and the port is 80?
Whatever you set in webhook_port
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = os.getenv("TOPGG_API_TOKEN")
self.dblpy = dbl.DBLClient(self.bot, self.token)
like this is my code
ooooh ok
Pain, pain of existence
You haven't specified webhook_port and webhook_auth in your DBLClient
found in the docs, it's webhook_auth, webhook_path and webhook_port
yeah but the thing is i looked at another code snippet and they didn't say anything about this
Ah, you looked on top.gg/api/docs?
maybe
Or the github repo but wrong example
not github
Yeah, then it's on the docs page on top.gg
That'll be reworked soon anyway so I'd suggest referring to the official dblpy docs (soon to be renamed officially to python-sdk possibly)
Shard count is planned to be removed completely, but server count will stay afaik
so how to use the events?
alright sammy I will try to make a python snippet for this and i will tell you how to do it
ooh wow. Thank you very much.
alright i think i need help again, this isn't working
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = os.getenv("TOPGG_API_TOKEN")
self.webhook_auth = os.getenv("TOPGG_AUTH")
self.dblpy = dbl.DBLClient(
self.bot,
self.token,
webhook_auth=self.webhook_auth
)
@bot.event
async def on_dbl_vote(data):
print("SOMEONE VOTED!")
@bot.event
async def on_dbl_test(data):
print("SOMEONE TESTED!")
this is my code
It's not printing anything during test, I don't know what to do...
wht is bot there?
?
is it the client u use for discord?
and it says port is optional and i guess the default is 80 because someone said that
yes
but it does not work...
i had the same doubt, i tried similar ones as well
but i did actually try with a port
optional in the sense of "If you do not use webhooks, you do not need to set it"
6000
did you enter that port in the webhook url too?
oh
yes
so for example http://example.com:6000/dblwebhook ?
yep
remember that you can't use https by the way
i did
try http if you always tried https
because https then refers back to 443 and that just breaks it entirely
make sure the path is correct
since this may be for the wrong webserver
nah it's not
but i have 2
look: http:// is always used for website stuff, if no port (in the sense of example.com**:6000**) is given, it will always refer to 80, your default webserver port as you know it
Do you know how to use the event references in python?
i tried many ways
none seem to work
Nope, no clue about python
i just understand docs
lmao
how many servers your bot is in (in total)?
What did you change
i added the port 🐶
to where? the webhook url?
yes
dm me the url, I'll try testing it from my end
to my webhook?
i had 4000 before
80 is occupied by your main page
set it to 5000 then maybe
because it just times out for me
my mainpage is 8080
does it say any errors in your console?
I have no clue then 
oh
did you connect without a port?
then it connected to the main page
or the main webserver
so what can i set my main webserver's port to to make this work?
main server does work
yes
it just says Your bot name is alive
yeah
maybe i should just skip the whole client thing and use the main webserver instead
or delete the main webserver
it's a keepalive server
maybe i can delete the main webserver and just use the topgg webserver
YES
IT WORKS
FINALLY
you just deleted the webserver and it worked?
yep
so that was a keepalive server
maybe i can just use the dbl server instead as a keepalive?
probably yeah
Is this code correct to show server count? Do I need to add something different?
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.cache.size);
}, 1800000);
});```
did you set your token through const dbl = new DBL('Your top.gg token', client);?
oh i forgot that
Could someone possibly assist me with setting up vote detection? So when someone votes it does something
I've been trying but It's not working
You need to create a webhook
more about it in https://top.gg/api/docs
I made a webhook
do I have to put the link in there?
When I paste it in there it says its not designed for that
How do I do that
Look for your corresponding library
you're using for your bot
I did this and used the code
Post what you're using
also, you need to add the url of it in your bot page settings afterwards
dbl.webhook.on('vote', vote => {
console.log(`${vote.user} has voted for Counter!`)
const webhook = new Discord.WebhookClient('id of webhook', 'webhook stuff here in code')
webhook.send(`${vote.user} has voted for me!`)
});
What do you mean by this?
You need to add the url of your webhook
you started your webhook on a specific port
that port is used for sending requests to it
it most likely looks like http://example.com:5000/dblwebhook
just instead of example.com:5000 replacing it with your servers ip and the port you defined
Where can I find my servers IP? I use Heroku for my hosting
Okay, so If I were to get the IP for my server
I would then paste the URL into the webhook URL
and it would work?
it should if you started the webhook correctly
if you followed the documentation correctly
lovely
uh okay, thanks for the help though <3
@rain heart is there a bot that's already made to detect votes?
okay thanks
lol just ping the url for the app
so like im running something
on heroku
if i ping
it
it pings as down because they keep ICMP off on their servers
but you can
so
if you
are
wait what
whats the url for your app?
For Heroku?
read pins/channel topic
you will see the url on the bottom of the build output you can see your newest or previous build in the activity section of your apps heroku dashboard
hang on let me find it
@rain heart Im pretty much confused about the api code , can you pls help me out btw Im hosting on glitch console
server count one **
if you're confused with the documentations, then i cannot help you
Come back to it once you're able to understand documentations
you got it wrong
Im just saying I am confused about that server count one
Just sort me out pls
wheres the api docmented
@still shore https://top.gg/api/docs#jslib the postStats one is there too
anyone knows any good sites that can help with the webhooks for notifications when a server gets a vote?
define notification?
like for example when someone votes a server, it'll send a message in a channel? or any other way so my bot can know that someone voted
¯_(ツ)_/¯
I have the IP for my server
do I put it like this
0.000.000.00:5000/dblwebhook
instead of the 0.000.000.00 your servers ip then
yes
Hello
i need some help with the server count thing for pyhton
im unsure if the count is actually going there
it isnt
can you help me fix that?
class Topgg(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, client):
self.client = client
self.token = 'mytoken' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.client, self.token, autopost=True) # Autopost will post your guild count every 30 minutes
async def on_guild_post(self):
print("Server count posted successfully on DBL")
def setup(client):
client.add_cog(Topgg(client))
@slim storm
i did
im not getting errors
so whats wrong?
like
i followed the tut
the Doc
self.token = 'mytoken' # set this to your DBL token
yep
in my token
just dont wanna leak that
yes
the doc uses bot
these are im imports ```
import dbl
import discord
from discord.ext import commands
no :/
my bot was online all night last night and all of today
no post yet :/
no :/
thats the thing
ive even reloaded the cog
Add the cog listener decorator
I'm really starting to question whether maintaining dblpy was a good idea
Really though
Use the commands.Cog.listener decorator, apply it to your on_guild_post function
class Topgg(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, client):
self.client = client
self.token = 'mytoken' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.client, 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 on DBL")
def setup(client):
client.add_cog(Topgg(client))
like this?
so
yes no?
You don't know what a decorator is
Look it up and you'll understand what to put there
i did look it up
but
im am still confused :/
can you help
please
@sullen nymph @acoustic dove
What is a decorator
aghhhhhhhhhhhhhh
im just confused
Then maybe find out what a decorator is
Get what?
Yeah because you're missing basic knowledge
If you look at the links I sent, you will definitely have your answer
this is frustrating
this right
sigh
Just try it
i did
And..?
what do you have


