#topgg-api
1 messages · Page 101 of 1

The maven API doesn't work for me. I put it all in the pom.xml but I can't use it in a class!
-api
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
try #development
@trail sigil ja ich meine eure API
Can you also send the guilds from the bot to DiscordBotList with url?
-api
huh
Can I a api in a URL
What's the URL you used?
1 sec
<a href="https://top.gg/bot/589031355829059594" >
<img src="https://top.gg/api/widget/servers/589031355829059594.svg?noavatar=true" alt="Robot APTKOP" />
</a>
@sullen nymph
try png
tried
don't work
if i try use iframe
it also don't work
Iframe
site blocked
in iframe
if that mean what i can't use images from website?
@rapid kettle
you can probably yes
but widget don't work
how fix that?
<img
src="https://images-ext-2.discordapp.net/external/l_DF7aVOfYef4f53YedBEpU3TaEMXjvoQvAuVZUxWCs/https/cdn.discordapp.com/avatars/589031355829059594/756b9f1e5fb6ce9d77537bc5cfac134f.png"
/>
<h1>Robot APTKOP#0955</h1>
<a href="https://top.gg/bot/589031355829059594" >
<iframe src="https://top.gg/api/widget/servers/589031355829059594.svg?noavatar=true" alt="Robot APTKOP" /></iframe>
</a>
</div>```
and img don't work
<div class="block" align="center">
<img
src="https://images-ext-2.discordapp.net/external/l_DF7aVOfYef4f53YedBEpU3TaEMXjvoQvAuVZUxWCs/https/cdn.discordapp.com/avatars/589031355829059594/756b9f1e5fb6ce9d77537bc5cfac134f.png"
/>
<h1>Robot APTKOP#0955</h1>
<a href="https://top.gg/bot/589031355829059594" >
<img src="https://top.gg/api/widget/servers/589031355829059594.svg?noavatar=true" alt="Robot APTKOP" />
</a>
</div>```
@sullen nymph
Try using .png instead
Do i need to run the webhook code listed in the API docs on a web server or can i run it from within my bot/app?
my bots always show this instead of showing "online"
is that halo dbot
it shows offline because it's kicked
Do i need to run the webhook code listed in the API docs on a web server or can i run it from within my bot/app?
@lyric quartz you can run it within your bot yes
kicked from this server?
yes
Yes
are there defined types for typescript available for the dblapi.js library?
hmm, im not sure what this means "Unknown command messages in DM's"
if you do a command that doesnt exist it sends a dm to you
Its like sending it in a channel, but the channel is the users DMs
interesting
it does send some of the command response to dm's, because they can get very large
was it down for some time. My users didnt get the voting rewards
the webhook stuff can go down sometimes.
the docs cover it, https://top.gg/api/docs
This might be a bit dumb, but how do I get the server count on the top.gg page? Is it an npm package?
the docs cover it, https://top.gg/api/docs
ok ty
why did i get blocked from the api?
Error?
too many requests
Because you somehow spammed the api
what would randomly spam the api?
the package itself?
it was spamming the console
i had to stop the process
the bot isn't even mine
So i copy pasted the example for the dblpy library and do I need to call the function?
Aye
just
just directly ask it
then you can’t
get a real vps
cause you don’t get a static IP iirc
^, your ip changes every boot
no

