@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("got vote")
memberID = data["user"]
print(f"got vote from {memberID}")
member = self.bot.get_user(int(memberID))
print(member.name)
await member.send(f"""
Hey!Thanks for the vote :heart: :100:
You now have one extra token :moneybag:
Please do this every now and then :heart:
Enjoy making commands using me!""")
tokenmaker = TokenMaker(member)
tokenmaker.add_token()
#topgg-api
1 messages · Page 92 of 1
here is the whole cog
import dbl
import discord
from discord.ext import commands , tasks
from setup import dbltoken
import logging
from utils.tokenMaker import TokenMaker
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = dbltoken
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
@tasks.loop(seconds=3)
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
print("posting")
logger.info('Attempting to post server count')
try:
await self.dblpy.post_guild_count()
logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
# if you are not using the tasks extension, put the line below
@commands.Cog.listener()
async def on_dbl_test(self, data):
print(data)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("got vote")
memberID = data["user"]
print(f"got vote from {memberID}")
member = self.bot.get_user(int(memberID))
print(member.name)
await member.send(f"""
Hey!Thanks for the vote :heart: :100:
You now have one extra token :moneybag:
Please do this every now and then :heart:
Enjoy making commands using me!""")
tokenmaker = TokenMaker(member)
tokenmaker.add_token()
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(TopGG(bot))
you aren't setting webhook arguments
what
what
@sullen nymph
def __init__(self, bot):
self.bot = bot
self.token = dbltoken
self.dblpy = dbl.DBLClient(self.bot,
self.token,
autopost=True,
webhook_path='/dblwebhook',
webhook_auth=self.token,
webhook_port=5000)
do i need to do this>
then what else @sullen nymph
open port 5000 and go to your bot's Edit page
Google™️
there, scroll all the way down, set Authorization field to what you set webhook_auth to
in the URL field, set http://ip:5000/dblwebhook where ip is your public IP address
that bot is unofficial, but the URL should still be available
same applies to the token that it sent
You can't really have 2 webhooks unless you make one that later sends a request to another webhook
not that matters too much because and api is really rather borked rn
Is it just me or is the bot status not displaying properly on every bot listed?
I voted my bot yesterday it was returning True
But now it's returning False
Even though I voted it
I'm using get_user_vote
To manually fetch it
(python)
Ok it worked now
It took 2 mins to update my vote
Why the votes wont work Tests work
@commands.Cog.listener()
async def on_dbl_vote(self, data):
userid = data["user"]
letter = "ASDFGHJKLQWERTYUIOPZXCVBNMasdfghjklzxcvbnmqwertyuiop12345678900987654321"
code = ","
for m in range(0, 6):
code += random.choice(letter)
db = await aiosqlite.connect("main.db")
c = await db.execute("SELECT codes FROM minicodes")
codes = await c.fetchall()
codes = codes[0][0]
codes += code
await db.execute("UPDATE minicodes SET codes = ?", (codes,))
await db.commit()
await db.close()
fcode = code.replace(",", "")
msg = discord.Embed(
colour=discord.Colour.green(),
title=f"Your code is {fcode}",
description = "Thanks for voting :) Claim the code with `?redeem_vote <code>`"
)
try:
await self.bot.get_user(userid).send(embed=msg)
except:
pass
are you doing it with the test button
Wdym
this is the test code
@commands.Cog.listener()
async def on_dbl_test(self, data):
logger.info('Received an upvote')
print(data["user"])
It works
but voting doesnt work
Hi, I'm getting a ton of 429 errors when connecting to dbl with dblapi.js, even if it works fine but I don't really want to get banned
Errors aren't helpful at all. Is there any limit to . hasVoted()?
That's probably why I'm getting rate limited but not sure
but voting doesnt work
same
opened port at 5000
put my public ip:port/mypath
nothing works
I haven't tried test yet
ok
yeah I'm doing it now
nvm got it
anyone got a clue why i get this error:
it seems to happen randomly and sometimes the voting works sometimes it doesnt
your host likely has dns issues
that has nothing to do with webhooks
what it means is that the dns resolving fails on your host
If I am using dbl API, and it keeps saying 502
Is this because of the cloudflare cheek?
*checks
dont supply the client
i need helping setting up the Webhook part
def __init__(self, bot):
self.bot = bot
self.token = dbltoken
self.dblpy = dbl.DBLClient(self.bot,
self.token,
autopost=True,
webhook_path='/dbl',
webhook_auth= hidden',
webhook_port=5000)
i still can't understand the webhook_path and webhook_auth
how do i set a webhook up
i want to set it inside of my bot
like it says here
yeah i need help i wont server count on my bot on top.gg
but dont know how
ok
so when you edit your bot you can get the api token there
uhh?
in top,gg
top.,gg
ok
yes
const DBL = require('dblapi.js');
const client = new Discord.Client({ disableEveryone: true });
const dbl = new DBL('api token here', client);
dbl.on('posted', () => {
console.log('Server count posted!');
});
dbl.on('error', e => {
console.log(`Oops! ${e}`);
});``` @restive otter
ok 1 sec
you might want to install dblapi.js 👀
bro just read up
check the docs
ok
where are the docs?
ok
no its https://top.gg/api/docs
uhh
yh forgot the /docs
oh
ok
lol
umm
how to get DBLToken?
please
u wot m8
i told u already
ok lol
im confused
i want to see who voted
nice
but like i need a token and pass
but like?
how
i think thats all on the docs
im reading and i dont understand it
Hi
I need help
im reading and i dont understand it
@restive otter docs are there to help u understand
In my bot there is showing server N/A
show the code
@restive otter docs are there to help u understand
@restive otter but its not
it's literally there as Woo posted
i dont
yourDBLToken here i put it in and theres an error
okay...
and whats the password thing :;/
wtf I told u
In my bot there is showing server N/A
@restive otter show the code in a sourcebin
just please help ;-;
I already have tho???
and even Woo
bruh
i legit said
theres an error thing
u didn't
you never said what the error is did ya?
what's the error
just because an error pops up, doesnt mean we know the error
you just said
u didn't show the error
theres an error
@restive otter I am talking about bot ...
On top.gg
yes exactly
It's showing n/a there
yes have you used the api?
you need to use the api to send your server count to top.gg
@restive otter tell us the error then
don't expect us to magically know it
ok 1 sec
@jaunty plank thanks 😋
np
so whats webhook auth?
tell us the error
omg
stop changing topics
no im wondering cuz i need to do that
theres no error
yet
i dont know how you expect us to help when your lying about things
i got a .env file nvm
ok
const dblWebhook = new DBL(process.env.DBLTOKEN, { webhookServer: 5000, webhookAuth: 'password' }, bot); what happens now?
idk what happens
has anyone voted?
no
could you vote to test?
@restive otter
there's a test button in the edit page
const dblWebhook = new DBL(process.env.DBLTOKEN, { webhookServer: 5000, webhookAuth: 'password' }, bot); what happens now?
password
ok
lol
bot list
nothing works :/
why do u keep saying ok lol
don't think it was funny
;-;
nothing works :/
the webhook placeholder should have your vps ip/dbwebhook
dblWebhook.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dblWebhook.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});```
code
did you make your password password? or did you remove that for us 
did you use the link that was in your console
are you sure process.env.dbltoken is defined properly
on all 3?
wdym
i used link
and the thing is defined
and pass is dif
im using glitch if thats a problem?
i heard glitch doesnt allow port 5000
but i dont use glitch
uh yeah
you gotta use port 80
then use a port glitch allows
ok
events.js:173 throw er; // Unhandled 'error' event ^ Error: listen EACCES: permission denied 0.0.0.0:80 at Server.setupListenHandle [as _listen2] (net.js:1209:19) at listenInCluster (net.js:1274:12) at Server.listen (net.js:1362:7) at DBLWebhook._startWebhook (/rbd/pnpm-volume/c3a21c2b-7bf7-4bc0-b08e-07f5bbb7b34d/node_modules/dblapi.js/src/webhook.js:45:18) at new DBLWebhook (/rbd/pnpm-volume/c3a21c2b-7bf7-4bc0-b08e-07f5bbb7b34d/node_modules/dblapi.js/src/webhook.js:27:12) at new DBLAPI (/rbd/pnpm-volume/c3a21c2b-7bf7-4bc0-b08e-07f5bbb7b34d/node_modules/dblapi.js/src/index.js:69:22) at Object.<anonymous> (/app/Index.js:10:20) at Module._compile (internal/modules/cjs/loader.js:759:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10) at Module.load (internal/modules/cjs/loader.js:628:32) Emitted 'error' event at: at emitErrorNT (net.js:1253:8) at processTicksAndRejections (internal/process/task_queues.js:83:17) at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:58:3) at Function.Module.runMain (internal/modules/cjs/loader.js:828:11) at internal/main/run_main_module.js:17:11
i think thats more of a glitch problem now

