#topgg-api
1 messages Β· Page 69 of 1
@tasks.loop(seconds=1800)
async def change_presence():
guilds = await client.fetch_guilds().flatten()
status = discord.Activity(type=discord.ActivityType.watching, name=f'for &help | Rolling for {str(len(guilds))} servers')
await client.change_presence(activity=status)```
this is how it was before
i dont have any shards
then how are you getting your server count?
Can confirm
Idk why they did
You could use fetch_guilds if you really wanted to
But
The default limit is 100
Thatβs why you only got a server count of 100
oh, that explains a lot
man i should look into the docs more
took at face value what they gave me
Welp, now you know
yeah
Always check the docs
Iapetus11: After around 45 minutes of unwillingness to read any documentation, I think I got it to work properly!
sweats nervously
question, been trying for awhile to get my vote command to work. I can redirect them, they can vote,
I just can't connect my bot(s) to DBL to see if they actually voted.
any help would be amazing thank you :)
PS I've looked on YouTube and GitHUB but nothing has helped, at least not what I've found
did you use your api token?
What language? https://top.gg/api/docs is a good place to get started.
@topaz wyvern hello, refreshing the server gives an error 500 Internal server error, server lost?
If you believe something should be here contact us through our Discord Server or at support@top.gg
Login | Return Home
500 is a server error
And dbl has more server errors than any website I've ever seen
alright, what can I do now to fix that?
np, it worked now.
ive added my token i just can't / don't know how to use the API fully. I'm still learning everything as i go, sorry if i ask dumb questions :/
Just decided one day i wanted to torture myself and teach myself how to make discord bots
can you show the code
module.exports = Noel => {
dashboard.get('/votehook', (re, res) => {
console.log(re.headers) // Just getting headers from response
});
};
it works fine
Just not getting ones from top.gg
it has to be a POST request
ahhhh
not a get request
I c
what ur doing is
yea
I'm dumb
nvm, it works now
I
Isn't this supposed to work?
dbl.isWeekend(weekend => {
let WeekEnd = 'false';
if (weekend) WeekEnd = 'true';
else if (!weekend) WeekEnd = 'false';
The database had weekend as false, even though it's weekend.
It returns JSON with isWeekend key storing a boolean value
Oh, so I should do weekend.isWeekend instead?
Yup
Aright, thank you.
Or so I would guess since I never worked with JS
So, I've just put my code as
dbl.webhook.on('vote', vote => {
console.log(`Thanks to ${vote.user} for voting!`);
fse.readJson(`databases/voters.json`, (err, db) => {
if (err) return console.error(err);
dbl.isWeekend(weekend => {
let WeekEnd = 'false';
let booster = '1.15';
if (weekend.isWeekend) {
WeekEnd = 'true';
booster = '1.3';
}
let twoh = 1000 * 60 * 60 * 2;
let TIME = Date.now() + twoh;
let devGuild = client.guilds.get(`642304841170812939`);
let channel = devGuild.channels.get(`651059734077767680`);
let msg;
if (devGuild.members.get(vote.user)) msg = `Thanks to <@!${vote.user}> for voting!\nThey've just recieved a global ${booster} XP Booster for 2 hours!`;
else if (client.fetchUser(vote.user)) msg = `Thanks to ${client.fetchUser(vote.user).tag} for voting!\nThey've just recieved a global ${booster} XP Booster for 2 hours!`;
else msg = `Thanks to ${vote.user} for voting!\nThey've just recieved a global ${booster}x XP Booster for 2 hours!`;
channel.send(msg);
db.users[vote.user] = {
voted: 'true',
TIME: TIME,
Weekend: WeekEnd
}
fse.writeFile(`databases/voters.json`, JSON.stringify(db, null, 2));
});
});
});
And the only output I get is a log
And nothing got stored in the database.
And now I just commented everything about the weekend stuff, and then it returned more than just a log
It actually doesn't get inside of the event at all.
Or, it doesn't get inside of the isWeekend function.
Ok I found the issue.
- I used
dbl.isWeekend(weekend => {when it's actuallydbl.isWeekend().then(weekend => { - Trying out
if (weekend.isWeekend) {was another error, as apparently it's supposed to beif (weekend) {instead
I found the issue while looking over the api documentation again.
Also, can I emit a vote event? So like, without the vote counting on the site, I can emit it with vote.user being someone else's user id?
Ello?π€£
What do I need to put in password??
For code found in discord developer docs (language:Discord.JS)
Go to your bots edit page, and you can decide it yourself. @silk bluff
??
Highlighted = password
Okie
It's all the way at the bottom of your edit page for your bot.
No, I mean for others, example when they vote, but doesn't get their rewards because of a bug or me updating the bot.
Oh, uhh
So then I can do %fixvote <mention>
I could put all the code into a command, but I feel like emitting the event instead would be a lot easier.
How do I get message to my guild when my bot is voted?ππ
How do I configure it that way
And which hosting?π
Ehh there isn't an easy way to guess if a user has actually voted 10-60 minutes before executing a command
Unless you want to restrict that command to yourself?
π
I do want to restrict it to myself.
As the vote event does it automatically, unless the project restarts
And @silk bluff I use this
let devGuild = client.guilds.get(`642304841170812939`);
let channel = devGuild.channels.get(`651059734077767680`);
let msg;
if (devGuild.members.get(vote.user)) msg = `Thanks to <@!${vote.user}> for voting!\nThey've just recieved a global ${booster} XP Booster for 2 hours!`;
else if (client.users.get(vote.user)) msg = `Thanks to ${client.users.get(vote.user).tag} for voting!\nThey've just recieved a global ${booster} XP Booster for 2 hours!`;
else msg = `Thanks to ${vote.user} for voting!\nThey've just recieved a global ${booster}x XP Booster for 2 hours!`;
channel.send(msg);
Spoonfeed rule
Lol
ig put all the code that is executed on vote into some function attached to your bot's variable that you will call on a command execution
"which hosting" what does that question even mean
Lol
Alright, so pretty much, just paste my code into a command.
Where do I create a webhook
... or that, yeah
I am new to coding π€£
Do you know what a webhook is
More or less
A webhook is a program that runs on a machine expecting HTTP requests, essentially
Good lord, is Integromat similar to IFTTT
That ain't "hosting"
Why am I getting 3 fckin ads for Integromat, Google thid ain't right
"free hosting" does not exist as it requires maintaining a machine and Internet connection
@silk bluff try Glitch. It works pretty well. You can just set up 2 projects constantly pinging each other, and a uptime robot for your non-main project. So that way it will never go off.
I have glitch account
Or just use a cheap VPS like a sane person
I have no income, so I just use Glitch with http constantly pinging every 1 minute.
So why are you using Integromat
There is no "free" hosting, there is always a catch. Like heroku, it goes to sleeps automatically after 10 minutes
Lol
Glitch sleeps after 5 minutes.
For heroku I have procfile
Unless you pings it
Literally run a webhook on one of your machines, use port 3000 and make your code send a request to Discord webhooks
Use a cheap vps, and theres no problems lol
Use an official DBL library if you are too lazy to research on how to create one
Lol
This one?
I don't understand this
And passwords
Did you evem read the docs
Yess
webhookAuth is anything you come up with
....
webhookPort for Glitch is 3000
Ok cheapskate
π
refer to this channel's topic
http://<projectname>.glitch.me/<webhookpath>
I hope you know what the stuff between <> needs to be replaced with
What library do you use for your bot
Discord.js
not that one
Node.js
not that one either
Lol?
Library, not language
Dblapi.js
close
Can I say it?
Yes
So let's get back to dblapi.js example and see what webhookPath is
Okie
Wdym Apexio, what are you even taking about
The weebhook path
..π
@hollow iron you know how to config webhook on glitch?
Am I not helping you with that
Exact same as everywhere else.
You run the webhook on port 3000
shivu, can I say what the webhook path is for me?
Why does it matter
.....
Trying to help them, but I don't know if that would be spoonfeeding to just tell him what it is.
Ehh I'd rather open their eyes and let them rtfd than just spoonfeed
Alright.
Too many people already don't like reading docs because they expect others to give everything to them
@silk bluff Try logging the webhook path.
Use console.log
Okie
That's what you always use to find information from things you're unsure about.
It's literally stated so high up on the page, you just can't miss it.
Api docs
JavaScript > Example > Example of using webhooks
it's literally stated in the title
Example of using **webhooks**
This doesn't work for me
Bruh, I told you to log the path.
Password?
You will see how in there.
π
The password is the authentication you should've set up earlier.
Yeah
Thanks
I swear somethings not right with the webhooks...
It was working fine yesterday
Tested it
and now it's stopped
nothing has changed
Works fine for me
Check to see if you accidentally reset your token, half the time I do it when Iβm doing stuff on mobile and I have to vnc over to my βserverβ and restart my bot with the correct tokens
Did you accidentally exceed the rate limit?
Nope, I don't think so
Sorry, idk
bots only had like 4 votes since it was added
and none shown on the votes channel I set.
Idk, what language are you using?
js
dashboard.post('/votehook', (re, res) => {
if (re.headers.authorization === `${tSettings.auth}`)
Noel.fetchUser(`${re.body.user}`).then(async usr => {
const voteEmbed = new Discord.RichEmbed()
.setColor(0x8CDFFC)
.setThumbnail(usr.avatarURL)
.setTitle(`User Voted`)
.addField('ID', `${re.body.user}`, true)
.addField('Username', `${usr.username}#${usr.discriminator}`, true)
.setTimestamp();
Noel.channels.get("652341632879820800").send(voteEmbed);
});
});
That's what I've got for it.
(runs on port 80)
Unable to find my webhook path π
Getting this π π
For webhook port =3000 using glitch
the ports already being used by something else
stopping the webhook lib from using it
@silk bluff Can you see which file the problem is in?
Or if you can link me to join the project, I can help you.
@silk bluff
@late crater Webhooks aren't affected by ratelimits
where did you even get that idea from
They have their own rate limits though
Are we talking about the Discord or "DBL" ones
Did you accidentally exceed the rate limit?
wait, theres a rate limit for webhooks?
thats a bit backwards, as your system isnt causing them
@limber bramble Try resetting your token
Hello
@sullen nymph
I found my webhook path
Sorry for ping π
But it seems wrong
0.0.0.0:3001
Is that correct or not?π
0.0.0.0 refers to your machine only on your machine
You need to use a global ip, not 0.0.0.0
Also your webhook path is whatever you set it to, I believe the default is ip:port/dblwebhook
I donβt know exactly how on glitch
A little search through this channel yielded this (thanks tonkku!)
Didn't I put my 5 cents in about that
Doesn't look like it
Either way, the port is in use by something else that you are running
Turn that off
Probably an uptime robot
Hello darkness my old friend
In which case you need to pass the http.Server
What?
How do I turn that port off
Means don't let anyone else use it?
Yes thats a uptime bot
My bot stats haven't been updating for weeks
fun updateTopDotGG(serversArray: List<Long>) {
val token = settings.tokens.topDotGG
val url = "$TOP_GG_URL/bots/${settings.id}/stats"
if (token.isBlank()) return
taskManager.async {
val body = MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("shards", serversArray.joinToString(",", "[", "]"))
.build()
val request = Request.Builder()
.addHeader("Authorization", token)
.url(url)
.post(body)
.build()
httpClient.newCall(request).enqueue(defaultCallbackHandler)
}
}```
ok so
I forgot api
now this
can't I send it like this?
does it need json instead
ok I guess it does
bruh
www-form-urlencoded
I see I'm blind
owo
Array of Numbers
The amount of servers the bot is in per shard.
I'm confused
I think I got this working
thx for poining out my wrong things
Hello
I created a webhook successfully but
It doesn't show any log about user who voted for my bot
They are in the request body
Are you using the dbl library or something else?
Are you using the events provided by dblapi.js webhook
Yes
Show your code
Okay
maybe he means that he has built up the code, but the connection isnt being made
If you need to test webhooks, you can find a test button at the bottom of the top.gg edit page for your bot! Of course, you will need to add an event listener for the test.
Tested it
Did you get anything back?
Itβs usually immediate
I have the same issue
Lols
using express or the dbl module
Dbl
what language?
Js
my bot wont receive the webhook
Yeps
Are you using the port 3000, Fate
And are you sure the URL you entered is correct
You exposed your bot token
Your token is showing
Scroll to the right, so we can see the rest of the code
Are you sure it's not erroring out somewhere in the code
nopes
Also you donβt have a listener for a webhook test
There isn't one
Yes, I did that intentionally
Because imo it's easier to maintain two different events for each type of request rather than have it all under one with 2 checks
Censor your stuff bro
Also password9090 is not the greatest password
Save the changes and press test
I donβt think you have anything display in the console when someone votes
um
Did you even read their code
Sorry was reading the first version he posted
Did it log anything
Either that or Iβm blind af
Nvm Iβm just blind af
lol
Did you make sure to press save
Well the user is probably null cause itβs a test
nopes
It's never null...
That's literally what I asked just now
doesn`t show
Did you press "Save"
saved
Any output
sorry Iβm being extremely unhelpful, I have almost 0 knowledge of js. Just tryin to help
If itβs a webhook test, there shouldnβt be a user, right? If so there would probably be an error from trying to use vote.user?
Ignore that fate
There's always a user
So test just passes the bot owner instead of the voter?
um I tried to vote it from my friend`s account
Yes
no log updates
Ah ok
The only thing optional in vote data is query, the rest is always sent
.....
Why do you keep sending the dots
I would suggest randomly poking restarts at the code and testing since I'm shit outta luck and clue
sad
Maybe try making sure all the tokens/keys/passwords are correct?
correct
Ok
cleared all the code
I still think it wasnβt a problem with your code, but with the tokens/keys. Idrk tho.
lol
doesn`t seem to work
asked my friends to vote xD
still doesn`t work (votes updated on top.gg)
π¦
someone? to help me with the webhooks??
*help
for some reason, the bot page isn't updating how many servers my bot is in
It doesn't do it automatically
@late crater how do i get it to update?
how
Hey
I really don't know what I am doing wrong here. I do what the docs said but it still doesnt work
@commands.Cog.listener()
async def on_dbl_vote(self, data):
channel = await self.bot.fetch_channel(562784997962940476)
user = await self.bot.fetch_user(int(data['user']))
await channel.send(f"{str(user)} has voted!")```
it doesnt send anything
Feel like you're missing a @ emitter, (i.e: @commands.command as an example)
maybe check the docs example
I'm not familar with Python, so I have no idea
this is basically what the docs say
so that's why I dont understand why it isnt working :/
Even this doesnt do anything py @commands.Cog.listener() async def on_dbl_vote(self, data): print(data)
@restive otter Make sure you forward your port
I do
I've been trying everything with on_dbl_test too
even changed port
but still nothing
Are you using Glitch
Do you have something like this in __init__?
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token)
Yes
Hi
glitch only has one port
@sullen nymph I'm not using glitch
I have a vps
@late crater yes. But with the webhook_auth, password etc
hey guys, so i started using webhooks with my glitch project. when i first added it, it worked fine, but now the voting event doesn't work.
(i haven't changed anything)
anyone?
would be nice if you can show your code and your current implementation
its hard to comment when we don't know much about whats going on and your code
also did you glitch address change or anything
const DBL = require("dblapi.js");
const dbl = new DBL('my token',
{ webhookPort: 5000, webhookAuth: 'my pass' });
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!`);
client.channels.get(`642715142504710148`).send(`<@${vote.user}> just voted and received 10 ${chest}!`)
});
nope
hmm
wait does the port correspond to that url though
it did before so i don't know why it wouldn't
and did you try using the testing button on the bot edit page for the webhook
yeah
well then I'm not too sure either, since I don't use glitch
also, how do i manually update the server count on top.gg, i have a feeling they may be related
afaik posting the server count updates it on the website?
it does?
yeah I think thats how the library works as well
yup so its possible to manually update it but you should try to fix the issue with the bot
also is your bot online?
yep
since iirc there is an "inactivity timer" on glitch
there is yeah
it's always online so that's not the issue
updating the server count worked...
but it still won't respond to testing the vote event
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });```
how do i get webhook password?
you set it
I define the token of a webhook I created?
no
go to top.gg/api/docs
and click on your bots
and the bot
and you should see your token
for the webhookAuth, you set it on the edit page of your bot on top.gg
[py] how can I make a function that is called on a vote? I looked at the docs and I tried implementing it but it didnt work https://discordbots.org/api/docs#pylib (3rd exmple)
the guild counter works fine, but not this
[Js] how can I make dbl webhook work
@late crater @restive otter token is generated by DBL, webhook password is generated by you
@restive otter Forward your port, set at least webhook_port in DBLClient and you have a working dblpy webhook
How to fix this?
members limited
#help
Idk my bot hasnt been verified since a week I hope that doesnt happend to me
Im trying to add vote api
But idk the webhook port/password
Where can i find them?
And is that right?
At the image above
Webhook running at http://0.0.0.0:5000/dblwebhook
Bruh token for api
of my bot in top.gg
That's the oauth that needs me to be logged in to get the token
discord is probs broken
no
Ik shivuwu
so once again i'll ask for help:
i'm trying to do a vote event, but for some reason it doesn't work. i have an on ready event that posts the guild count, and that works fine, but i can't figure out why the vote event won't work.
code:
const DBL = require("dblapi.js");
const dbl = new DBL('my token',
{ webhookPort: 5000, webhookAuth: 'my pass' });
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!`);
client.channels.get(`642715142504710148`).send(`<@${vote.user}> just voted and received 10 ${chest}!`)
});
client.once("ready", () => {
dbl.postStats(client.guilds.size)
})
i'm using glitch, and when i first set it up, it worked fine. the url on top.gg is correct, and the token and pass are also correct, as the stats posting works correctly
nevermind, it just magically fixed itself without me doing anything
ok
@lethal tiger this is not a question for this channel. Ask in #development
oh ok thanks
nnnnnnnever mind
does anyone know why the connection between top.gg and the voting event sometimes stops working?
Can you confirm it's dbl's side?
Try to curl it from your own side
Make sure it's still working
Imagine using glitch for a bot
lol
^^
@spiral steeple how do I do that
@gaunt steeple is there any better solution that you would recommended? I've been trying to host it on google cloud but its very tricky
a virtual server at somewhere like digitalocean or ovh
or even the free trial of amazon web services works fine
google cloud isnt that tricky if you just ask it to spin you up a virtual machine, and put node and your deps on it
if youre trying to use all the fancy fandangles and scalability stuff, you'll get very confused, i did and i consider myself quite clued up re. hosting
do you think you could help me set up my bot on google cloud?
probably but i cant promise to help you as i dont have any free time atm
got all kinds of stuff going off at work and at home
plus upkeep of my own bot π
tbh, i'd get a vm at digitalocean, do 'apt install nodejs' and then npm your deps, sorted
its like $5 a month
and if you can convince others to sign up, you get free hosting off the referal
is there a free trial
hm
i think dbl also have a referal link
it used to be just $50 plain credit
but they realised people like me, that would last ten months π
how many servers is your bot on?
uhhh about 250
?
im getting towards 500 servers, and my server is barely touched by my bot
admittedly i have a server far beyond whats needed for a bot, i do other stuff on it
like, hosting websites for my games, etc
I just bought a 200 dollars a month server from Google, because I need it for a month and I have 220β¬ credit
alright well I still have time to work about servers
my big issue is that the voting event doesnt work sometimes
help?
How do you mean doesn't work
Do you log all requests at the webserver level?
I assume you have something like Apache or ngix as the front end server between you and any webhook request
I dont know much about this, so I dont know
I just did what it said on the api docs
it worked before
You should probably put Apache or ngix between your bot and the internet, set it up as reverse proxy to talk to the bot
how
Then you can set up that server software to log, and if a voting event is missed you can see where it was missed
Google for setting up reverse proxy with ngix to whatever you're using for your bots voting webhook
is this really necessary?
Well, it's the proper way to do it
Directly exposing an application to the internet is a bad idea for security, stability, and scalability
that's why my bot's clone on github is a suuuper early version of it
If you have a reverse proxy inbetween, you can log the requests, or set up load balancing, centralise SSL renewals, and more
The logging is the important bit for you
So you can prove the requests are reaching your server
Even if your bot is down that log will still exist
I dont want to sound like I know better, because I certainly dont
but I think i could be doing something wrong
I honestly dont care who uses my api
$1.5 per month for 1mil requests
most I hit every month is like 2-5k

@dusty roost ok apparently I think it might be an issue with glitch
not 100% sure on that though
I just upload it through my bot
Does your webhook contain an IP address?
And if so can glitch projects move around IP addresses at random?
it sends it to myprojectname.glitch.me/dblwebhook
i know that it's connected because it updates the server count on top.gg
site's offline
my logs show that the first time my bot failed to update the server count was about 10pm
meh if its offline it doesnt matter anyway
thanks for your help
Β―\_(γ)_/Β―


lmao
@worn quail @fierce grotto @digital linden This channel is for discussion of the top.gg API only. All other conversations should take place in #general or #memes-and-media
ok
huh what did I do
I was commenting on the "how do I make a webhook" thing
that url didn't help much

Error: 401 Unauthorized
Does that mean wrong token?
I tried regenerating and using
could be
Then what is 401
401 is unauthorized. Brain described a 403
401 is an invalid login
@formal sparrow You could have just searched it on https://www.google.com/
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
kk
huhh
how does the api works?
cuzz when i put it in the code it sees it as a link
wow rip english
in the python library is there a way to get the total number of votes and not just the last 1000
oof nvm
Other languages in #memes-and-media
@sharp wigeon need some .js help and I think this is the right section
C:\Users\Admin\Desktop\Bowsette>node index.js
C:\Users\Admin\Desktop\Bowsette\index.js:4
const dbl = new DBL('revoked.meme.nope', client);
^
ReferenceError: client is not defined
at Object.<anonymous> (C:\Users\Admin\Desktop\Bot-Chen-master\Bowsette\index.js:4:180)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
wait
think I got the error
is your client defined before or after that
after
should I do before?
before...
good lord
lmaooo sorry never had to use
const client = new Discord.Client();
variables always go above where they're called
you cant call "qt" if its below where you're trying to call it
Lmao
for example
console.print(qt_neko)
var qt_neko = "yes"
``` wont work
https://IP.FROM.MY.HOST:5000/dblwebhook should work as a valid webhook url right?
It's http by default, not https
other than that, that is correct unless your port isn't forwarded/is not 5000 and your webhookPath is not dblwebhook
@dusty roost in your ```const DBL = require("dblapi.js");
const dbl = new DBL('my token',
{ webhookPort: 5000, webhookAuth: 'my pass' });
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!);
client.channels.get(642715142504710148).send(<@${vote.user}> just voted and received 10 ${chest}!)
});
client.once("ready", () => {
dbl.postStats(client.guilds.size)
})``` code which token dbl or webhook ?

@restive otter
w
x
Let's not
my music bot comes to the audio channel when I command to play music, then comes out without playing the music
Ok?
does anyone know why the voting event sometimes doesnt register?
and i dont have a pass for the webauth
you make your own pass
or is that http://prntscr.com/qb4cou
yes its that
ahh
One message removed from a suspended account.
const dbl = new DBL(tokenf.dbl, client); but whats happening with the "client" then?
do i still need that?
yes
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL(tokenf.dbl, client);
not remove the line for client
but this
i mean idk lmao
ok no need to screenshot that
What will the thing for the webhook look like?
what will this fully look like? js const Discord = require("discord.js"); const client = new Discord.Client(); const DBL = require("dblapi.js"); const dbl = new DBL(tokenf.dbl, client);
Why donβt you try it
and see
.mp4
no
i want that if a user votes it logs
i just do not understand this line
(tokenf.dbl, { webhookPort: 5000, (etc) })
those seem to be making a client for the dbl webhook server. webhookPort and stuff are the configuration
and the client at the default for guild count like, do i still need that or can i remove it?
if you want to see if a user upvoted
you need to use the event emitter
i.e <emitter>.on
<emitter> being the emitter
@queen crystal did you read the docs
y
im confused about it
and you guys dont know where im talking about
so im going to say it in steps
(tokenf.dbl, { webhookPort: 5000, (etc) })
this is the line for if someone voted
for the webhook
const Discord = require("discord.js"); const client = new Discord.Client(); const DBL = require("dblapi.js"); const dbl = new DBL(tokenf.dbl, client);
thats the script ussd for server count or other things
im confused about this line
const dbl = new DBL(tokenf.dbl, client);
the client
if for the webhook there is no client
is that ok or do i have to do something else?
You provide the client if you want dblapi.js to automatically post servee count for you
Providing client does not do anything related to webhooks
new DBL(token, [options], [client])
or
new DBL(token, [client])
Β© docs
So either make client the last arg or don't use it at all
how i get dbltoken?
Yup
thanks.....................................................................
idk what my webhook port is
If you are using Glitch, it's 3000. If not, any port above 1024
how can i setup webhooks for my supprt server?
like when someone upvotes my bot, it'll send a message to my server
im so confused what the docs said
Is it possible to send the name of a person who voted for my bot in specific channel?
I need help with the api I want to make a web hook that notifies me when someone votes my bot but i can't get it (I use JavaScript)
how can I do it?
oh cool
ha i am just a genius xd why doing it by interval if you can do it when the bot joins a new guild xd
bot.on('guildCreate', async () => {
console.log(`New Guild joined! | ${bot.guilds.size}`);
dbl.postStats(bot.guild.size)
});
posting on guild join probably isn't the best idea tbh
just set an interval in your ready event of about 15 minutes or just let dblapi auto post
so if you implement a way dbl.postStats(...) it wont auto post, right? (on js lib)
If you provide a client in the constructor it will autopost
ok
me is back idk everytime i vote the next day the votes are stacking up
console.log(`User with ID ${vote.user} just voted!`);
let embedd = new Discord.RichEmbed()
.setTitle("**Thank you very much for voting!**")
.setColor(color.inori)
.setDescription("As a reward, You have received **Β₯1000** and Receive **1** Reset Token.")
.setFooter(`Use Reset Tokens to reset Service and Work Command.`)
client.users.get(vote.user).send(embedd);
let targetBalance = await db.get(`userBalance_${vote.user}`);
db.add(`userBalance_${vote.user}`, amount);
db.add(`userReset_${vote.user}`, 1);
});
idk what is wrong kekw
oh shit
@sharp wigeon do not shitpost in this channel. This channel is for constructive discussion and questions relating the top.gg API only.
I meant he should try the code and the compiler would show the error
If there was any errors
And then it would work, or he could fix the error
Sending that link is an obnoxious way to say that
At least they will remember, I hope they can fix simple stuff with the compiler and hard stuff here
But ok, I wont send that link
-api @restive otter
@restive otter
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs
I don't said anything @amber dune
yea because I removed your messages 
?

@misty mica send your code
and any errors
did it work before?
because i've been having an issue where mine stops randomly
add logging if you dont have any
at the http level
to check the webhook calls are reaching your code
@dusty roost
dbl.webhook.on("vote", vote => {
console.log(`${vote.user} have voted!`);
})
to test your webhook make sure you save the options on the website and then come back and hit test
const DBL = require('dblapi.js');
const dbl = new DBL(config.dbl_token, { /*webhookAuth: config.api_token,*/ webhookServer: server });
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 wont run on my webhook and I'm using an express server...
-moreinfo
If you want people to be able to assist you, please provide more information, such as what library and language you're using, the code in question and what you are trying to do and/or what is causing the error.
Good evening, you could help me with the voting system with lew webhooks I understand with the dosc
i am french
mention me if you can help me
@dusty roost sorry for the ping, I already managed to fix this. Sorry, thank you anyways <3
@hidden marten Just open that document again but with a binary editor change all the "1" to "0" and it should work
@short cairn thank you that solved my problem
Np
How do i know if my bot is accepted or rejected?
hi
api how to used on json
this discord official api example:
"Authorization: Bot verysecretcode"
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
top.gg api doesnt require the Bot prefix
why are you looking at the discord api docs
what the fuck are you even trying to do
sad
i want to get total server count
aaaaaaand why are you using the api for htat
im use api for web dashboard in my bot
so are you exposing the key to the public?
Bruh
Is it possible to post stats to the DBL website without being approved yet?
I want to get the code set up for it
You don't get an api key until you're approved
i mean you can set up the code but cant test it until you have a key
oh ok
@restive otter post memes in off-topic
as you can see in the topic, this channel is only for help, suggestions or bugs
Im new to top.gg and i dont know about webhooks im confused anyone help me
ping me if you like to help
A webhook is just a server running in background that responds with something on request.
Official DBL libraries usually have webhooks implemented for easy usage.
ok
did something change to the api? Suddenly I'm getting an "Unauthorized" error...
You're required to provide auth when using GET
I'm using dblpy, sorry forgot to mention
Also, I cant get the webhook to work. https://111.222.333.444:5000/dblwebhook
I press test, use the on_test thingy to print the dict it receives, but I get nothing
Could anyone help me set up this webhook thing? I've tried everything I could think of and nothing works...
If you are getting Unauthorized error when sending the token, reset it
@sullen nymph I have reset the token, that seems to be gone now.
And yea, I also tried http but that didn't do anything either
It's from top.gg. You have to press edit then scroll down and you will see some stuff
@upper nebula
Oh I see it, did not scroll far enough. Ty
now if only it was short enough to stay on my screen
Oof