#topgg-api
1 messages · Page 113 of 1
To test locally, you can add an or to or between the env var and the testing port.
For example
webhookPort: process.env.PORT || 5000
Will be 5000 when not on heroku.
Note, the url won't work in the test env either
i see, should i put it on the url too?
Since its being hosted at a seperate location
so i will not receive anything from console?
Nope, since locally run code isn't at a heroku url
You can still test it with something like postman
If that's something you wanted to do
so i should test it on heroku?
I would.
okay last question
let me understand, i should put this piece of code in the index.js and then on the vote command i use the "hasVoted" piece of code?
So, personally I would use the webhook for everything and would track has voted yourself.
If you need to use hasvoted, you can, but with limited api requests you could rather quickly get ratelimited.
so how should i do to verify if a user has voted and give them rewards with the webhook?
i set this code to the index and then?
so i should log what webhook tells somewhere and then check from there?
You can just give the user the reward right in the vote event
If you want to put it somewhere else, and check somewhere else thats okay to do too. But may not be needed.
i see so its just put that piece of code in the index and i am all done?
I mean, it won't give rewards. The code just currently logs it to console.
yes yes, i will add that
Then yeah, right into index is fine.
well, thak you a lot you are a really really patient and kind person
i really appreaciated your help
i will try it on heroku now
@jaunty plank excuse me sir, i am testing it with heroku but no response from test...
are you sure the url is pointing to the correct public heroku url?
ah, tell me if you are annoyed or need to rest
dw about it.
are you sure the url is pointing to the correct public heroku url?
the url i am using is the one i posted before
https://dogmahost.herokuapp.com/dblwebhook
not sure the link is public? https://dogmahost.herokuapp.com/
this is the domain
so, on your heroku dashboard, the name is exactly dogmahost
i think this would be it
heroku isnt giving any errors correct?
no errors thought
wait i found this on heroku logs: 2020-11-17T22:35:01.884300+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/dblwebhook" host=dogmahost.herokuapp.com request_id=0ff76b6c-2bff-4736-9e23-bcb6c8aee83d fwd="165.22.130.154" dyno= connect= service= status=503 bytes= protocol=https
yes
honestly, zero clue at this point then.
😿
okay, is this line being logged?
Webhook running at http://${hook.hostname}:${hook.port}${hook.path}
i dont see it
then the webhook isnt running then
hmmm, so i should change the url?
it shouldnt be the url, the webhook runs in your code.
so the code is wrong
i guess. these are the frustrating issues.
yeah
const DBL = require('dblapi.js');
const dbl = new DBL('yourDBLTokenHere', { webhookPort: process.env.PORT, 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!`);
});
i double checked password and token but they are correct...
it should still respond to requests even if the password and token is incorrect.
the webhook should still turn on
so, the expected response when the auth is wrong is a 403 Forbidden and the token is unused for the webhook.
for example with mine testing the wrong info placed responds
yours is giving
yeah, I think i am going to look around through previous heroku users here, see what other solutions people came up with
thank you a lot, i will look in heroku meanwhile
ah some smart guy posted an article in chat a bit ago which explains the error(which i thought meant something else)
okay let me read it ^^
just a heads up, its about python, but the procfile should still be relevant for js
which is the part i think is causing this issue.
so i have to change the procfile?
Web: https://dogmahost.herokuapp.com/
so i should add this "web: domain"
uu new error with this thing: "App crashed"
2020-11-17T23:10:13.504062+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=POST path="/dblwebhook" host=dogmahost.herokuapp.com request_id=6ed08320-31a9-481f-8c89-3de20bf3ba73 fwd="165.22.130.154" dyno= connect= service= status=503 bytes= protocol=https
yeah, heroku is kindof a nightmare rn, heroku is implying dont touch the procfile but some of their docs also tell you to modify it.
I was looking at this doc, and i wonder if the heroku scale command is what you need instead.
https://devcenter.heroku.com/articles/nodejs-support#default-web-process-type
i am afraid i am not understanding
honestly, I am not sure either. at this point i am grasping at straws 
Sometimes heroku isnt easy. sometimes it just works

the heroku scale command I think you can scale specific parts of whats run.
I think you can set heroku scale web=1 worker=1 so it can handle those web requests.
they have a guide on it too on their docs
https://devcenter.heroku.com/articles/scaling#manual-scaling
so i have to write it in the procfile?
I would look at the guide, because I honestly am unsure.
web: https://dogmahost.herokuapp.com/
heroku ps:scale web=2 worker=1```
trying like this now
If that doesnt work, remove it from the procfile and run it in the cli, or do it from the dashboard.
cli means on the index?
cli means command line interface
uhm so where is this?
honestly, probably easiest to do it from the dashboard.
https://devcenter.heroku.com/articles/scaling#scaling-from-the-dashboard
i tried all the combinations with the pencil thing
i receive or a crash or a total down
what the heck heroku
@fiery owl heroku shuts down any web process if there's no website running
I am using Pipedream for POSTs
ah so i can host the bot to heroku but the webhook to pipedream?
yea
we have others here using Heroku with the dblwebhook
<#topgg-api message>
but at this point, probably a better solution.
Use Pipedream to create a Discord Webhook and send a message to a channel.
See our docs to learn more: https://docs.pipedream.com/apps/discord/#discord-bot
You can find and copy the workflow used in this video here: https://pipedream.com/@dylburger/modify-a-discord-server-na...
take this video
okay will try tyty
but dont follow it for Discord
xD
just open a workflow
put the link in DBL
define a Auth
and tada
okay let me try
thanks deadly
don't forget to code after
thanks a lot really to both, i am trying
you don't need a steps.
just hit Workflows beta up there
in the navbar
the check all info about the workflow you just created
ok, u could delete those 2
and create one from 0
you won't need to touch anything after creating
then enter the workflow and show it
unless you have found already
Create Event Source
ok it says select an app
give me a min.
sure
lmao
i can send a screen
once i click on "Create Event Source" it makes me select an app
Once we have posted server count etc on the console, does it just appear on the website or what
or must I add an html format
for the button if you like to appear
no
if u cant, try on Discord Bot
no result
you need to create a Source, sorry
Nothing happened on the website
the only source is new message
lol i was searching get_user in the source
call it dbl-api or something
I forgot workflows aren't the same
now see what it shows
should present you a link
Your endpoint is
then the link

should i connect to discord?
yeah but... thats asked when u create a source?
New Message is a selector right?
yes the only one avaible
it makes me add the piperdrem bot to my server
select HTTP
trust me
seems weird
then select the 1st source
New requests
then just give a name
and hit the big button
i dont touch anything from this?
yeah
just the big one button there
copy the link
put it in DBL Bot settings
give the auth, and run Test
and delete this picture, someone may get the link
yeah
i follow it with the /dblwebhook
nono
ah okok
the raw link itself
then in the DBL Bot settings
you scroll that down
and put the link in there
the auth underneath is just for you to know if it's from your bot or not
okay
u can have it blank, but for security reasons, put something
after pasting, and giving it an Auth, hit the Test button
then go to your source on Pipedream, and see magic
the Auth password/word whatever, will appear as a field in that .json format you'll receive
i see this
no
after hitting test
yes
k
click headers to expand the list
check those
well, now u got to get to the Source dashboard
is this right?
yes
alright so what now
show
i can see mine too
you need to click the Source u just made
yes im in
and the internet got crazy
lmao
lolol
can u see the Node option inside the Test Event Box?
I guess you're working with Node
if not u have Python beside it
ye
and i can see it yes
show the code it gives u
click it and show
there's one or two things to get from there
ok delete that
not from there what I wanted xD
let me find by myself
you'll need a bit of code in your Bot's main file
okay
so you can access the Sources data as soon as the vote info pops on
i see
run npm i eventsource on you bot's folder
i dont understand
open the console
cd to the bot's folder
root path
and put npm i eventsource
so u can install eventsource's node packages
new terminal and type npm install eventsource
be sure it's at the root path of the main file
if you're on VS Code
just open the terminal
xD
yes i am
and run that command
done
now give me a sec.
sure
done
done
copy the code and paste it BEFORE bot.once('ready'
done
inside?
done
well, you're done
now your bot reads every POST that gets in that Source
now for the Voting-Reward system
you gotta get your hands dirty
guys i think you should go to #development
not really
okay lets move there then
no problem thanks for reminding us mr fox
im just saying..there usually isnt a lot of talking here
and setting up pipedream doesnt have to do with the API
How to add a webhook so that when someone votes my bot then it shows in my selected channel?
I have been there but it is kinds confusing on how to set up because when i put the webhook url and test then it doesn't send any messages
test it with a test tool like postman for example
Hello, how do you make it so that when a user votes for ur bot, ur bot does something
that's the same thing?
ohh
wait what if i have a channel in which the people who vote get mentioned? How does that work?
``dbl.webhook.on('vote', vote => {
console.log(User with ID ${vote.user} just voted!);
var oof = bot.channels.cache.get("778497654128508958");
oof.send("<@" + vote.user + "> has voted! If you continue, you will get really neat perks!")
});`` '
thats my code so far
Error:
TypeError: Cannot read property 'on' of undefined at /home/runner/BotArmyG-bot/index.js:41:13 at Script.runInContext (vm.js:130:18) at Object.<anonymous> (/run_dir/interp.js:209:20) at Module._compile (internal/modules/cjs/loader.js:1137:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) at Module.load (internal/modules/cjs/loader.js:985:32) at Function.Module._load (internal/modules/cjs/loader.js:878:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47
You'll need to create a webhook and idrk how to use this
1 sec
the guide mentions some sorta port
// Send a message using the webhook
hook.send('I am now alive!');```
ok, but how do you send the data?
Make it send the message you're console logging
ok thanks alot
Np
Click it
ok
yeah
TypeError: Cannot read property 'on' of undefined at /home/runner/BotArmyG-bot/index.js:42:13 at Script.runInContext (vm.js:130:18) at Object.<anonymous> (/run_dir/interp.js:209:20) at Module._compile (internal/modules/cjs/loader.js:1137:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) at Module.load (internal/modules/cjs/loader.js:985:32) at Function.Module._load (internal/modules/cjs/loader.js:878:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47
this error
``dbl.webhook.on('vote', vote => {
console.log('User with ID ${vote.user} just voted!');
hook.send("<@" + vote.user + "> has voted! If you continue, you will get really neat perks!");
});``
the dbl.webhook.on is line 42
@astral plaza you there?
Remove .webhook
ok
no error..
lemme see if works
i voted and it aint send
even console message dont come
`dbl.on('vote', vote => {
console.log('User with ID ${vote.user} just voted!');
hook.send("<@" + vote.user + "> has voted! If you continue, you will get really neat perks!");
});`
I don’t know also hook isn't defined then
How do I enable the server count on my discord bot?
@torn yarrow statistics?
idk
`dbl.on('vote', vote => {
console.log('User with ID ${vote.user} just voted!');hook.send("<@" + vote.user + "> has voted! If you continue, you will get really neat perks!");
});`
@agile moat
let hook = client.channels.get("channel id");
const hookembed = new Discord.RichEmbed()
yeah, but its not doing in console too
use this `
dbl.on("vote", vote=> {
let hook= client.channels.get("channel ID");
const hookEmbed= new Discord.RichEmbed()
console.log(`User with ID ${vote.user} just voted!`);
.setTitle(`TITLE`)
.setTimestamp()
.setColor("BLUE")
.setThumbnail(guild.iconURL)
.addField(`TEXT` )
.setFooter(`UR NAME` );
hook.send(hookEmbed);
})```
try again
give a link
okay?
nothing
shit
no console no message
okay
who here would know this stuff?
how many people is here
couple thousand
Is there a good tutorial on setting the server count of a bot instead of the N/A?
idts
@torn yarrow
const chalk = require("chalk");
const moment = require("moment");
const Discord = require("discord.js");
const ayarlar = require("../ayarlar.json");
var prefix = settings.prefix;
module.exports = client => {
console.log(`${client.user.username} logined!`);
client.user.setStatus("idle");
//idle = boşta
//dnd = rahatsız etmeyin
//online = çevrimiçi
console.log(
` `
);
client.user.setActivity(`kei'nin sözünü`, { type: "LISTENING" });
//LISTENING = DİNLİYOR
//WATCHING = İZLİYOR
//PLAYING = OYNUYOR
console.log(
`${client.user.username}: Now ` +
client.channels.size +
` to channel, ` +
client.guilds.size +
` to guild and ` +
client.guilds.reduce((a, b) => a + b.memberCount, 0).toLocaleString() +
` user !`
);
};```
are you talking about this
?
Can you send your code here?
let dblcount;
setInterval(() => {
client.shard.fetchClientValues('guilds.cache.size').then(results => {
dblcount = results.reduce((acc, guildCount) => acc + guildCount, 0);
})
.catch(console.error);
dbl.postStats(dblcount, client.shards.Id, client.shards.total);
}, 3200000);
``` this should pass the whole guildcount, but it is not
Hm
So you're fetching the guilds first?
Where can i ask about webhook!
Here aswell @restive otter
You're on the right plac
e
Where do u create webhooks xD?
Ty how to to setup webhook
Read the docs
Where do u create webhooks xD?
@vocal robin top.gg
ah xD
Okay to my problem, any ideas?
thx
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
This is the stats post thing, you now want to define those stuff right?
What is the Authorization
I know about webhook url
@noble adder This is an example from the api page...
@restive otter Thats to verify the request comes from top.gg
well ok
Ohh ohk there nothing to put am i right?
There is
@civic girder NO EAR RAPES!!
Fr what is he doing
First webhook url?
Yes
and then the authorization
To confirm the request came from top.gg
Where i can find that
You have to pick one yourself
You mean password type?
@vocal robin How did you defined dbl ?
Yes
fishsbsvsjsksk like this?
Could be yes
Ohk thank you for help
Np ;))
You can ask here more questions if you want tho
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
@restive otter thats just show one guild count
Ohk let me try
@vocal robin Yep, I know. Now you got to get all guild counts from each shard
And that's what you want to post
///////////////////////Dbl
const DBL = require("dblapi.js");
const dbl = new DBL('xD', client);
//////////////////////Dbl end
@restive otter I defined like this
K
xD = token?
I puted webhook url and Authorization
Than i click save
Than test nothing happen
xD = token?
@restive otter I can not show here my token xD
yes , I did
@restive otter Did you forwarded your IP?
K
Try it just with one guild first
wait
@restive otter Did you forwarded your IP?
@restive otter how
how many shards do you have?
@restive otter Use your router, to make the URL able to be reached by anyone
Have a look at the examples in the docs
how many shards do you have?
@restive otter 2 and 1,7K glds
And you know how to get the both of their stats?
Whats the token field?
There
@restive otter Thats your API token
Ohh now i can save? And test
I did generate
@restive otter What do you mean?
Nothing happen i puted everything right
Im confused about Authorization
And you know how to get the both of their stats?
@restive otter yes
Then you should post that
Im confused about Authorization
@restive otter !!
Read the docs again ig
In which form I didn't understand this
Do you started your http server?
Do you started your http server?
@restive otter mean?
Read the end of the docs again
"Vote locking" a large percentage AND/OR majority of your bots commands AND/OR features.
What's this?
Vote for this feature is not allowed?
@umbral venture As long as it's not locking all important commands it's fine
(for e.g tempban for voters only is good)
ic, ty
is it possible to set up different webhooks for server and bot ?

N/A yazıyor
Nasıl Böyle Yaparım
( pla translate)
hey @jaunty plank yesterday u told me to check my api request in postman, what do i fill in here
so, the type needs to be POST not get left of search.
wait so what do i do for this?
I am not sure 🤔 are you on the web app or the downloaded app?
So, I think the issue was you needed to create a collection first.
just use the downloaded app
API Key
youll want to fill the body
example body
{
"bot": "stuff",
"user": "732563712136970290",
"type": "test",
"isWeekend": "true"
}
what to
raw is fine
did you put a body in?
example body
{ "bot": "stuff", "user": "732563712136970290", "type": "test", "isWeekend": "true" }
@jaunty plank
where ?
ah ok
(unless that's somehow not the case)
still a bad request
i do lowercase aswell
wait where do i put a body? in my code or in the postman tab?
just going to take some screenshots for you to compare to. will be a few moments.
If it says bad request, then it's not the port
oh ok
if it would be the port, you would either get 404 or timed out
oh, is it the content type 🤔
forgot the code for timing out
the content type on postman is inherited from the option you selected in body
afaik
but best to recheck it manually on the headers
yeah change that to application/json
The value of Content-Type
ah ok give me a sec
replace the text/plain to application/json
what did you change?
const dbl = new DBL("", { webhookPort: 5500, webhookAuth: 'D' });
console.log(dbl)
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(vote)
});```
my code to this
what did you change in the webrequest
nothing
your bot has to be online by the way
i don't have a bot yet
i was trying to test the webhook
and then doing the bot
better learning curve
i mean your code has to be running in order to make the webhook request work
const dbl = new DBL("", { webhookPort: 5500, webhookAuth: '' });
console.log(dbl)
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!`);
});```
i mean it was this
can someone help?
@jaunty plank u here?
oop, what changed in the code?
yeah, I have zero idea on that, hmm.
oh? what was it?
i created a new request thing in postman
idk what was it exactly
planning to figure it out
o one sec
i saw this but what is it for servers
probably mostly the same, ive actually never tested the server webhook, and theres no dedicated api for server webhooks.
bot is probably server, might be the only change.
and when i do console.log(vote)
How to make a role for people to get whenever they vote for the server?
true but this is from console
yeah, its just logging whatever is in the body of the request. if you test it through the website it will give the proper one
@high jewel in your servers edit page, there is a place to put a role
How to make a role for people to get whenever they vote for the server?
@high jewel Add DSL bot
oh thank you ❤️
nearish to the bottom
https://i.imgur.com/gMQ18xa.png
when i click test webhook nada
its on a vps correct @visual brook ?
yep
how do i test this then lol
ok nvm its probs some error with test webhook
i voted for the server in actual vote (thats weird to say) and it returns
How to make the bot create an invite for a specific channel? I would like the invite it makes to be on our server rules 😊
sucks theres no doc on it
I think the new docs will include it, if not ill complain at team lol
I like figuring it out too, probably frustrating for a lot of people too.
see pins Woo
ye but i like it lol
oh
LOL
lmao
Sorry for the resend, but How to make the bot create an invite for a specific channel? I would like the invite it makes to be on our server rules 😊
u can create a invite and put it
yeah you can insert a invite that was made by you
create a invite for ur rules page and post it here
but I'd like the bot to make it so I can track who joined via the site 💜
Sorry for the resend, but How to make the bot create an invite for a specific channel? I would like the invite it makes to be on our server rules 😊
@high jewel I don't think that's possible
i mean if u remember the code u can track via discord's tab 
oh that's sad, but alright thanks anyway
fuck
the webhook button works dope now
what's the webhook for 😮
getting info when people vote for your server or bot.
thanks!
I don't get the thing so much
what's the ID for?
and where do I get it >.<
are you talking about server or bot webhooks?
I don't exactly know, I just want to make the thing so I can see who is voting in my server
Ping me if someone can help please and thank you
My bot got a lot slower with the webhook. Why?
I keep getting The server is not an instance of http.Server
for the dblapi.js library?
ye
I belive the server expects only http servers
it is an http server...?
slower as in higher ping?
@jaunty plank Yes, higher ping
Making a request to https://top.gg/api/bots/736854174909726760/stats with javascript gives error 401.
Any help?
$.ajax({
url: apiUrl,
success: function(data) {
$('.votes').text(data.server_count);
},
error: function() {
alert("There was an error fetching data from top.gg");
}
});
This is my code
webhooks should have no effect on ping afaik.
The websocket takes the same amount of time to connect no matter if a webhook is also running.
@tender tiger the api needs a token to be used.
Oh
webhooks should have no effect on ping afaik.
The websocket takes the same amount of time to connect no matter if a webhook is also running.
@jaunty plank So why is it that when I implemented the webhook it happened?
But i can make requests to it via postman without any token
https://top.gg/api/docs#reference
The docs say you need to use authentication.
As far as I know its required.
@boreal gale not sure.
If the lib isnt performing to your expectations, maybe try making the webhook receiver yourself? I am not sure I've ever heard of a webhook causing ping increases.
https://top.gg/api/docs#reference
The docs say you need to use authentication.
As far as I know its required.
@jaunty plank yeah, but to do stuff like changing the boy's server count. That endpoint doesn't need any for of authentication header like the docs say
In fact I can make a get request to i even from my browser
🤷♂️ I can too, but a 401 is an unauthorized error.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
Yeah o know that
@jaunty plank I still need to investigate further the causes of the problem, so I'm not saying it's the webhook but I also don't rule out the possibility
Can someone help me make the Webhook I really don't understand any of the terms
Maybe it's because there is some problem with the cross origin thing
@boreal gale all the official libraries have GitHub repos, If you want to look over and investigate it your more than welcome to.
If you want, you can also put an issue on the relevant repo.
@high jewel the webhooks need a webhook receiver to function, a handful of the official libraries have them, or you can make your own.
Which one is easier to do
@boreal gale all the official libraries have GitHub repos, If you want to look over and investigate it your more than welcome to.
If you want, you can also put an issue on the relevant repo.
@jaunty plank ok, thank you so much
I will look
@high jewel all of them are fairly complex, since they all need some level of development experience.
the libraries are easier though
So how do I start >.<
https://top.gg/api/docs#intro
You may want to learn a programming language first(or the basics at least)
Hey
I don't know why the API said it takes 1 positionnal argument but it's 2 with the library
Can someone tell me which code I have to put where to show the server count on the bot instead of N/A
depends on the library.
theres some examples on the docs in the library of your choice.
https://top.gg/api/docs
I'm gonna be honest, I don't know anything about api xd
I think you may know more than you know.
Discord bots use the Discord api
yeah, you can just use the example
const Discord = require("discord.js");
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
client on the third line being your discord bot client.
How long does it take to make the server count Show up?
after it posts(you should get Server count posted! in console), it can take an hour or so due to caching.
Ok, thanks
Who's managing the API page now that Tonkku left?
@jaunty plank hah it instantly worked :D
perfect!
@jaunty plank
How can I show the number of votes on the site on my bot
(discord bot list vote number )
I want to show on command
but I couldn't find how to do it
I'm here
I'm alive
Use an official top.gg library to get info of a bot and then retrieve a monthlyPoints key from the received JSON
https://top.gg/api/docs/ for more information
@sullen nymph thx
o
Is it possible to see if a user has reviewed the bot?
Damn
Hi i recently used the top.gg api to send the membercount but for some reason it always give me
:-:
ping me please this way i see your message fast qvq
whats your request look like?
hi
I have this in my code
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.dbltoken, { webhookPort: 5000, webhookAuth: 'yes' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(vote);
});
but when i test it
nothing seems to happen
are you filling in the webhook url and auth on the site?
those must be filled in with the correct info.
the auth will be whatever is set here webhookAuth: 'yes'
the url will look something like this
http://PublicIP:5000/dblwebhook
PublicIP will be the public ip of wherever the code is running.
wheres this code being run? home network? vps?
im coding on glitch
a few things about glitch, glitch expects you to use a process.env.PORT rather than a static port.
so you should probably be using that rather than 5000.
glitch, also doesnt provide an ip, but a url.
ok
yeah ik that
so how should the link look like?
this is the url provided by glitch
glitch suggests the application wont start and that your getting an error, do you happen to have any errors logging?
did you swap to using the process.env.PORT ?
do you have something else using that port in your code?
it errors
or that variable*
so, glitch only gives one port per project(as far as i know), and you cant use a single port multiple times.
I am not sure if you can give the library an express server or not.
ay, what did ya do
oh you didnt need it?
oh lol
i was about to do some hardcore research to figure out if we could get it to work together

your url should be something like
https://council-bot.glitch.me/dblwebhook
perfect
thank you
no problem!
does the api work for a server vote too?
the webhook stuff?
ye
yeah, its pretty much exactly the same.
this is pretty much the only difference. #topgg-api message < or pins
probably because you didn’t post the server count correctly
How do I make my commands vote locked 
So
uh
basically you'll want to setup a webserver that listens for a post request from top.gg
you can configure the url in your bots settings page on the site, the body of the request will contain the userid of who voted
so when someone votes and it hits your webserver url, give them rewards or up time in a database, whatever you want
i recommend mongodb if you need a new database
Must i add somethink special to my bot that on the top.gg website the server count work?
@lethal lion so to get the servercount
🙂
yes you do need to add something special
Is there any documentation about that or some one can provide me pls the part?
Any help please??
it says Error: 400 Bad Request
const DBL = require('top.gg');
const dbl = new DBL(process.env.dbltoken, client);
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})```
;-;
i used the code from https://discordbots.org/api/docs#pylib the bot works, but on the website the guild count is again N/A ( over an hour)
some one can help me in this matter? i dont have any error
i also dont get the output in console --> print("Server count posted successfully")
Can CTA bot be added to server?
Hi
My top.gg servercount is stuck, edit & save didn't help. Does it have something to do with the webhook authentication?
Because it got stuck ever since I added the webhook
any1 help me webhook votes?
mind sharing the code?
sure
Don't expose your IP like that.
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.dbltoken, { webhookPort: process.env.PORT, webhookAuth: 'yes' });
dbl.webhook.on('ready', hook => {
console.log(`DBL Webhook is ready!`);
});
dbl.webhook.on('vote', vote => {
let user = bot.users.cache.get(vote.user)
if (!user) return;
user.send({embed: {
description: "Ur PP size has increased by 1",
color: "#00ff00"
}}).catch(e => {
return console.log(e)
})
});
im hosting on heroku
pp size lmfao