id start by considering the ways it might not be working
like, the url you use, needs to include the port, if you changed the port in the program, you need to change it for top.gg
Hi, someone can help me make sure that when someone votes their send the data to a channel.
like, the url you use, needs to include the port, if you changed the port in the program, you need to change it for top.gg
@jaunty plank i have
@marble sand i think you mean something other than you said.
im not sure @restive otter, it may have something to do with glitch, it may be your not using the right password that you defined, or the token may be wrong.
everything must be right for it to work
ok
what exactly should you write here?
oh thanks
@restive otter thats the life of glitch

im sure glitch has a way of finding available ports
and URL should we put the url of our webhooks?
?
i know secret port what no one uses: ||69420||
lmao
thats my password, how did you get that
Is there a rate limit on .hasVoted()?
60 per minute afaik
Okay, thanks
And at most 100 votes iirc
http://123.456.78.900:5000/webhook for example
/dblwebhook
how do i get my ip
if they use the default from the js library
do i need to get it from the my VPS?
i suck at networking but i want to setup a socket
Hello
How can i create a webhooks could you please help and get vote in my own server
You cannot use api before your bot is approved
Ok
Suppose if i want to get another bot vote in my server
How can i use webhooks
Like dyno
Help
@willow spindle
I have created webhook
But i am unable to receive vote
In my server
Bot name Member Count
you have to setup it
also
You cannot use api before your bot is approved
@NMW03#2110
How can i setup it
wait for approval first
By creating a webserver
How can i create a webserver
then you can't
Ok i will use microsoft visual code for serving
learn a programming language
I know
No i use app for coding
@timber beacon which app
ok, also which language/library do you use
discord.js
https://npmjs.com/dblapi.js you can use official library
but wait for approval first
Ok
Because you cannot use it now
What are the app that i can use for hosting my discord bot in mobile phone
Could you please tell me
@willow spindle
idk
@timber beacon I know
umm
@left egretis there any way to get total votes of bot ! like i do command {prefix}vote it will show the votes of bot
Did you check our docs?
There is a bots/<id> endpoint that returns all info
including monthly and all time votes
Did the gateway go down? I got a bunch of 500 errors, but i don't know when they logged. I'm using the node sdk.
did you got the webhook running?
where do i get it?
what language did you use?
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});``` this is the Example from the docs. If the webhook is running you will see Webhook running at http://127.0.0.1:5000/dblwebhook
copy the URL and replace 127.0.0.1 or 0.0.0.0 with the IP of your Server. this URL you set in the page of your Bot on Top.gg
and if someone votes you will see in your console User with ID ${vote.user} just voted!
you can extend this to store the userid of the user that voted into a database to see the total votes per user as a example
yes
you can also mention the user without pinging them if you set <@normal ginkgoid> in the message (only in embeds)
whytf did this pinged someone
sorry
you can store the votes in a database.
if someone votes set the database +1 during the week and +2 on weekends
if you have a Proper database you could manually set it as a base value
you can
vote.send(any message)
you get the Discord Userid from the vote. then search for the user and then send a message to him
you get the userid from votes.user i think
then client.users.fetch(votes.user) will return the user that voted
if you then set the client.users.fetch(votes.user) as a value you can make user.send("text")
-api
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs
sry wrong channel
did you get an error?
why did you know id doesnt work?
ohh i think its vote.user.id
but i guess we should take further discussions into #development
rip
would update soon
i dont use v12 due to that cache thing
well you bot will go offline in october
bcs V11 will get shut down
-api
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs
hm
If we get rate limited (429) and API banned for an hour (sorry!), once we've fixed the issues, will the bot need restarting to reconnect for it to work, or should it be functional straight after the hour?
you mean from discord or from top.gg? this channel is for top.gg only, for discord use #development
in any case, you should try manually starting your bot again after an hour just in case it doesnt for some reason
in that case it should automatically function again
if you post with shard id then you have to send only guilds for that shard
What does the webhookPort and webhookAuth do?
Port - port to run the webhook on
Auth - a combination of characters to use as a password to make sure a request is coming from top.gg
if
@open bone https://your-server-ip:port/dblwebhook
Guys I used the api to show my server count. I got this error
Error: 429 Too Many Requests
dbl.postStats(client.guilds.cache.size)
}, 45000);```
This is my code
Can someone help?
I guess I got rate limited. Is it due to 45 seconds
smh yeah its probably that
they suggest 1800 seconds on the docs for poststats
yeah my bad
Lol
is top.gg webhook events coming in late
@dense grail mine seem to be coming in late. Got vote confirmation notification from my bot about 10 or 15 minutes after actually voting for it
Is there a way to fire the “vote” event without someone voting in order to dev test?
if you actually notice the bottom of the webhook pannel there is this button called test which exists for a reason :P
"take a dbl api"?
how do i see from my api?
sorry, I didn't understand. Do you want to make a dbl api?
sorry, I didn't understand. Do you want to make a dbl api?
@knotty garnet Yes want this
if you want to make an api you'll need to use raw http requests
unless you meant "use the api", which in this case there are a myriad of pre-made libraries ready for use
aaa need my new website owner? @knotty garnet
what?
-apispam
can i not use a .env variable for my api token, i got a 401 untill i stopped using the .env variable?
yeah
You're probably getting the var wrongly
const ggtoken = process.env.GGTOKEN
Lol
how to check if someone voted and reward them
Which lib
hasVoted()
which language?U use
python
Same here
Same
Any reason why this would be hitting a rate limit?
let DBLUsers = await db.DBLUser.find();
DBLUsers.map(g => g.ID).forEach((user, i) => {
const member = client.guilds.get('627967081014624294').members.get(user);
setTimeout(() => {
if (dblClient.hasVoted(member.id) && !member.roles.includes('667451645180903428')) member.addRole('667451645180903428').catch();
if (!dblClient.hasVoted(member.id) && member.roles.includes('667451645180903428')) member.removeRole('667451645180903428').catch();
}, i * 2000);
});```
it runs hasVoted twice on every timeout
Right, yes.
Sso lets assign that to a var above
and if that code runs more than once, you will have multiple concurrent timeouts all requesting data from top.gg
It's just in the ready event, so it runs once
the ready event may be fired more than once, make sure you set it to .once instead of .on
hasVoted returns a promise too, you're not awaiting
@molten quarry do you mean giving top.gg the amount of servers or getting the amount of servers on your bot?
Late response also
giving them the amount of server
Oh not sure
:/
Not on your end it would be len(client/bot.guilds)
Client or bot depending on what you use
giving them the amount of server
@molten quarry use the top.gg lib
will my boat be approved?
Does your bot function, and fit within #rules-and-info
How do you get the amount of votes a bot has?
okay so, how do I make my bot say "User voted" in a channel with the api and stuff. could someone help me?
@sullen nymph could you please help me if you got some spare time?
what library/language @supple flicker
discord.js

dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
instead of console.log, channel.send()
you will have to get a channel.
hm okay.
Using Windows Server 2016 I have added a TCP forward in my Windows Firewall for port 5000, when trying to visit it says that the server took too long to respond.
Any ideas?
Regarding webhooks.
Hi
Nothing gets sent to my console when someone votes...
Hey i just added the auto server count in my bot
Now its around 10 mins still not showing
So something i have done mistake??
I just create file called top.gg in my cogs
@sullen nymph can u please help sorry for the ping
can we using voting api on github?
Huh
What
@sly gate did you added the Webhook URL to your Page at Top.gg?
@hollow flame is the authentification of the bot valid?
does the bot validate that he connected to the DBL server?
How🤔
I check that
Bt i have created the folder top.gg in my cogs folder
In that i have paste the codes
ohh you use py
Yes
did you got this event?```
async def on_guild_post():
print("Server count posted successfully")
did you got self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) make sure autopost is true
idk. i use d.js
if you follow the infos on the offical documentation it should work
https://top.gg/api/docs
@dense shale that's got your cf token btw
no your cloudflare token
I heard the bot was disapproved if we use animated emoji. is it correct
There is a little problem no ? x)
I use this to know the vote count : ```js
await dbl.getBot(Pikacord.user.id).then(stats => {
bot = stats.points;
});
:D?
is there any way to post guild count without using dblapi.js? :o
A direct HTTP request to /bots/{id}/stats
thanks
You can view dblapi.js source code to see how it's done internally for reference
-botinfo 716533909818572850
Bot info
ID
716533909818572850
Username
Pokécord 2.0
Discriminator
0608
Short Description
Pokecord 2.0 is mainly made on public interest. This bot is based on Pokemons catching, trading etc.
Library
discord.js
Prefix
. (Customizable)
Total Upvotes
1
Monthly Upvotes
0
Server Count
No server count
Owner(s)
@quartz heron
@tawny pelican
@latent moon
@arctic trench
Links
That bot wasn't found
to have my server count show, i need to send post requests to /bots/{bot.id?}/stats, yes?
with the authorisation header
Someone know for this : https://canary.discordapp.com/channels/264445053596991498/412006692125933568/726412393164439604
You could or you can just do this if you have the api module.
const dbl = new DBL(Your Token, Your Client);
I don't think so @tidal star but you could just set up a webhook event that updates a counter per user id in a database every time they vote 🤷♂️ just remember to check if it's a weekend vote because they count double
You can
it's called points
it's a GET request to /bots to get the bot object
The libs also cover it
Points returns just a number not an array of user ids
Ah, then I didnt see that. Per user you'd probably need to use webhooks
No problem! 😊
Any girls?
Not the place to ask.

how i can put the shards on top.gg?
the send was this but not found the shards
.send({ server_count: servers.reduce((previous, count) => previous + count, 0), shardId: client.shard.id, shardCount: client.shard.count } )
if you're using discord.js v12 and using the Sharding Manager
then it should be client.shard.ids[0] for shardId
@vapid cape Nope
i used the discord js v11
In the web don't put shards or something like this 😦
.send({ server_count: servers.reduce((previous, count) => previous + count, 0), shardId: client.shard.id, shardCount: client.shard.count } )
.
@gloomy fractal above
he wants us to invite with admin perms
How i add servercount in my bot
Its in python i have created the topgg.py folder in cogs and added the automatic post
Bt still its now show yet in the top.gg
What is this ? 
https://i.discord.fr/DkkK.png
End I won't be allowed... but why...
The link worked perfectly before and the password matches and the port...

async with client_session.get("https://top.gg/api/bots/657776310491545620/check", headers={"Authorization" : "MyTokenHere"}, json={"?userId=" : str(users)}) as response:
But DBL's API responds with:
{'error': 'No query userId, add ?userId= to your request'}
I already have the query, right?
Yo how can I get admin in this server
you can't
np 👍
Learn how heroku works please
-_-
whats the dblapi.js version
2.4.0
@jagged prawn Yay!
❤️
Have fun with your bot @jagged prawn
thanks u too 🙂
Yes
hmm
My bots widget returns 1 server?
Yes
is the image just cached?
it turned out to be an issue with discord cache
discord likes caching stuff 
lol, considering that discord js v11 -> v12 just added a buncha of cache to all of the stuff
What's users
okay
💯
I need help when a user votes for my bot, the bot give them a role in my server
i also dont know how to
Hey I get an error from your api sometimes. Any reason why?
Error: getaddrinfo EAT_AGAIN top.gg
@restive otter
what language?
i read it
did you try the example?
yeah
vps's typically dont need port forwarding
i dont use a VPS
port forwarding depends on your router, this page has most routers listed
and guides for each one
Would anyone know what I'm doing wrong for it to send that error?
You need to add userid param to the url
dude
the error literally says "add ?userId= to your request"
how is that even hard
using invite tracker but showing missiong permission error ?
i give all permissions
@jagged prawn make sure bot has perms manage server
so that bot can see invite links in that seeveer
if bot has 0 perms he cant fetch the invites link of the server
also this is not bot discusiion channel you have to discuss in #development
this channel is only for bot api of top..gg
@restive otter ye this is the problem
bot is in 32 guild
i need skip but i dont know how
Quick question about the api. I have a voting streak counter on my bot like in the screenshot below. The way I currently do it is via webhooks in the bot's index.js file. The webhook vote event updates the info in the bot's database for the user who voted (new currency balance, vote UNIX timestamp, updates voting streak and gives them a voter role if they're in my bot's support server). This all works fine, however, if the bot is rebooting when a user votes then the webhook event fires into nowhere because the bot isn't online to receive it, thus causing users to miss out on their voting rewards and lose their voting streak. I was wondering if there's a more reliable way of going about this? My bot doesn't reboot often at all but sometimes it lines up with someone's vote and causes me trouble to go and fix it manually in the db. Right now the bot's in 1,200 servers and gets about 800 monthly votes so it happens about once a week. Any better solutions?
Sorry for the long ass message 😂
Can i get an api token before my bot got approved?
Nope
@golden adder one solution would be to put the webhook endpoint in a separate process connected to the same database
I was thinking that... How would I notify the user via DM though?
many ways to do that, you can make an api request to discord from there, you can send a message to the bot process via ipc or message brokers, you can use some middleman service to handle dbl votes...
you can use a pub/sub system with your database, if it supports it
Ok. Thanks @vapid cape I'll look into that
I'm getting error 524 Origin Timeout and 503. Is this normal?
Will it just pass by?
This is how to post guildCount
So I'm having some trouble with the api, I am trying to see if the user didn't vote it sends a embed, but if they do vote it doesn't do anything and lets the command run but even though I vote it keeps saying I haven't. I just started to work with this:
https://cdn.discordapp.com/attachments/412006692125933568/727172278181429248/unknown.png
why are you doing vote.id == vote.user
that will never be true, so you will never find a vote
Ah okay, I'm new to the api.
you need to check if vote.id equals the user id that used the command
also, dbl.hasVoted() exists
so make a var to see if they equal to each other?
Alright, thanks.
If you got multiple shards and it counts them, it should count all the guild counts
client.shards.id is not a thing in discord.js v12 tho
0 I believe
Yes, i am having the same Problem. Could anyone help us pls?
hi lol how can i get this verification code with api? https://prnt.sc/t8qbek
Please read channel topics

does anyone know the right firewall rule to make on gcp to allow dbl to send votes
i tried an ingress rule that allows tcp:5000 but still nothing
yeah
so i went to the bot page and it did update the server and shard count, but i'm still not getting vote events
on the topic of that, is there anyway to make it auto update the server count of all shards? because passing client in dbl just sends the server count of the shard that the dbl set up is on; is there a way to put it in an external file so it applies to everything?
yeah
or, if you want to do it by the api, you can use postStats to set the shard id and count, along with the number of servers that shard is in.
i got Error: 400 Bad Request
nvm i think i spotted it
if it doesn't work again i'll send it
TypeError: Cannot read property 'Id' of undefined
dbl.webhook.on(`ready`, hook => {
console.log(
`Webhook running at https://${hook.hostname}:${hook.port + hook.path}.`
);
setInterval(() => {
client.shard.fetchClientValues("guilds.size")
.then(results => {
dbl.postStats(results.reduce((prev, val) => prev + val, 0), client.shards.Id, client.shards.total);
console.log(results.reduce((prev, val) => prev + val, 0));
})
.catch(console.error);
}, 10000);
});
are you on djs 11 or 12?
11
it may be client.shard.id not client.shards.id
i dont have any sharded bots and have only done a touch of research on sharding
np
do you know how to fix my voting issue?
Ive never used the api yet(i don't have access yet), so i probably wont have an answer the docs doesn't have.
oh i see
uh to anyone else who may see this: i'm not getting voting events even though it's connected to the webhook
is it hosted on a home network?
if its hosted on a home network, it needs to be port forwarded
also, if you have ufw or iptables you may need to let it through
just use official library
it has hasVoted() function
because it is useful and you don't need to send http request
i mean you don't need to send a http request manually

so i need to update user data who voted for that i need webhook server? or i can do without that, im using python
@sullen nymph ^^^^^^
It's easier to use webhooks to store data locally
which will be more efficient but you will need to handle cases when someone voted for your bot while the webhook/bot is down
Just have patience
which library? discord.js? which version? v12?
try
bot.shard.id
ok
which version tho
v11 is guilds.size, v12 is guilds.cache.size
v11 is shard.id, v12 is shard.ids[0]
setembedimage(<widget link>)
yea, but discord caches it
?somerandomquery=somerandomvaluethatchangesoneachrequest
that works too
What's the URL
Apparently there's a limit of 6 characters in query value
Could also slap more params in
@jagged prawn discord.js version, not node.js version
What library are you using?
discord.js
I was meaning the api library
Theres an example of receiving vote updates on that page for the official library
In a specific channel in your main server it's pretty easy
Just get the channel(once at startup) and send the message there
adding this?
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
Yeah, instead of logging tho, send to the channel you want
TypeError: Cannot read property 'on' of undefined
dbl.webhook.on('vote', vote => {
You need to initialize the webhook like the example shows
On the const dbl = new DBL
Line
I don't know how to do that, thanks for the help
did you check the examples?
Yes, but I don't understand
which part didnt you understand?
https://top.gg/bot/702965635637837845 is 702965635637837845 my top.gg token?
no it's your bot's ID
Your top.gg token can be easily found at https://top.gg/api/docs#mybots
ok ty
"how do i get the bot to thank a user on the channel after voting top.gg?"
can i do it
with C#
?
Because couldnt see

using .net
what is DBL Token ?
y
oh ok
"how do i get the bot to thank a user on the channel after voting top.gg?"
C# . net
Can i do it ?
If the official DBL library for C# doesn't have a webhook, you can host one yourself using some library
what would webhookAuth be?
anything you want
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path});
});
dbl.webhook.on('vote', vote => {
console.log(User with ID ${vote.user} just voted!);
});
i am looking at this
and i do not userstand the hook.port or hook.path
k thank you
is this something i am creating or something i get it from somewhere
is there an example because I am clearly new to this and I am trying to learn
that is the example
hook is the webhook "session" that is running currently