you dont get a static ip there either
ok thanks for telling
I actually just wanted to know if webhook is actually needed
I want to make votelocked commands
but can't figure out how
there is an endpoint in the api which says if a user has voted for the bot in the past 12 hours
make a trust based system where users promise that they voted and check a box, like the robot checks
[/s]
@trail creek javascript?
you can use the .hasVoted(id) function
https://top.gg/api/docs#jslib
to see if the user has voted in the past 12 hours
you can probably use that to votelock stuff
uh
I have to do like this? top.gg/bots/id/hasVoted(id)
@trail creek nope, you can just use the function provided by the lib
(tho it seems you might be able to use webhooks if you really want to)
dbl.hasVoted(id)?
yup
oh thanks
Your port will be 8080 but you must not set it in the URL
just await it
Resolve the promise
oh
I have already voted the bot, but it is returning false
is it because I voted it before I used API?
The API can have slight delays
oh
Hello, I have a problem with the API on top.gg, and when I want to click on Regenerate Token, nothing happens.
Hi
Yeah-idk how to explain this in an understable way, so I'll just do my best.. how do I get my bots server count on DBL/top.gg?
Am I in the right place?
Oh, it was already asked.
@restive otter @restive otter take a look at the docs https://top.gg/api/docs
for the api
thats how you post the server count
lol
-api
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
Incorrect stats being posted in discord.js sharding
async function pushCount(client) {
console.log('post count');
const dbl = new DBL(keys.dbl);
const count = await sharding.serverCount(client);
dbl.on('posted', () => {
console.log('Server count posted!');
});
dbl.on('error', (e) => {
console.log(`Oops! ${e}`);
});
dbl.postStats(count, client.shard.ids[0], client.shard.count).then(console.log)
}
API shows 3k+ (https://top.gg/api/bots/699844962057060393/stats), but the count is not even 2.2k.
and yes, count returns the correct thing.
oh wait
hang on
ayee fixed
I recommend changing "The server count of your bot." to "The server count of your client." that was my problem.
if more than 1 people vote at the same time vote count fails to get updated in time and gets repeated
any way to fix that?
Can someone pls provide me with a list of essential bots needed in a server
@mighty shuttle -api
you dont need to send that in every channel
-api
I have not used your API in my bot yet do I have to do it before approval
anyone able to he;lp me with setting up the API Options part?
Not to sure about it
if I have two bots on the same ip, would I use a different webhook auth, or should I use a different port? Just because if someone voted the event went through on both
right ok that makes sense
in js dbl.webhook.on('vote', vote => { console.log(`User with ID ${vote.user} just voted!`); });does vote.user return a user or a guildMember?
It only returns an ID
Yes
ok thanks
Hello, sorry to be asking you again.
How does the bot send a MESSAGE after a user votes? 
you cant do it with repl iirc
have to do the same with Glitch.com?
you cant do it with repl iirc
@rapid kettle hm 😕
ok
I thought I could 
how do I change the name of the vote webhook?
what is api?
#topgg-api message @royal veldt
he just asked what it is berry
it explains what it is 4head
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
tl; dr
the top.gg api allows you to
1 - Get bot info
2 - Post server counts
3 - Get votes via webhooks
4 - Check if people have voted
the end.
yes @rapid kettle is correct
i only asked wut it is
i may look at it l8er but what is api?
read the message above
How often can we push the guild count? What's the recommendations by top.gg?
Please ^
is there API to get a webhook for when I edit the bot's top.gg page? like to send a notification to a channel like I do with votes?
oh nvm I see the list above me.
How often can we push the guild count? What's the recommendations by top.gg?
@drifting saffron 15 minutes is the minimum (using autopost), 30 minutes is recommended (default in the autoposter)
Cheers 🍻
is there API to get a webhook for when I edit the bot's top.gg page? like to send a notification to a channel like I do with votes?
@empty jay there isn't iirc
No problem!
Recommendations are just "as long as it's not a ridiculous period of time"
like 3 seconds
Wasn't dreaming of three seconds hehe
Then yeah, we're all good here 👍
Was thinking every hour or 2 ? Is that good with you guys?
yea thats good
For sure
Cheers 🍻
I know it’s in Logs. I’m not stupid. But I want it to automatically post in my server too
twas just sayin
I keep getting this warning
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002B50D99BCC0>
When I try to get the uservote status
token = '' # set this to your DBL token
_dblpy = dbl.DBLClient(bot, token)
vote = await _dblpy.get_user_vote(int(ctx.author.id))
await ctx.send(vote)
The code works perfectly fine, it sends you vote status but I just wanna know why I'm getting the warning
You're not closing the bot, well, properly enough
It's not a significant issue though. You are essentially closing the bot while it's processing a request
ah i see, thanks!

how can i execute some code whenever a user votes using the api
hi, what's a good way to detect voting with a sharded bot? (using the npm dblapi.js library)
i can't really do it in the main index.js, do i do it in a separate voting_detection.js file or something?
nvm my vps is just being stupid
-api @restive otter
@restive otter
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
can someone please help me how to setup webhook to receive votes
i am using discordjs
Oof
@surreal spear helii
can someone please help me how to setup webhook to receive votes
@astral prawn instead of begging why not read the docs
How about being more helpful instead of telling people to rtfd
@astral prawn instead of begging why not read the docs
@restive otter not begging i read the docs but on a sharded bot not sure where to use the code
pretty sure sharding doesn't make any difference
in the case of top.gg api atleast
thanks for the info
do you need help with setting up the webhooks and stuff
this will send smth when someone vote ?
dbl.webhook.on('vote', vote => {
const channel = client.channels.get('717763226078543954');
channel.send(`User with ID ${vote.user} just voted!`);
});
hi today i was trying to test the code to upload server count on top.gg but idk why it showed that the bot is in ~700 servers while its actually in ~1400 servers
earlier i was using just the manual server count code on top.gg website but today i was trying manual count with webhooks code which resulted in this problem
Is it sharded?
yes!
Oh dear God help my soul
It takes whatever posted
How are you posting server count
I'd assume it doesn't just calculate it itself
Built-in shards aren't supported, dblpy simply gets client.guilds if you didn't specify anything in post_server_count
How are you posting server count
@sullen nymph from this code https://i.imgur.com/3yUU43c.png
Fucking Christ
did i mess up 
No I just didn't upload 0.4.0 on pypi that actually adds support for manual guild count
before that version, all dblpy did is get length of client.guilds
I can't think of a proper way to handle sharding before 0.4.0 so you'd either have to post server count manually with aiohttp or update to 0.4.0 by pip install git+https://github.com/top-gg/DBL-Python-Library
(The command may fail, so refer to the README in the dblpy repository on GitHub)
okay thanks
The documentation on dblpy.rtfd.io is up-to-date with 0.4.0 so feel free to use it for reference
Also you can report this on the github repo so that I could be reminded of this issue tomorrow
Hello
so it says I can make 60 requests per minute for the API, does this include checking if a user has voted?
no
i make way more than that and i don't get ratelimited @sick radish
its only for posting votes/shards iirc
oh cool
so that means i can iterate through 100's of people that want to get reminded for voting and check if they voted or not without getting ratelimited?
i would just use the votes endpoint instead of checking every single one
ohh, the one that returns the last 1000 votes
Or just use webhooks instead of abusing the API
how to know if user has opt for voting reminder?
That isnt a part of the api
@reef shuttle it only has one command which is ping, and this isn’t the channel for it, #general
when you click on the test button in the edit page, is the webhook supposed to post something in the channel you set it to?
what am I supposed to type in webhookAuth parameter (dblapi.js)?
and is the webhookPort required?
How do i make a code where people who voted will get bot currency?
const DBL = require("dblapi.js");
const dbl = new DBL('private code :)', { webhookPort: 5000, webhookAuth: 'password' });
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
message.channel.send("", {
embed: new Discord.MessageEmbed()
.setDescription(`${vote.user} Thank you for voting, Here's your free $10K :dollar:`)
})
});
dbl.isWeekend().then(weekend => {
if (weekend){
console.log("Woo! Multiplier time!")
let guild = client.guilds.cache.get('735382037090795541')
client.channels.cache.get('735521714540118136').send(`Multiplier time! You know what that means!! :eyes:
x2 :dollar: when voting in https://top.gg/bot/688121834494885920/vote`)
}
});
Hi guys. ```cs
await ApiClient.HasVoted(userId);
always returns false. Any ideas why? / userId is correct, and user with this id voted in the last 12 hours. And the ApiClient is properly setup instance of `AuthDiscordBotListApi`.
How can I make a webhook send a message in a channel in my support server if someone votes for my bot?
sorry i dont know much about webhooks in general but what does this mean and how can i fix it
Heya, I know there is an API for when users vote for bots. Is there an equal one for when a user votes for a server?
@radiant pollen not yet
I cannot find a way to use the api to reward users when they vite im on JS please help.
use a dbl webhook
Yes, I've been in there but I still can't get it to log once a user votes @rapid kettle
What's your code
const DBL = require("dblapi.js");
const dbl = new DBL(private, { webhookPort: 5000, webhookAuth: 'password' }, client);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
message.channel.send("", {
embed: new Discord.MessageEmbed()
.setDescription(`${vote.user} Thank you for voting, Here's your free $10K :dollar:`)
})
});
dbl.isWeekend().then(weekend => {
if (weekend){
console.log("Woo! Multiplier time!")
let guild = client.guilds.cache.get('735382037090795541')
client.channels.cache.get('735521714540118136').send(`Multiplier time! You know what that means!! :eyes:
x2 :dollar: when voting in https://top.gg/bot/688121834494885920/vote`)
}
});
client.on('ready', async() => {
//rest of my index.js code```
Not jsut that
It just doesn't log
console.log(`User with ID ${vote.user} just voted!`);```
^^ doesn't log
dbl.isWeekend isn't a thing iirc
its only vote.weekend
So, what are you putting into the top.gg page?
Local computer.
What is that?
You need it for traffic to get to your PC
No.
Which lets people to ddox me or sum
no people can ddos you anyways
It's in the router settings
192.196.1.1 is commonly the router's IP
yes
then your router probably doesn't support it
yes
thats the user ID
no
Or can i do like js message.author.id
you can yes
Ayee
Thank you bruvvv
absolute legend.
1 more question
@rapid kettle Do i put this in the index.js file
dbl.hasVoted(message.author.id).then(voted => {
if (voted) console.log(`${message.author.tag} has voted!!!`)
});```
ight
is it possible to use the dbl webhooks in heroku?
no
so I suppose I can use the same method as https://discordapp.com/channels/264445053596991498/412006692125933568/748223725991886998
yes
where should I send the request?
and what does the hasVoted mean?
I mean, does it count a vote made a year ago?
no
and which votes does it count?
the ones within the last 12 hours
@rapid kettle js dbl.hasVoted(message.author.id).then(voted => { if (voted) { console.log(`${message.author.tag} has voted!!!`) client.channels.cache.get('748224161519894600').send(`${message.author.tag} has voted for the bot.`).catch((er) => {}) } });
It just logs saying "author has voted" everytime someone sends a messasge
no idea
What can i do to fix it?
even if no voted
try turning it to a boolean?
idk I'm using request to check it not dblapi.js
true or false
@rapid kettle looks like i do have port forwardin
you dont know a boolean?
@gaunt sierra that is port forwarding create a new rule
although you dont need it for a .hasVoted
thats only for webhook
im just confused
how can my code
not work
dbl.hasVoted(message.author.id).then(voted => {
if (voted) {
console.log(`${message.author.tag} has voted!!!`)
client.channels.cache.get('748224161519894600').send(`${message.author.tag} has voted for the bot.`).catch((er) => {})
}
});```
it's all right
wait it could be an object
dbl.hasVoted(message.author.id).then(voted => {
if (voted) {
console.log(`${message.author.tag} has voted!!!`)
console.log(voted)
client.channels.cache.get('748224161519894600').send(`${message.author.tag} has voted for the bot.`).catch((er) => { /* handle promise rejectin gracefully */ })
}
});```
?
it may be that you have voted
then it is a boolean
i think it should be awaited lmao
try it
dbl.hasVoted(message.author.id).then(voted => {
await voted
if (voted) {
console.log(`${message.author.tag} has voted!!!`)
console.log(voted)
client.channels.cache.get('748224161519894600').send(`${message.author.tag} has voted for the bot.`).catch((er) => { /* handle promise rejectin gracefully */ })
}
});```
?
await dbl.hasVoted
no
if it has .then wait is not needed
but it would be easier
let vote = await dbl.hasVoted(message.author.id)
if(vote) {
console.log(message.author.tag + ' has voted!')
}```
thank
Oofers
Someone finally help me smh
This is giving me cancer
I want it to only log when a user has voted
Not 24/7
You should set up the webhook
Webhook?
No not it
How do i do it?
@gaunt sierra Where do you host before anything
You can go to your bot's page on top.gg, click on edit, go to bottom, there's the input where you can put a webhook and a password
A webhook example
https://localhost:3000/dblwebhook
Password can be anything
First one is the webhook, second, a password
So, anything?
Password can be anything
Just something that you can remember and keep your webhook secret
That url is the webhook
Go a bit above
I showed how to do a webhook
Yes that can work
Why not
Oh yea
I forgot
@gaunt sierra replace localhost with your public ip
Don't show us your ip tho
Just google it?
"What is my ip"
This thing
Yes
After you put that in, save and click on test
"webhook tested! this may take a few minutes"
Not sure if I have that^^
Now in your code
let dbl = new DBL(<Your dbl token>, { webhookPort: 3000, webhookAuth: "Your password" }, <client>);```
Now to receive the voted user
dbl.webhook.on("vote", async votedUserID => {
let getVotedUserObj = await <client>.users.fetch(votedUserID);
console.log(`User ${getVotedUserObj.tag} has voted!`);
});```
Give link i'll vote
Did it work
Hmm you can make a request to your webhook on https://reqbin.com to make sure it's working
Or .net i forgot
Operation timeout.
If you use a firewall, you need to add an exception for ReqBin servers (US: 206.189.180.4, DE: 139.59.147.204) or use ReqBin Google Chrome Extension.
Error code: 10028
wdym
Wot does that even mean
Post request not get
O wait
Omg
it has to be http not https

@gaunt sierra Try changing the one and dbl from https to http and try with changing from https to http on request bin too
lol
still
the same thing
I think we really need port forward
But idk how to do it, Do you?
We don't even need that, i don't do
I think we do since it shows as http://0.0.0.0:3000/dblhook
How tf am i not using one then
I think we do since it shows as http://0.0.0.0:3000/dblhook
@gaunt sierra thats the default path
weird
It shows all of them as 0 to protect it
my life is advanced
so imma try doing a port forward thing
@restive otter Wanna join the support server and help me there later on?
@rapid kettle How'd I do port-forwarding?
Vps witherhosting
K then
@rapid kettle
ig
so start and end ports are 3000
local ip
do i change it
it asks me to put in something in the very end
i have .1.1
and it's .1.[]
Protocol TCP?
yes
local ip is the private ip of your pc
you can get it by running ipconfig in cmd
ooohh
thats my private ip
So i don't change the end?
so if i wanted to port forward this laptop i'd put 192.168.1.254
mhm?
type ipconfig
and it'll say IPv4 Address somewhere
that is the ip you wanna put in that box
@willow sphinx any updates on the lib?
the PR looked ok to me but I'm going to have to check in with Veld first. Tonkku was pretty strict on stuff so I want to make sure Im reviewing things a similar way 
so do you plan on taking over operations of the lib?
or are you gonna find sum1 else?
@small crow need any help?
how to i get a token for using API ?
Your bot needs to be approved
how to setup webhook for vote?
wow
oof
Can anyone help me with the API reference, I got the error 403
what's a api link? I've seen them before but have no idea what they are, also how do I make one? I'm very new with that kinda stuff
same problem as you
Hmmmm
How long does it take for votes to update
they should update almost instantly, are you using webhooks or no webhooks?
So I'm trying to setup the webhook for votes I followed the docs and set everything up but it does not work and I don't know whats wrong. If someone is willing to help me troubleshoot I would really appreciate it.
Can someone help me with the Voting API please and thank you
hey i was wondering does anybody know about a auto dicord counter
like 1 to infinity
dm me if you find one!
no you use it as the authentication header
ok @restive otter what fetch do you use
wym
to fetch the votes
that is it
what
aiohttp is it
ok
url = 'https://top.gg/api/bots/430858553952174090/votes'
headers = {'Authorization': 'top.gg api token'}
``` should work
i've never used python so just an assumption
also, have you looked at the dblpy wrapper?
uh
where lol
async with session.get("https://top.gg/api/bots/430858553952174090/votes") as search:
result1 = await search.json()```
somewhere there?
ik you don't use python
err
Idk
lmao
uh
prolly but could you link me?
oh
wait
You mean do I have the DBL api wrapper or

That doesn't really help me
maybe I need something like await self.dblpy.get_user_vote()
what we can do with discord bot list api's
get_bot_votes from dblpy is the non-rate-limited equivalent of
async with aiohttp.ClientSession() as session:
async with session.get("https://top.gg/api/bots/430858553952174090/votes") as response:
return await response.json()``` @restive otter
It's easier to just call a method instead of writing all that crap
^^
so im trying to use dbl.hasVoted(user) but im getting this error
seems like its coming from the module?
i just checked the file and i see _request defined so im very confused
Lol
i try to make bot when someone vote for bot tells me in the console log
const dbl = new DBL("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1MjE1NjQ5MDgxOTQzNjU0NCIsImJvdCI6dHJ1ZSwiaWF0IjoxNTk2MjY2NTE0fQ.B6in9IIpMMX6VhgjEhgJ8jBb-QcUAcfIFKjfTnpzjV8", { webhookPort: 5000, webhookAuth: 'aluahuhdaj@!$@12' });
client.on("ready", () => {
setInterval(() => {
dbl.postStats(client.guilds.cache.size);
}, 1800000);
});
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
i reset the token
no one will help me :<
did you configure your webhook in your bot's edit page in top.gg?
where is your bot hosted?
luffy :0
quick question what would i recieve if i clikc on webhook test?
like how would i know the test worked O_o
It does a thing in the code if it’s working
dbl.webhook.on("vote"
Okey i did it but it's not approve. How long does it take to be approved
read pins in support
did you configure your webhook in your bot's edit page in top.gg?
@vapid cape yes
where is your bot hosted?
@vapid cape in my pc for testing
if you're testing on your pc, you will likely need to port forward your router because it blocks ports by default
its easier to test in a server
no, you need to tell top.gg how many servers your bot is in
there is no way for us to automatically tell otherwise
Thanks , did you know how i can see in how much server is my bot ?
let's move to #development
Hi
hi i took a look at https://top.gg/api/docs#webhooks But I didn't understand it very well
guys
good
Hello ! I want to add a feature to my bot that requires the user to vote. Example, he executes the help command, the bot returns "you must vote for the bot on top.gg to use the bot!" If the user has not voted. Is this considered api abuse or not?
those are the rules for voting
ensure you keep within ratelimits too
no?
@trim lily rocket league
thanks a lot ❤️
upd ^^
-api
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
-notr @restive otter
@restive otter
İngilizceden başka dillerde sohbet etmek için #memes-and-media kanalını, top.gg hakkında (Türkçe olarak da) destek almak için #support kanalını kullanın.
Bu kanalda Türkçe konuşmayın.
@jaunty depot ^ 
hey how do i get the webhook port and auth?
never used api webhooks before ^
actually nvm i got it
wait so im using this, https://i.imgur.com/mjeV3Yp.png
but the docs define it as async def post_guild_count(self, guild_count: int = None, shard_count: int = None, shard_no: int = None):
so how would it work without defining it via a karg
@sullen nymph
@opaque jetty you still need help?
yes
i was just mostly concerned on how what the docs suggested could possibly worked
i already use dblpy to submit my server count
and all i want to do is submit my shard count as well
i've read the docs
All of the args are positional and optional
Mmm. No, I highly doubt that's supported
so then how would i do shards as there isn't any docs on them
i see they are in the source code though so it seems like they are supported
oh
as in, i have a variable with the number of shards, i just want to send it to top.gg using dblpy
shard_no is a shard to post server count for
shard_count is self-explanatory
guild_count is either globally or per-shard if in a list
Fuck, I need to add support for List[int] in guild_count
Yeah. I'm not sure if I can just rely on a property like .shards :p
also idk if you have access to it, but the dblpy docs at top.gg/api/docs don't include most stuff, which confused me for a while until i found the repo's readme
maybe have them sync/make a iframe in the page to the readme?
but its probably more of a web admins question
Yeah, they're planned to be updated once I'm done rewriting the README on GitHub
wait and just to be clear, i should be using await self.dblpy.post_guild_count(server_count, shard_count=shard_amount)
Hmm. Not sure if that'll work as expectedz but you can give it a try
wait is thats not the proper way to do it what is
isn't this a pretty common use case?
Most common use is to either use a list wirh server count per-shard or send multiple request where shard_no is an incremented value (a for loop, basically)
But since I'm not sure if dblpy properly supports lists, it'll take me a bit more time to roll out an update
Because shard_no is a shard to post the server count to
so your saying i can do await self.dblpy.post_guild_count([1k,1k,1k]) etc etc
that actually seems pretty useful
Not tested but feel free to give it a try
quick question:
what is tested
cause i want to make sure it works in prod cause i don't have a testing env
You might want to wait until 0.4.0 where I'll probably add it as a definitely working feature
Oh, yeah. Also, since 0.4.0, you'll be able to post server count to a listed bot under the specified top.gg API token
So, consider that some sort of upcoming "testing environment" :^)
At least use aiohttp you disgrace
requests will block other important requests to the Discord API
aiohttp is asynchronous which makes it ideal for discord.py
if you're going to use requests for discord.py you might as well do time.sleep(5) in your code
hey, how can a make a system like: when you use the command you have to vote to use it again
I can't seem to track the votes. Someone can help me pls ?
hey, how can a make a system like: when you use the command you have to vote to use it again
@north trellis track the user's votes and unlock them until they use it then lock em again
@restive otter, can you help me pls ? 🙂
don't ping me randomly lol
const DBL = require("dblapi.js");
const dbl = new DBL("Hide token", { webhookPort: 5000, webhookAuth: 'hide password' });
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
dbl.on('posted', () => {
console.log('Server count posted!');
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
sorry
I use that code
-api
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
ow sorry
how can i use custom html?
client.channels.cache.get('749648839073464352').send(`Thanks alot, <@!${vote.user}>, for voting!`);
});```
Does something seem wrong with that? No errors or anything, but there's also no message in the channel I provided 
dbl api is active, cause I can see `Server count posted` after starting my bot
dbl is just going nuts
While reworking how dblpy's post_guild_count function works, I've thought of possibly making the bot object be an optional argument for DBLClient.
In that case, most functions would have to return exceptions if ID wasn't passed in the function, same applying for client object in DBLClient.
My question here is, how unnecessary of a change would you consider this to be?
dbl is just going nuts
@restive otter well yes, it seems to be going nuts. After a reload:
After a second reload
@plush swallow wouldn't it be dbl.webhook.on?
^
👀 damn where did I get that example from - Looks like that's the problem here
aye no problem
Oh, the example for JS library is fixed
Was it fixed just now or did I simply overread the dbl.webhook ?
Seems that you overread it :p
yea ^
dang, ok thx 😄
it was there when i first implemented webhook
I remember addressing this issue before but never checked in on it so I can't say when it was fixed
So this little Test button only worked after clicking it a couple of times (with delay inbetween, no spamming) - But it seems to work now 👌
How do I integrate a webhook into my bot?
when is the api (voters) reset?
hi i was wondering if this would work
dbl.webhook.on('vote', vote => {
vote.user.send('Thank you for voting!')
});```
oh
erm
Why spam in #topgg-api
#memes-and-media for emotes
does the api cover voting for servers?
@novel moth not yet
ok
So we can do stuff when someone votes your bot, similarly is it possible to do stuff when they vote your server?
Oh never mind
Kek the answer right above me 
webhooks on
ik but what is like the variable
vote.user
You can get user by id in discord.js api
(at the example)
how tho
read the docs™️
Check in discord.js docs
i am
https://discord.js.org -> search bar -> fetch
fetch the user id?
mhm
Hello, sorry for the dumb question but how do I do the webhook thing so it'll show all the servers my bot has?
ohhh
ah I see
what language are you using?
discord.js
ah so you can use the dblapi.js package (https://www.npmjs.com/package/dblapi.js/v/2.4.0) which handles this automatically for you
Hi, I'm new to discord and I'm just learning, so sorry for the silly question, but they told me that because of nekotina they can marry more people and I don't know how and whether that's possible.
@polar hawk
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(
Api site for Bscript
@jolly hornet can you do -api
TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs
if more than 1 people vote at the same time or close to each other vote count fails to get updated in time and gets repeated
any way to fix that?
.
-wrongserver
Which part are you confused on?
^
close the connection if it throws any warning

there is no event when somebody voted?
yes there is, if you have a webhook setup.
I think I did the server count but when I try load. my bot takes forever to start
i need help with setting up a webhook in my bot
what lib?
Is there a IP i can whitelist for webhooks? currently home-hosting my bot
you need to open it for the entire internet
yes but i can whitelist a ip to only accept requests from
i dont think anyone's ever logged it lol
Why Is votes.find(vote => vote.id == message.author.id) Undefined?
use hasVoted instead (btw it is .user not .id)
why is the vote count on the website different from the count in the api and which is the real one?
i have 39 votes on the website, but the api returns 26 "vote user objects"
im getting a backend fetch error when trying to post the servercount?
const dbl = new DBL(key, client);
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', err => {
console.log(err);
})
im just using the api example
resolved
E
I just started sharding my bot and I'm getting this error on launch for every shard other than shard 0
events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::5000
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1367:14)
at listenInCluster (net.js:1408:12)
at Server.listen (net.js:1492:7)
at DBLWebhook._startWebhook (/root/pixxiebot/node_modules/dblapi.js/src/webhook.js:45:18)
at new DBLWebhook (/root/pixxiebot/node_modules/dblapi.js/src/webhook.js:27:12)
at new DBLAPI (/root/pixxiebot/node_modules/dblapi.js/src/index.js:69:22)
at Client.client.on (/root/pixxiebot/bot.js:97:17)
at emitNone (events.js:111:20)```
Yes
are you using internal sharding?
or sharding manager?
It wont work with sharding manager because it spawns a new process for every shard
whereas internal sharding using child processes
so you'll get ERRADDRINUSE (basically saying the port 5000) is already in use
because it's already been opened on port 5000
assuming you're using a vote webhook
I recommend you make a separate process for it and store the votes in a database
@golden adder ^^
Yep I'm using sharding manager. Totally new to this sharding thing. Anywhere with some useful resources to help?
And yes I'm using a vote webhook
Right
Just move your voting webhook handler to a new Process
you literally wont need to change any code if you're using a database to store votes
@golden adder Do you use a file / database to log votes rn or not?
All the webhook event does is just add +1 to the user's voting streak in the db and credit them some currency.
It also sends them a confirmation DM
How do I do that?
Ok I'll give that a try
Lemme know how it goes!
That doesn't seem to be working for me. I haven't upgraded to V12 yet 😂
Probably because of tht
I tried shardCount: 'auto' but that only launches 1 shard of 500 guilds
Wait, are you trying to launch https://canary.discordapp.com/channels/264445053596991498/412006692125933568/750196669827776582
with sharding manager?
No
I removed the sharding manager to test it
ah cool cool
Then ye, if you wanna use sharding manager and then make a separate process for your vote webhook thats probably your best bet
You should be able to use the api
since the bot will identify and you can then just post to the specific URL as if your were using an api
lemme do a test real quick and I'll get back to you
Ok! Appreciate it 😉
Do you use node-fetch?
i'll whip up a script that might work with comments explaining everything
Yeah sure that would be awesome
So, This is the output https://img.ichigo.uk/tU6wlPIvy9Je.png
Here is the code:
const fetch = require('node-fetch')
const token = ''
async function sendUserDM (userId) {
// Stringify the body for the DM Creation so discord doesn't throw an error
const body = JSON.stringify({
recipient_id: userId
})
// Create the DM
fetch('https://discord.com/api/v6/users/@me/channels', {
method: 'POST',
headers: {
Authorization: `Bot ${token}`,
'Content-Type': 'application/json'
},
body: body
}).then(async out => {
// Convert the buffer to JSON
out = await out.json()
// Create the message JSON object
const message = JSON.stringify({
content: 'Vote Confirmation',
embed: {
title: 'Thanks for voting!',
description: 'Thanks!'
}
})
// Send the message
fetch(`https://discord.com/api/v6/channels/${out.id}/messages`, {
method: 'POST',
headers: {
Authorization: `Bot ${token}`,
'Content-Type': 'application/json'
},
body: message
}).then(async out2 => {
// Output (This is here in case of errors)
out2 = await out2.json()
console.log(out2)
})
})
}
sendUserDM('USER ID HERE')
This won't work if the bot has been down for 24 hours as discord requires your bot to have identified within the last 24 hours (or since identify reset).
@golden adder
That's awesome. Thank you so much!