it was just a herokuapp link
not frikin 0.0.0.0..00.0.00.0a 0a.d0.q02e104.012.012.0423.0
ye ye ok
basically i have no idea whats with this api library, i just use a http server and some spaghetti code to parse the POST request
heroku ps:scale web=1
apparently you're not running any web dynos
damn i love searching google for others
more googling
When deploying my Django project to Heroku, I encountered this error:

server count like that on the site.
the server count has nothing to do with the vote webhook.
you can post the server count if you want, but it doesn't help with your original question.
the part that helps with your original question is the webhook section.

30 minutes is a good number
your server count shouldnt be changing that often anyway(changing in a way that matters, going from 3005 guilds to 3009 doesnt really matter much)
for me going up by 1 server is a huge achievement lol
:-:
i added the code snippls from the api (py).. I get no error message or something, but the guild information is not published on top.gg.. some one have an idea?
no in this channel, no.
wrong channel, dude
Also Luca doesn't have commands you can use.
I would like to know how can I use the webhook system to reward upvotes.
It's for a server
Make a webhook and put its ip at the topgg webhook place then just use the api
The api has an event to listen to upvotes
const Client = require('./src/Client.js');
const { Intents } = require('discord.js');
global.__basedir = __dirname;
// Client setup
const intents = new Intents();
intents.add(
'GUILD_PRESENCES',
'GUILD_MEMBERS',
'GUILDS',
'GUILD_VOICE_STATES',
'GUILD_MESSAGES',
'GUILD_MESSAGE_REACTIONS'
);
const client = new Client(config, { ws: { intents: intents } });
// Initialize client
function init() {
client.loadEvents('./src/events');
client.loadCommands('./src/commands');
client.loadTopics('./data/trivia');
client.login(client.token);
}
init();
process.on('unhandledRejection', err => client.logger.error(err));
const DBL = require("dblapi.js");
const dbl = new DBL(config.topToken, client);
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.cache.size);
}, 900000);
});```
that is the code which connects to dbl
and my config.json{
"ownerId": "701780722444402758",
"bugReportChannelId": ".",
"feedbackChannelId": ";-;",
"serverLogId": "aaaaaa",
"apiKeys": {
"catApi": "gg",
"googleApi": "aaaaa",
"topToken": "no"
}
}```
nvm fixed
I-
You have to use your own endpoint DBL sends it’s requests to.
The entered Discord webhook URL doesn’t make any sense and of course won’t work. @restive otter
And the token can be generated only if you have an approved bot.
But I'm trying to do this for a server
I need to get an approved bot anyway?
@plucky lance
Yes but DBL basically sends POST requests to your personal endpoint if an event is triggered, e.g. a vote happened
You can’t use the Discord webhook URL.
You have to use your own created endpoint DBL sends requests to.
Yes an approved bot is required for event triggers like mentioned.
But of course not to sends requests from your side to DBL.
Anyway you have to set up your own endpoint anyways. No matter it’s a webhook service or just a script sending requests to DBL is your own choice.
The webhook don't identify when the bot receive votes
I literally gave Ctrl + c Ctrl + v in the code of the docs
Does anyone know what may be happening or what I may have done wrong?
well maybe don't copy and paste code without understanding it
@acoustic dove It was a way of saying, I understood how it works
saying you Ctrl + c Ctrl + v is not a way of saying you understand it
Ready even appears in the log
Ok I'm going to reformulate what I said, I read the docs, I saw the sample code, I replicated it in my code with all the necessary changes
that makes more sense
However the webhook is not informing me when someone votes and I know that the webhook is connecting because the "ready" event is informing everything right
Then I want to know if I have to do any more steps than what is in the Docs
@acoustic dove
idk
woah you can reply
Yeah make sure the port is opened/forwarded and your webhook service is accessible to the public.
how do i make the bot display in its status how many servers its watching
Just count the guilds the bot is in and set it’s presence.
Guess that’s a more related question to #development
Hi there I have a question about whether or not it is possible to have a bot join a server using just the link and python, can someone help me out?
Err nope that’s not possible
aww
That would be horrible just thinking of
I want a bot to make a server and then transfer it to another bot so the other bot can go on making other servers,
Im not trying to just generate a million servers, there is a good reason behind why I want bots to make servers
Ok I'll check
Thanks, I want a bot to be able to make a server and then transfer the server to a different owner but I want to be able to do that for a bunch of different servers, that way someone can make a web request for a server and it would be automatically made for them
Nah creating guilds doesn’t work using the Discord API
are there any work arounds that are allowed under tos?
@plucky lance How do I see if the webhook is accessible in public?
Dunno editing servers is possible but even if so I don’t think bot can be be server owners
Checking the firewall first and check it your webhook port is accessible using a TCP port check for example