its the same as client.on('ready'
in this case, its an event for the webhook
oh
which part didnt you understand?
@vapid cape I was trying to use
dbl.webhook.on('vote', vote => {vote.user.send("thanks for voting")});
but it doesn't work
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path});
});
dbl.webhook.on('vote', vote => {
console.log(User with ID ${vote.user} just voted!);
});
would i be changing the hook part or no?
like hook.hostname and hook.port
hook.port is set here
webhookPort: 5000
oh
but i don't change that right
it says Error: listen EADDRINUSE: address already in use :::5000
the log part is just logging whatever its set to
do you have port 5000 in use already?
i don't think so
glitch may not allow some ports

or you may have to request the ability to use a port

it would be a question for glitch
I think I should just give up this is too complex for me
isn't there an alternate for 5000
yeah, thats what i was saying
change the port to something glitch allows, or find an available port
okay
Glitch only allows 3000
contact glitch support
i look into it and they said you can setup a proxy
You might need a second server to do that, at that point just get a VPS
oh f
every web request has a port
ok
does anyone understand sharding with discord.py??
-api
THIS CHANNEL IS ONLY FOR SUGGESTIONS/HELP/BUGS TO DO WITH OFFICIAL TOP.GG API LIBRARIES AND API DOCS FOUND AT
https://top.gg/api/docs
shivaco was responding to christian
to use the endpoints directly you can make http requests to them with any http library
alternatively you can use one of the official libraries, which support all endpoints
for example, you're already using dblapi.js, to access the /bots/:id/votes you can use dbl.getVotes()
I keep getting cloudflare rejection with dbl api
anyone know how to fix
0|projectb | Error: 401 Unauthorized
0|projectb | server: 'cloudflare',
0|projectb | 'cf-ray': '5aba8533fab12fa5-FRA'
0|projectb | },
0|projectb | ok: false,
0|projectb | statusText: 'Unauthorized'
0|projectb | }


I am doing dbl.getVotes().then(votes => { console.log(votes); });
and it's only showing like couple votes and on the website it says 37 votes
all of the votes were in this month
its close to july, its possible the monthly reset already happened but the website didnt update yet
okay ty
i had a friend vote for it just now and i tried it again it gave no new result
Anyone?
anyone?











