#topgg-api
1 messages Β· Page 121 of 1
it's deprecated, switch to @top-gg/sdk https://www.npmjs.com/package/@top-gg/sdk
What do you mean, it won't work anymore?
It's not maintained anymore
But will "dblapi.js" return?
Nope, it's @top-gg/sdk now
okok
How do I find out when someone voted for my bot?
api.hasVoted
I mean, when someone voted for my bot, I want to know if there's a way to let me know!
using webhooks
What use?
Why am i seeing nothing in my console after voting?? i am basically using the code of the docs to test before i add more stuff...I am expecting the user who voted to be logged or am i misunderstanding?
fetch('https://top.gg/api', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': "xxxxxx"
},
}).then(response => response.json())
.then(data => console.log(data));
}
there is any error here?
port forward if your hosting on a home network, allow through any firewalls you may have, use the correct url and auth header on the website, if using a weird hoster like heroku, glitch or repl youll need to use their methods for the url/port @wheat copper
im using something.host and i am using their subdomain ip service thing... my service is running on the 2000 port on the subdomain, i am using the correct url and auth password @jaunty plank
Explain more pls
you'd need a body with the details
wut is the details
sorry - this is a simple question, i know ..
how do i check if a user has voted for the bot or not?
checking if they have youd use the /bots/{bot.id?}/check endpoint, or using the relevant libs method.
https://top.gg/api/docs#bots
Why are you sending this
show code
is this eris
no, discord.js
400: Bad Request means you're sending some values wrong
??
can you eval Client.shard.count
Wait, I have an idea, I changed Client.shardManager .... for Client.guilds.cache.size, because it must be counting by shard
btw you can use https://www.npmjs.com/package/topgg-autoposter for autoposting
you don't need to define everything https://i.imgur.com/UswZG70.png
π
Okay!
nice
Thank you @willow spindle
Is that wrong?
or is it so?
If my webhook site is not online, will it crash, or will it just ignore it?
you mean if you stop the bot and someone vote?
Yes
nothing is going to happen
Hi
well if you want to see the votes
const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express() // Your express app
const webhook = new Topgg.Webhook('topggauth123') // add your top.gg webhook authorization (not bot token)
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
// req.vote is your vote object e.g
console.log(req.vote.user) // 221221226561929217
}) // attach the middleware
app.listen(2000) // your port
here
I need help with server count in python
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = 'XYZ'
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
async def on_guild_post():
print("Server count posted successfully")
def setup(bot):
bot.add_cog(TopGG(bot))
Can I use https://discord.com/api/webhooks/---------- this as vote webhook?
No
404 error getting too
Why have i suddenly received this
didn't do anything different
me too owo ++
I see maybe they having some issues
no idea
?
No clue
Do i replace client with "discord.js" after dbl token?
Oh alright
If I don't have shards etc, just doing
db.postStats(client.guilds.cache.size)
Will work?
Nvm i got it
Another Question:
I see db.webhook.on("vote")
Can i just do db.on("vote")?
No
Then how do i trigger an event when someone votes?
I didn't want webhook to send message but bot
You use a vote event listener?
dblapi.js deprecated, switch to @top-gg/sdk https://www.npmjs.com/package/@top-gg/sdk
How do I vote with my own ip?
Where is that given? I can't find
webhook.on("vote")
But "dblapi.js" is not working!?
Hm..
Do i still have to use webhook.on even when i want to send messages through bot?
Okay, how do I now put it on the website's webhook @sullen nymph ?
Yes, because the webhook is what receives the data
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
What to put in password?
Where do i get the pass?
How to get api?
What do I do to place the app?
Anything of your own choice
How to get api key pls teach me
Because I'm making ranking sticks
@sullen nymph Pls
Ranking what?
const DBL = require("dblapi.js")
const dbl = new DBL(config.dbltoken, { webhookPort: 5000 }, client)
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on("vote", async vote => {
let voter = await client.users.fetch(vote.user.id)
let voteem = new Discord.MessageEmbed()
.setTitle("Vote Recieved")
.setColor("RANDOM")
.setDescription(`${voter.tag} has just Voted for the Bot!\nThank You! :heart:\nPlease [Click Here](https://top.gg/bot/781506063882387506/vote) to Vote for the Bot.`)
client.channels.cache.get("787659734941040660").send(voteem)
})```
It doesn't works for some reason.
so dblapi now old?
Yes
sa
the must vote things is same
There is a function which checks if user voted or not
ok
ah.... what do u need exactly
?
Why does the webhook dosent work?
mine is also not working
@floral widget @plucky compass python?
hmm u use python 3.9?
javascript
Good evening what is the global code with the API?
global code?
as in the actual endpoints for any lang?
https://top.gg/api/docs#intro covers that kind of stuff.
I would just like a complete code with everything already done
well, it kind of depends on your lib, language, and what you plan to do
I am a beginner so I will use: JavaScript, and I want to make sure that when a vote takes place, it is marked in a living room
Sounds like you want the webhooks.
https://github.com/top-gg/node-sdk#webhook-server
help
the webhooks and stuff are not working
i'm using the new SDK
here's my code
wheres the code being hosted?
@livid egret the url to your webhook receiver.
typically in the format http://ip:port/path
var express = require('express');
var app = express();
app.get('/', (req, res) => {
res.sendFile(__dirname + '/website/index.html');
});
const Topgg = require('@top-gg/sdk')
const webhook = new Topgg.Webhook('password')
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
console.log(req.vote);
})
why won't that work?
then i type in the URL (https://thundebot.yodacode.repl.co/dblwebhook) and it doesn't work
i dont see where you use app.listen()
oh btw, this is the server listen part: ```js
app.listen(30485, () => {
console.log('Open on *:30485');
});```
there it is
8080
^
ok
Still nothing
main page
for the web server
nothing logs in the console
like it's supposed to
any ideas?
Fun
that's the exact code
var express = require('express');
var app = express();
app.get('/', (req, res) => {
res.sendFile(__dirname + '/website/index.html');
});
const Topgg = require('@top-gg/sdk')
const webhook = new Topgg.Webhook('password')
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
console.log(req.vote);
})
app.listen(8080, () => {
console.log('Open on *:8080');
});
Did you make sure to save the file and restart the repl
yeah lol i might be stupid but not that stupid
i restarted it
do you want to join?
I'm good
is there any reason it wouldn't be working?
i've tried http://, https://, including the port, removing the port, etc, changing the pawssword
Not exactly sure why it's not working
Do you have another server running on the same repl?
no
i'm using the new sdk
and it uses express middleware
here are the only other pages:
app.get('/', (req, res) => {
res.sendFile(__dirname + '/website/index.html');
});
app.get('/status', (req, res) => {
res.sendFile(__dirname + '/website/status.html');
});
is dblapi.js not maintained anymore?
whenever i use it, it says invalid api token
that also didn't work
so can anyone help? #topgg-api message
i've looked at the docs
and done everything they say
my server ip?
yep
multiple people can ask questions here at once
we have been helping yours for awhile now
well nothing is working
Remove the port and set it to https
Magic
Mhm
for dblapi.js i have this as the setupline: js const dbl = new DBL("my_token", { webhookPort: 5000, webhookAuth: 'password' }); yet it always says invalid token, even though these tokens worked like a week ago when i tested them. did something change?
Regenerate yours π€
I did, still wont work
Interesting
im just asking to see what could have gone wrong, even when my token is correct
wait
it gives that long error
but it still receives the votes
quite peculiar
why dbl [vote / test] event doesnt work?
it can not work for a ton of reasons
all things look ok
improper auth, url, unreachable server(firewalls, lack of port forwarding), improper configuration, etc
np
Hi, How can I post the server where are my bot? I have this event
dbl.on(34, () => {
console.log('Server count posted!');
})
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.cache.size)
}, 1800000)
});
whats dbl.on(34)
dbl.on(34)???!?!
I have the same level of confusion as you
const DBL = require('dblapi.js');
const dbl = new DBL("my token", { webhookPort: 9999, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
// Optional events
dbl.on(34, () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
dbl.getStats("718059057490952256").then(stats => {
console.log(stats) // {"server_count":2,"shards":[]}
});
// <-- PROPIEDAD LOGIN: -->
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.cache.size)
}, 1800000)
});
dbl.on(34)????????????????????????????????????????????
That put in DBL API docs
Did they?
Thatβs .on('posted')
can someone pleaseee help me setup an even for my python bot to know when someone has voted for the bot on top.gg?
howcan i get my bot's votes with the api?
Go here, then click on the section labeled python: https://top.gg/api/docs
then open the github, and it will give you examples on how to set it up and use the library
Go to the link, then select the language your bot is in, then there will be examples and just find what you want to do with the api
how use webhook upvote log?
yeah they dont work when I added it to my code
if i remember correctly, you need a website, or location for top.gg to send requests,
then on that location, you receive post requests
how would I get a website for it?
did you add the libraries to your project and import the correct files,
did you also input your bots token and id?
well, im coding in python
i dont know how to do anything lol
free options would be something like glitch or repl if irrc, then send that information from the website to a database,
then have your bot read from that database
should use the discord webhook?
How do I do the webhook thing for my bot?
you cant use discord webhooks for top.gg webhooks,
top.gg webhooks aren't meant to send messages, its used to send user information, for the bot to read
https://top.gg/api/docs#webhooks
webhooks can be found on your bots page, click edit -> webhooks
I mean how do I setup?
so what are the basics to set a thing up so I can see when my bot gets a vote?
#topgg-api message
click the link in this message
and you need to setup a system on the website to receive and process the post requests
you cant you dont have a bot on top.gg
Oh ok
How to make this way??
well my bot will apparently reviewed soon so I'll probably get it done soon
How would I setup a system to do that?
like in here?
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
couldn't find anything on it, only finding last 1000 votes, is there no way to get the number of votes that my bot has?
so what do I put here?
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
you can use .getVoters(botId) to receive the total voters, with user information,
.getVoters(botId)
however, past 1k votes, you should use a webhook to get all the users votes as having the top.gg api return 1k+ users would be too much
ah, i see, makes sense, thanks!
are you using python andromda?
the api, you can only get votes when you call the function,
however, a webhook will receive the voter information at the time the user votes, so immediately
have you done this before?
also, sorry, but you may need to ask someone else, its been way too long since i've coded a bot in python
I guess I'll just have to wait until my bot gets verified and which wont be too long since it's already on 90%
dang it
I've done it about a year or two ago
so its been too long for me to completely remember, i just remember the path you should go down
async def on_dbl_vote(self, data):
"""An event that is called whenever someone votes for the bot on top.gg."""
print("Received an upvote:", "\n", data, sep="")```
how would I get this to work?
do you know that?
webhooks are not commands,
and i had a website that top.gg sent post requests to, then i had that website post the information to a free database, then had my bot read from the database
oh ok
this is roughly what i used
@app.route('/voter', methods=['POST', 'GET'])
def voter():
if request.method == 'GET':
arg = request.args.get('Access')
if not arg:
return render_template('notallowed.html')
else:
return render_template('voter.html')
else:
auth = request.headers.get('Authorization')
if not str(auth) == 'AUTH_TOKEN':
return render_template('notallowed.html')
req_data = request.get_json()
userid = int(req_data['user'])
weekend = req_data['isWeekend']
amount = 500
if weekend:
amount = amount*2
database.addbalance(userid,amount)
database.addvote(userid, amount)
return render_template('voter.html')
Bot background code?
what do you mean
it is basic html/css. Check #announcements for class names
we won't spoonfeed you
I can't get the api to post a webhook to my bot anyone else having that issue ?
What does the webhook url look like? is it from discord?
No its from my http lib
local http = require("http")
http.createServer(function (req, res)
for x, c in pairs(res) do
print(x, c)
end
for k, v in pairs(req) do
print(k, v)
if tostring(k) == 'headers' then
for y, z in pairs(v) do
print(y, z)
for a, b in pairs(z) do
print(a, b)
end
end
end
end
res.statusCode = 200
res.statusMessage = ""
res:setHeader("Content-Length", 0)
res:finish()
end):listen(80, "0.0.0.0")
make manual requests through postman and see if that works
It does
make sure you preseed save before pressing test
i highly suggest using a different port than 80
use 5000 or smth
and the second format is correct
didnt want to have to open an other port π
π
alrigth ty gonna try it out
so the language im using isint supported by the api is it possible to make get requests to the api using http ?
thats how api requests work, yes.
might be useful for getting the endpoints
=id?
/check should be enough
as you're passing the bot id through /bots/botid/check
ohh wait
it says query string, mb
npnp
should be something like /botid/check?userid=123456789101 for example
Yeah seems good, im getting a response {"error":"Not Found"}
make sure to use the DBL token in the authorization header
Not 100% sure, but i highly assume that it is
hmm yeah might be why i can't get anything but not found as a response even with proper data
make sure to use the correct request method
as indicated on the corresponding endpoint on the docs
yeah, i do.
same
So i been trying really hard to get the body of the data from tog.gg
I legit printed all of my req and res table and i cannot find anything relevant.
Can anyone point me in the right direction? I was told it should be called params or body but i cant find any of those.
what are you using for your http server?
im using luvit
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!`);
});
how to get the password
webhookAuth: 'password'
password of what
no page found
-_-
Copy ID of your bot
I am asking for the password
should I give Id in password?
no
Authorization?
no, just right click your bot (name), Copy ID, the replace [yourbotid] with your bot's ID you just copied.
if you mean the the library that is shown on your bots widget,
the library field deprecated and no longer used, so it wont be shown until the widgets update
is there any example for sharding with new top-gg.sdk
the autoposter has one, if using the autosharder
const AutoPoster = require('topgg-autoposter')
const poster = AutoPoster('topggtoken', client) // your djs client/shardingmanager or eris client
anyone got status 301 before ? i know its for redirects but why ?
'on_connect' { headers = { { 'Date', 'Mon, 14 Dec 2020 04:56:13 GMT' }, { 'Transfer-Encoding', 'chunked' }, { 'Connection', 'close' }, { 'Cache-Control', 'max-age=3600' }, { 'Expires', 'Mon, 14 Dec 2020 05:56:13 GMT' }, { 'Location', 'https://top.gg/api/bots/id/check?userid=181447655434485760' }, { 'cf-request-id', '07013444690000ecee24ad0000000001' }, { 'X-Content-Type-Options', 'nosniff' }, { 'Server', 'cloudflare' }, { 'CF-RAY', '6015564d7f2eecee-YUL' } }, statusCode = 301 }
'on_end'
what're endpoint or domain are you using exactly?
are you still using the discordbots.org domain?
it works in chrome
try change the ?userId to ?userid does that work?
It has to be cap I
it looks like that's what it's trying to redirect you to
but that doesn't make sense either way
you're unauthorized
yeah must be my ssl certificate
?
do you know if the connection needs to be https ? I made it https because i thought it may be the source of the redirecting
yeah it will redirect if it's not https due to cloudflare enforced https
oh damn ok..
the 401 is unrelated, are you passing your authorization header?
go to https://top.gg/api/docs#mybots and copy and paste your authorization token from your bot into your requests header for Authorization
you're logged in so it does
your logged in
oooooooo
from your backend it doesn't
yeah theres no docs for this lib im using so its kinda hard to do anything
gonna take like 30 mins to find how to do it for node.js and then convert it to my lib
Hey is anyone able to help me set up web hooks for a on vote event
Itβs great how when I type in here it dies
what lib/lang
maybe when berry comes back, not a py user 
3.9 has been out for a while now
Ik
Dbl doesnβt work with it tho
So I move back down to 3.8.6
It also has access to older libs
rip berry pls get back online
Shouldn't this work as headers ??
headers = {['Authorization'] = "key"}
Why is that string in a list
the key string ?
@supple karma yo
because my key isint a variable so i replaced it with key before posting it here @sullen nymph
well in lua arrays and lists are the same really
sooo thats why if i did [ ] it would be the same
Arrays and lists...
And in this case you use a dictionary
You don't fucking use lists in a dictionary here
no thats a thing in the lib im using but its ok its not a big deal
I literally just tried it and it doesn't work if you use a list so
// DBL Vote
const DBL = require("dblapi.js");
const dbl = new DBL("my dbl token", { webhookPort: 3031, webhookAuth: "dbl token" }, client);
dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
channel12 = "[#787341583376580608](/guild/264445053596991498/channel/787341583376580608/)"
dbl.webhook.on('vote', vote => { console.log(vote)
message.channel12.send(`User with ID ${vote.user} just voted!`);
u = client.users.cache.get(vote.user);
const voteembed = new Discord.MessageEmbed()
.setTitle("Thank You for Voting!!!")
.setDescription(`Can you please vote for me again in 12 hours? \n To vote for me again, Please follow this link \n **[Click here to vote for me](https://top.gg/bot/761998174432395285/vote)**`)
if (u) u.send(voteembed) });```
my this no send dm, nor send any message in mentioned channel
@nimble fossil
someone pls help
Whatβs your problem
?
sir
@pulsar palm @pale fulcrum
you need to fetch or get the channel
its possible that the user is not cached use client.users.fetch(userid) to replace your client.users.cache.get with
@slim hemlock why haven't you used the new dbl SDK,
that will dm a particular user onlu
???
?
@slim hemlock read the latest pin
(userid)
ok
// DBL Vote
const express = require('express')
const Topgg = require('@top-gg/sdk')
const webhook = new Topgg.Webhook('topggauth123')
const dbl = new DBL("token", { webhookPort: 3031, webhookAuth: "token" }, client);
dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
channel12 = "[#787341583376580608](/guild/264445053596991498/channel/787341583376580608/)"
dbl.webhook.on('vote', vote => { console.log(vote)
message.channel12.send(`User with ID ${vote.user} just voted!`);
u = client.users.cache.get(vote.user);
const voteembed = new Discord.MessageEmbed()
.setTitle("Thank You for Voting!!!")
.setDescription(`Can you please vote for me again in 12 hours? \n To vote for me again, Please follow this link \n **[Click here to vote for me](https://top.gg/bot/761998174432395285/vote)**`)
if (u) u.send(voteembed) });```
its ok now?
@pulsar palm
its not needed lol
???
not you
please modify my code and respost
also you still need to fetch the channel
replace channel12 = "[#787341583376580608](/guild/264445053596991498/channel/787341583376580608/)" with channel12 = client.channels.cache.get("787341583376580608")
fetch the user incase its not cached
const webhook = new Topgg.Webhook('topggauth123')
const dbl = new DBL("token", { webhookPort: 3031, webhookAuth: "token" }, client);
dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
channel12 = client.channels.cache.get("787341583376580608")
dbl.webhook.on('vote', vote => { console.log(vote)
message.channel12.send(`User with ID ${vote.user} just voted!`);
u = client.users.cache.get(vote.user);
const voteembed = new Discord.MessageEmbed()
.setTitle("Thank You for Voting!!!")
.setDescription(`Can you please vote for me again in 12 hours? \n To vote for me again, Please follow this link \n **[Click here to vote for me](https://top.gg/bot/761998174432395285/vote)**`)
if (u) u.send(voteembed) });```
this is my code now
@dense shale
i told you what to do, im not allowed to spoonfeed
ur allowed to tell other mistakes 
try and see if it works lol
ok
@slim hemlock you seem to be using like two different libs, check the pins for the new library and one of the examples shows you how to setup webhooks
const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express() // Your express app
const webhook = new Topgg.Webhook('topggauth123') // add your top.gg webhook authorization (not bot token)
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
// req.vote is your vote object e.g
console.log(req.vote.user) // 221221226561929217
}) // attach the middleware
app.listen(3000) // your port``` won't this put who posted in console.log?
@hearty lintel
if you have your server set up properly yes
i need in a channel ;-;
oh i can replace console.log to message.channel12.send and give channel 12 a value
right? @hearty lintel
idk how your code works but what i can tell you is req.vote.user is the user's ID
do with that what you will that should be all the info you need
uff, k
webhookAuth: 'password'
password kΔ±smΔ±na nasΔ±l doldurmalΔ±yΔ±m
Bi Εifre seΓ§ ve oraya yaz
Sonrada botunun edit sayfasΔ±na git ve en altta webhook password var
Oraya yazdΔ±ΔΔ±n Εifreyi oraya yaz
tamam teΕekkΓΌrler
speak enG
@restive otter peki yourDBLTokenHerekΔ±smΔ±nΔ± nasΔ±l doldurmalΔ±yΔ±m
https://top.gg/api/docs kΔ±smΔ±ndan My bots a gir ve dbl tokeni ordan al
How do I get the Webhook URL when using dblpy so I can check for Votes?
Since It has a builtin Webhook System
yep
hey, if you dm me in half an hour or so i may be able to share some code with you for the webhook
wdym
d
no
Isn't it that way
How do we get the webhook URL
help me
Webhook url is your server url lol
Where you host your webhook server
hello actually i was trying to add discord bot api widgets on my wiki but servers and library api is not working properly it's saying undefined
can anyone help ?
lib undefined and servers undefined
it's a verified bot
@atomic spindle I believe they were meant go remove that
header
@uncut quartz pass the Authorization header with your token
can someone help me with a message that gets sent when someone votes on my bot?
Is there a bot that I can add xp on my own like if do !add xp 5
this is not api related
what am i supposed to see in my console when i test webhook?
get_weekend_status() returns true or false right?
does the secret get sent when you do tests ?
yes
ok thanks
anyone?
Why does the webhook dosent work?
hi
Hey
Hey
Hey
Do I need to respond with 200 http response code to top.gg's post request? Or can I be lazy and just ignore it after receiving the data I need
*for voting webhooks
well it'd be a lot better to send a response back
Is it necessary in this case though
You know what it'll take me 5 seconds I'll just do it
How do I configure the Webhooks?
you can set up the url at https://top.gg/bot/your-bot-id/webhooks
What do I put in the second option?
whoa hol up
you gotta put the url of the endpoint you want requests to go
π€¨
I don't have a web server, so you can't
const DBL = require('dblapi.js');
const http = require('http');
const appo = express();
const server = http.createServer(appo);
const dbl = new DBL(process.env.DBL, { webhookAuth: '', webhookServer: server });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
app.get('/', (req, res) => {
// ...
});
server.listen(5000, () => {
console.log('Listening');
});
So i've got this here but What is the url i need to do in my bots page?
i think by default the path is /dblwebhook or something
So you should put http://your-server-ip/dblwebhook
yea thats it
http://example.militia21.repl.co/dblwebhook
is this the url?

domain 
?
domain?
im guessing you meant if you can use webhooks with anything other than urls, which the answer to is no
yes, a domain name
like can i use my github pages site?
no
oh so a domain is specifically needed
you need an actual webserver running and handling requests
also no
a domain is just a pointer to an ip
using express?
google.com is a domain
sure, whatever you prefer
but you have to use a url that points to your webserver
there's no other way around it
ok so if my webhook uri is for example,
https://something and so on , i can receive requests specifally from that?
well, yes and no, the way you put it is way too abstract
the url has to be tied to your webserver, now it can be a direct ip:port or domain:port, doesn't matter which one
can this be a github pages site uri with the webhook port and all
ni
no
got it thx
github sites is only for hosting static pages, you need an actual machine, a server
like where the bot is hosted?
correct
found 1 moderate severity vulnerability
run npm audit fix to fix them, or npm audit for details
how do i fix this while installing dblapi.js?
i ran npm i dblapi.js
Why?
You shouldn't have to watch ads just to see that you already voted for a bot
bruh agreed
Wrong channel for feedback
I dont see any channel called feedback
I am very uncertain of the fact that you have read #502193464054644737 in this case
:p
Can anyone tell how does top.gg webhook work?
it's like u need to add ports etcc
Why do I need to add port etc ?
you know web servers and stuff?
Yes
But why does it need and how does it work ?
Or anyone can give me a practical demo ?
for example
lmao wait
If you got an express app:
// Some stuff
app.post('/dblwebhook', (req, res) => {
const { user } = req.body;
console.log(`A user by the ID "${user}" just voted!`);
// Handle some other stuff
});
then you can register that endpoint on your bot's webhook
I saw this same example on npm docs
but from where is it getting /dblwebhook
we need tocreate our own webserver ?
wait a sec
Ok
Yeah
const dbl = new DBL(yourDBLTokenHere, { webhookAuth: 'password', webhookServer: server });
Which password ?
that's a password the thing can use to verify that requests come from top.gg
if you set it, you gotta also set it on the webhook options of your bot
Didnt get u
like
There you can set the endpoint
And you can also set a password
which will be sent with the request, and will be used to verify the request
oh that's if you want to use it to an existing server
if the webhook is the only thing you got you can leave that in blank
what if it is a new server
just leave it there
for detecting votes
Ok
when it sends request to my server
then what does my server do after it receives the request ?
You can do whatever you want with the info
Oh
You receive stuff like the user id
So I can set roles etc
yea
many things like that ?
and there is a bot called DBLVote
is it official bot of top.gg ?
DBL Vote#2244
Thats on the docs
yea
wdym?
Yes
lmao cool
self.dblpy = dbl.DBLClient(self.client, self.token, webhook_path='/dblwebhook', webhook_auth='pass', webhook_port=5000)```
should i set webhook path to something else?
U can if u want
lol
u can keep /dbl
or just /
Or u can keep it as it is.
yes
@willow spindle Sorry for ping
But I have 1 doubt
is DBL Vote bot official bot of top.gg ?
no
Ok
and one more thing
does this bot
use the dbl.webhook.on event ?
dbl.webhook.on('vote', vote => {
This ?
i don't know about this bot. Ask their developer
Oh Ok thnxs
/bots/{bot.id?}/check?userId=XXX
?help
thanks β€οΈ
!help
I try to edit N/A
can you help me
how ?
no prob
try passport
How to get the upvotes of bot using python api wrapper of top.gg?
or through the top.gg api
But i dont see any of the options like upvotes...:/
@visual lodge .points is total and .monthlyPoints is monthly
so the whats the link?
this one?
https://top.gg/api/bots/put-bot-id/points?
can you read the docs
how do i make the hostname my actual hostname?
how can we do this way
@restive otter the dblapi lib will always log 0.0.0.0, as 0.0.0.0 just means "any ip at this location"
@prisma path through da api
what exactly should i do
read the doc it explains it very well
python?
how to fix that n/a
post the server count
you can add css to markdown
Is there a docs for that'
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')
})
im using this in my index.js file but i get ReferenceError: Discord is not defined
then define it...?
LOL
TypeError: Class constructor Client cannot be invoked without 'new' when trying to use the topgg-autoposter
Yeah, you need an instance of client.
... which requires to load the djs lib, too for example and use the created var (probably client) as arg in the autoposter method
as the comment says
Thx
a
const dbl = new DBL(censored, { webhookPort: 5000, webhookAuth: 'password' }); when i paste my token i get error: "censored" is not defined
I get {"error":"Not Found"} when sending POST /api/bots/stats with good content-type and authorization token + json as body
Do I have to wait for the bot to be approved to send count ?
Correct
Okay, thx
I can't configure the webhook too..
@commands.Cog.listener()
async def on_dbl_test(self, data):
"""An event that is called whenever someone tests the webhook system for your bot on top.gg."""
print("Received a test upvote:", "\n", data, sep="")
this is not work
someone knows why
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
Do i have to just put it in my bot file and it will start showing server count i mean do i have to do something on website?
You can implement the code into ur bots code or load the djs for example to start a second instance of your app to report to top.gg
dbl.on is not a function
how to fix ?
const dbl = new DBL('token', client);
dbl.on('posted', () => {
console.log('Server count posted!');
})
this is my code
I replaced token with my gg token :P
so don't ask for that
can anyone help ?
do u use python 3.9?
3.7
whats the difference between node-fetch and node-superfetch?
y tho
@fast agate
What is the name of the npm packet?
@top-gg/sdk
can someone send me a link on how to track votes
ty
go topics then votes
i think that's the correct one
wait that's the wrong one
my bad
what language/library are you using for your bot/application?
DiscordJS
Also, is there a way to trigger the vote event without someone voting so i can test?
Is there any tutorial how to use the API for Python?
yea
if you are using discord.js go to "tools" then select javascript library
i think that gives all the information you need
idk if there is
the docs are there
dbl.hasVoted("406880301449478144").then(voted => {
if (voted) console.log("User has voted!!!")
});
``` the above works, but the below does not
```js
dblWeb.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
const dblWeb = new DBL("token", {
webhookPort: 5000,
webhookAuth: 'password'
});
const dbl = new DBL("token", client)
Discord.js
yea but i want to see when someone votes
not if theyve voted within the last 12 hours
does it show any errors?
have you registered the webhook url?
dblWeb.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});``` we are talking about this line of code right?
does it work when you remove .webhook ?
dblWeb.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
``` this works tho
strange
i think someone has to vote the bot for that to work
yes
every box on the webhooks page is filled
wdym
well if you haven't port forwarded your server its not possible to access it
how do i do that for both
ight
that should be possible
but i think this is a question for #development , @wise badge
alr
oh i thought it was discord's api
hi
should I use data.user or data['user']?
either works
so if I want to use https://iro.js.org/colorPicker_api.html this api, do I just require it, then use it like I do the Discord api?
anyone able to help on a vote command?
Hello do you have api fortnite shop french please?
this channel is for top.gg API
ima take it as no one can help then
back to finding legit nothing on how to use get_user_vote
What is the event for if someone votes
Okay sorry
depends on the lib
@top-gg/sdk
looks like its the app.post('/dblwebhook')
https://github.com/top-gg/node-sdk#webhook-server
and for me?
what do i do with it tho
was meant for tijme
cos i wanna check if someone has voted and use it for rewards
What is the right one then?
oh ok
Ohh
But app.post('/dblwebhook') is not an event right?
Ahh, you have to use the webhook
for receiving vote events yes.
Thanks
whats the method to remove more than one element at the start of an array?
do i have to change anything in
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
to make it auto trigger the
@commands.Cog.listener()
async def on_dbl_vote(self, data):
Please help me set this up
this should work afaik, make sure to change the webhook_auth though to something else
has to be the same in your bot page settings though
dont use python 3.9 or +
thank you. I'm using 3.8
still struggling with this api... node sdk is pretty straightforward tbh
use the webhooks
how can i let my discord bot acess eve echoes market to just gather info
See channel topic
oops
I

50mb of error log of the same xd




