#topgg-api
1 messages · Page 72 of 1
var request = require('request');
request('https://cortex-genel.glitch.me/api/cortex', function (response, body) {
var cortexg = JSON.parse(body);
```
ok ay
dbl python lib requires aiohttp below 3.6.0, but discord.py requires 3.6.0 minimum
slight conflict there
install from source for now
alrighty
Hey im just wondering, how would I handle the webhook when my bot is sharded
in a different process (this could be your sharding manager process)
previously i had a simple
const DBL = require('dblapi.js');
const dbl = new DBL('token', {webhookPort: 3000, webhookAuth: 'token')
but now that wont work because if every shard did that itd get errors with the port.
How can I make just one shard handle it
or where else would I handle it. using discord.js btw 
are you using internal sharding
const Discord = require('discord.js');
const manager = new Discord.ShardingManager('./bot.js')
manager.spawn(3);
manager.on('launch', shard => {
console.log(`Launched shard ${shard.id} now`)
})
is my shard manager
is that stable or master
idek
idk wha im doing or what that means
but its discordjs v11.5.1-dev or something i thinkk
do you want to send a dm to the user who voted
yep
basically just need to be able to send something to the user and thats all id need
oh wait
ignore that
you could use <Shard>.send() to make one of your shards dm the user
ill give it a try
thx 
ye no i have no idea how id send something to a specific shard and how to then receive that. google aint helping

I put the code mentioned here in my bot https://discordbots.org/api/docs#jslib
still doesnt work
halp
@inland spindle few questions
- did you download the npm?
yep
const dbltoken = "DBL TOKEN"
const dblport = 80
const dblpassword = "enter password here"
const DBL = require('dblapi.js');
const dbl = new DBL(dbltoken, { webhookPort: dblport, webhookAuth: dblpassword });
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!`);
});
use that
excuse my sillyness but whats dbl pass? @obsidian tide
so where's ur bot page?
there should be a edit button
scroll down
and then you can add your webhook AND password
so you can make ur password anything u want
i reccomend a secure password
like completely random
Strong Password Generator to create secure passwords that are impossible to crack on your device without sending them across the Internet, and learn over 30 tricks to keep your passwords, accounts and documents safe.
No
no
let me find code to post server
i put this in a eval cmd constantly dbl.postStats(client.guilds.size)
if u put it in some loop when u connect to the dbl server, u might be able to make auto post
this is what I put but didnt work
u dont put it there
if u do, u have to make an autopost loop
what's , client);
@inland spindle ^
got the code from documentation website
...
here's a simple way to sperate the dbl code
- delete all the current dbl code u did
- make a file called "dbl.js" (same direction as bot.js/server.js)
- add
require("./dbl.js")in your code (usually at the top)
- add this to
dbl.js
const dbltoken = "DBL TOKEN"
const dblport = 80
const dblpassword = "enter password here"
const DBL = require('dblapi.js');
const dbl = new DBL(dbltoken, { webhookPort: dblport, webhookAuth: dblpassword });
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!`);
});
ofc change the vars of dbltoken, dblport and dblpassword
if you are using glitch.com which im assuming u are because of the formatting colors, change dblport = process.env.PORT
dbltoken = the token that is listed in https://top.gg/api/docs#mybots for your bot
dblpassword can be anything, but you need to also set the same pass in the dbl website using the edit button in ur bot page
k
what does it mean?
Your dbltoken is right?
yes
The dbl token is not the same as the bot token
how can i give user who vote a credits ! like probot
i tried this but there's nothing in console 😕
dbl.on('vote', async vote => {
console.log(vote);
})
ok I'll make this easy and brainless to make you understand
Webhook URL is your server ip:port of where a webserver will receive the vote.
Webook Auth is your webhook password of your choice 200x emphasis on of your choice
@frigid shore
if you receive no votes
make sure to configure your firewall
or portforward properly if hosted on home
const app = express();
const server = http.createServer(app);
const dbl = new DBL('token', { webhookAuth: 'password', webhookServer: server });
console.log(dbl.webhook);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
it doesnt work
oh
i didnt save
my progect
😄
make sure the webhook URL on your bot page is correct
and save your stuff before testing it 
how to get ip of my server? 
thats something you can google
that already falls into too much spoonfeeding category
i created server, but i cant see its ip :(
if you got a VPS then the VPS provider often shows the IP in the admin page on their website.
if the server is at your home then it is your own ip address.
if you host your server somewhere else then just google how to find the IP
i created server with express
const app = express();
const server = http.createServer(app);
const dbl = new DBL('token', { webhookAuth: 'password', webhookServer: server });
console.log(dbl.webhook);
dbl.webhook.on('ready', hook => {
console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
so, its ip is my ip?
how to make bot online in glitch
@restive otter this is not top.gg api related. Ask on #development
ok
isn't there a way to bind the api to library your using or something so the lib handles all the events?
like with discord.js
Good evening all
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 set up the token and password in my code.
Also the url is my vps' ip and port
Similat this
1.1.1.1:5000
The console logs that am running on
0.0.0.0:5000
So what im missing?
I tried changing the port also didnt work
Does it needs to set the static ip in the code ?
why does it say its running on port 80 when ou set it on port 5000?
you dont need to set up any ip in your code, it will listen to all requests that come through that port
you just need to make sure the requests arrive correctly, by providing the correct public ip and port to your vps
No that screen after changing the port in top.gg website and code
Also tried using express
But nothing done
@vapid cape im sure that vps' ip and port are correct
Does anybody have a NSFW api i can have or no?
@kind barn check with your hosting company if you need to open ports
@vapid cape thanks brother
@restive otter no
@restive otter wrong channel
yes i have created
direct webhooks when
so the webhook url will go to URL and what about authorization
that's where you put your key or password that authorizes the webhook to be used
Hi! I'm trying to use the example python code. I have dblpy 0.3.3 and I'm getting this error:
Extension 'dbl' raised an error: AttributeError: module 'dbl' has no attribute 'DBLClient'
print(dbl.__version__)
@restive otter That means top.gg does NOT support Discord webhooks
You have to make a webserver yourself
Do I send you the Google search link
Also pip show dblpy shows 0.3.3
Nemeth-MacBook-Pro:DBL-Python-Library nemetharon$ pip show dblpy
Name: dblpy
Version: 0.3.3
Summary: A simple API wrapper for top.gg written in Python
Home-page: https://github.com/DiscordBotList/DBL-Python-Library
Author: Assanali Mukhanov, top.gg
Author-email: shivaco.osu@gmail.com
License: MIT
Location: /usr/local/lib/python3.6/site-packages
Requires: ratelimiter, aiohttp
Required-by:
Did you decide to utterly ignore me
print(dbl.__version__) also says 0.3.3
i didn't find it
@sullen nymph nice osu email >w>
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);where i put this jn my code
Somewhere
Opening top.gg docs, we see https://discordbots.org/api/docs#ratelimits
ty
Why does the api take forever
Like for the .hasvoted I vote then my bot still says I haven’t voted for the next 2 minutes
While unbelievabot takes like seconds after I vote
use webhooks instead
How would I check if the message author has voted
Ooooooh nvm
I’ll see if that’s faster
Why does it say on is undefined dbl.webhook.on("ready", hook => { console.log( `Webhook running at http://${hook.hostname}:${hook.port}${hook.path}` ); });
@mighty shuttle do you know why
Please don't ping me or any other random user for support, if people know how to answer the question they will answer on their own
How do i do the webhook, i see the code on the website and it says something about choosing a website to send the thing to but what would that be
The IP of a domain pointing to the server you will be running the webhook receiver on
Ok so i was able to lookup a webhook website and send the test msgs to it
but how to i connect that back up with my bot?
mk
hello
I have issues with votes
last time I saw my bot it had votes ~43
and now it says 1
whie?
Month votes or permanent votes?
Maybe it resets only tday
whiee?
nope
it resets every month
iirc
1st day of month (i.e. 1st feb this month)
It resets on new month after someone votes
ay
Which means no one has voted for your bot until yesterday/today
That wasn't exactly the start of new month
U voted twice in a minute?
😐
Weekend votes Luma
Oh
there is a test named button on top.gg
if you every used it?
webhook test
😐
Weekend votes Luma
not weekend it was a webhook test done by me
because I had some issues tracking votes
so tested it
The messages didn't state so explicitly OR implicitly
ye
ik that
but I am telling you that it was a webhook test
I maintain diffrent logs for them
Was the 11:57 PM one a test too?
nope
11:56 was tested one
and see the diffrence
AM | PM
lumap
ping if you find answers to this.
If it doesn't make sense, blame cache :wesmart:
View Nia's historical performance from Discord Bot List (top.gg). Updates every hour.

why is there a bot with 170 shards at 1850 servers
Soz I can't mathz
there should be a ranking for most shards
oh really
give me a few minutes and i'd spool up 1024 shards 🤣
90% of them would be empty, mind
have you noticed that some of the biggest bots dont post user/server/shard counts to top.gg?
Most do
shard counts are kinda broken on dbl.marcorennmaus.de
it only works if you report per-shard user counts iirc
I'm not a booster anymore F
Eee... I have a problem with top.gg API
I want to use that
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
}, 1800000);
});
But...
TypeError: Cannot read property 'Id' of undefined
at Timeout.setInterval [as _onTimeout] (c:\Users\####\index.js:37:57)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
Can someone help me?
@thick flint is client.shards defined?
no
so why are you trying to get data of an undefined object?
no, I don't think they are required. Just put 0s
But this doesn't work
does your bot has a shard?
ow
sounds like a no
Where i fine my shard ? The bot shard?
shards aren't required
if no:
dbl.postStats(client.guilds.size);
Ok
which library do you use
that's js
Thanks for helping
Why does webhook give my ip as 0.0.0.0?
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});```
It means that it will accept connections on all the ip addresses that the computer has
Should I enter the server's external connection ip on my editing page?
https://**.***.***.78:3000/dblwebhook
if that's your machine's ip
IP address will be as I sent?
also check if your webhook listener expects http or https
Okey
so
The python api
requires a version of aiohttp
but discord api wrapper thingy for python requires a different incompatible version
halp
let's hope it works
lol
Install from source
Curious why the webhook doesnt support discord webhooks?
It would be soooo awesome to receive alerts in a channel on my server as opposed to having to open up a port to listen to webhooks
It would be soo amazing just to get them in anchannel
You can do that anyway
It's not hard to do a webhook to discord
The API hook is only for sending it to your webhook server for you to handle yourself
you can use stuff like IFTTT to convert one webhook into the other
Anyone could probably help if you actually stated the issue
IFTTT?
thanks shivaco
i just sent this to my collegue whos having problems with getting his smart boiler to do stuff
hes well chuffed
he said "i know what app im playing with tonight" lol

shivaco what library do you develop btw
dblpy
Are these examples accurate because they are not working for me
😭
after looking at the wrapper
the issue is in the typings
Sent a PR to fix
webhook is its own emitter
i ended up making my own webhook handler sadly as the internal one in the wrapper wasnt supporting TS properly
thing is
webhook isnt its own emitter
TopGG extends EventEmitter
meaning TopGG itself is the emitter
@arctic arch I am correct yea? (sorry about the ping)
TopGG is a event emitter but TopGG.webhook is also an EventEmitter
vote events are not emitted by TopGG
they are emitted by .webhook
👍
why am I getting tons of Error: 401 Unauthorized at IncomingMessage.res.on (/home/hector/Desktop/UpvoteBot/node_modules/dblapi.js/src/index.js:118:25)?
(from cloudflare)
Regenerate token
the error is coming from a dbl request, which includes all dbl methods except webhooks
so which part is still working?
hey I'm using dblapi.js to report stats and had a quick question. I'm using discord.js and my bot is sharded.
Do I just need to pass my client object into the dblapi constructor on each of my shards? Or would I need to manually add up server counts across shards and just send it from one shard?
just a little confused about what the serverCount argument on postStats refers to - the total server count or just the count for the current shard?
when you pass client into dblapi, you dont need to use poststats
^
dblapi is also smart enough to handle shards
there is an autoposter
data.server_count = this.client.guilds.size;
if (this.client.shard && this.client.shard.count) {
data.shard_id = this.client.shard.id;
data.shard_count = this.client.shard.count;
} else if (this.client.shards && this.client.shards.size !== 1) {
data.shard_count = this.client.shards.size;
}```
^this is what dblapi does automatically
gotcha, so it'll call postStats internally using info from my client with each shard's serverCount, and then they'll get added up on top.gg's server?
yes, each shard will send its individual server count, and the server should add them up
perfect, thank you 😄
What should I write here? server ip:port ?
in url yes
with http/https ?
ok
the url should look like http://(IP)ADDRESS:5000/dblwebhook
change the port and path if needed
and the authorization can be whatever you want it to be as long as it is the same as what the webhook is expecting
Webhook running at http://0.0.0.0:0/dblwebhook
is this normal?
finally I did. Thanks
So im trying to fetch if a user has voted but it says .hasVoted is not a function?
My Type of Error: TypeError: dbl.hasVoted is not a function
Show some code
if (message.content.startsWith(config.prefix + "checkupvote")) {
function hasVoted(id) {
client.dbl.hasVoted(id).then(voted => {
if (voted)
return true;
else
return false;
});
}
dbl.hasVoted().then(votes => {
if (!votes.get(vote => vote.id == message.author.id)) {
const noupvote = new Discord.RichEmbed()
.setTitle("You haven't upvoted.")
.setDescription("This is your __reminder__ for updating the bot today!\nLink to Upvote: [https://top.gg/bot/390295962159022080](Upvote Bot)\nThis message will be removed once upvoted!")
.setColor("BLUE")
.setTimestamp()
} else {
message.reply('thx')
}
})
Help
@restive otter it takes an id, but you forgot client.dbl on the second one
ah
I did not understand anything about the authorization of the token ;=;
can someone explain it to me in an easy to understand way this?
🥺
I got it appreicated it!
can you emit dbl.webhook.on("vote")?
!play believer
@pulsar gyro
@Apiddd#4442
Bot commands in #commands or #265156322012561408 not here
@restive otter you can emit anything.
You need to actually install the DBL module
You will still have an issue about aiohttp
Read channel topic 
ahh thankyou couldn't see the api doc link i'll read it now
i cant get webhook to post in server please help
https://discordapp.com/channels/264445053596991498/412006692125933568/675063834796621834 that's the point... I'm just using it to log votes, but it's spamming my logs and using a lot of CPU/ram
I'm getting a lot of logs like:
{ Error: 401 Unauthorized
at IncomingMessage.res.on (/home/hector/Desktop/UpvoteBot/node_modules/dblapi.js/src/index.js:118:25)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
raw: '{"error":"Unauthorized"}',
body: { error: 'Unauthorized' },
status: 401,
headers:
{ date: 'Fri, 07 Feb 2020 19:11:19 GMT',
'content-type': 'application/json; charset=utf-8',
'content-length': '24',
connection: 'close',
'set-cookie':
[ '__cfduid=d0beea544c8207ffcff3987f538fa09431581102679; expires=Sun, 08-Mar-20 19:11:19 GMT; path=/; domain=.discordbots.org; HttpOnly; SameSite=Lax; Secure' ],
'x-powered-by': 'Express',
'access-control-allow-origin': '*',
'access-control-allow-headers': 'Authorization',
etag: 'W/"18-XPDV80vbMk4yY1/PADG4jYM4rSI"',
'cf-cache-status': 'DYNAMIC',
'expect-ct':
'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
'strict-transport-security': 'max-age=15552000; includeSubDomains; preload',
'x-content-type-options': 'nosniff',
server: 'cloudflare',
'cf-ray': '5617ab410e46d46b-HAM' },
ok: false,
statusText: 'Unauthorized' } ```
- it's using more cpu than my main bot
Do you have a loop that keeps spamming the DBL website?
Keep in mind that there is a rate limit of 60 calls per minute for the DBL api
401 Unauthorized probably means that your token is incorrect
Hi
I'm wondering
why there is a GET request from DBL after a POST request
(for the webhook)
Can someone explain me a Lil bit of it 😅
(Python) Just started using the dbl API. I tried to test the webhook with the provided webhook example but I am receiving this error. Any ideas what's causing it?
@sullen nymph did you change the aiohttp version for the pypi package?
it was changed around 10 days ago to support discord 1.3 (which i am currently using) afaik
Only the github repo
that might be the issue
i did use the pypi package instead of the repo. I will test it now
unfortunately, that did not fix it for me
:/
whats yer code
using the webhook example from the repo readme
could it be that I am using the wrong port?
right now its 5000 (the default one)
well what are you hosting your bot on
digitalocean (vps)
you need the port you set to be open
the port seems to be open but I am still experiencing the issue
ok, I found where the issue is
I changed the webhook url from https to http, which is not really desirable
well it cant be secure if you dont have a secure system lmaop
sorry, networks are really out of my comfort zone. I managed to figure things out. Thank you for your time
🙂
The library only supports http by default, if you want https then you need to use another web server
Hello, would anyone be able to guide me towards resources for configuring a custom webhook in C# with Discord.NET / .NET Core?
Yeah I've been using this, I don't believe this supports webhooks, but instead makes queries to the API which is forbidden if you have a lot of upvotes. Though correct me if I'm wrong
the java lib also doesn't support webhooks, but it isnt that hard to implement I think
Yeah I'm trying to find resources online but literally everything is ASP.NET exclusive, kinda stumped cuz I've never done this in regular .net core
I don't use the DBL webhook, but my private bot has already a tiny webserver attached to it for other reasons
Im sure there are some C# libs that can create a webserver
Alright cool I'll try and look into that
https://github.com/unosquare/embedio Would this do the trick?
I'm a Java dev, so I can't help with .net specific stuff
gotcha
But it looks like it might work
https://i.imgur.com/obgcRVu.png Just found something very useful hahaha
:
I dont understand the webhook things can anyone explain it a bit more to me im interested in learning it.
hello?
top.gg/dbl webhooks?
basically whenever a vote happens, top.gg will send you a POST request to the url you specify in the bot edit page
its up to you to provide a webserver or address that is able to receive those requests
@vapid cape how would I do a webserver?
depends on your language
discord.js
for javascript there is a library which does it for you
dblapi.js
if you dont want to use the library, you can setup a webserver using the built-in http module, or with libraries such as express.js
@sullen nymph i take it pypi install is still oofed?
yup
i gotta work out where df i put the code for the API, my command handlers made it a bit weird
I don't know if this is an API issue or a bot issue, but at a random point my bots server count went to 1 until I restarted, this only appeared on the website, as evaling showed the appropriate server count
Oh nvm I made a really big brain move and accidently posted my testing bots server count lmao
So for the widgets. How can I change the widgets size?
@dapper copper That says nothing about the size.
use css to change the image size
It's an svg image, you should be able to resize it (on a website, just sending it as a link you cant afaik)
ok
I'm getting a Uncaught Promise Error: Error: 400 Bad Request error
using the dblapi.js package
Im teying to figure out how to create a webhook to get votes for my bpt but i cant figurw out how to use it
where would i go to create a webhook?
@rigid lichen can you show me the code where you use dblapi.js?
like where you call a method
yes sure
ready.js
// Post DBL stats
const DBL = require("dblapi.js");
const dbl = new DBL(this.client.config.dbl, this.client);
dbl.postStats(this.client.guilds.size, this.client.shard.id, this.client.shard.count);
dbl.on("posted", () => {
client.logger.log("Server count posted to DBL!");
});
Oh!
My bad
It's because of the discord.js update
@rose cargo click "Edit" on your bot's page and scroll down
@willow spindle ok thx
You're on master I assume? @rigid lichen
👍
@NMW03#0001 what would i put in these feilds though?
@rose cargo you need a webserver to receive the webhooks
the url is the address of your webserver
i dont understand how to make a webserver tho
what language are you using?
js
where is your bot hosted?
you can use dblapi.js
it creates the webserver for you
for glitch, you need to use process.env.PORT as your webhook port
i dont understand much about it
and in the url field you need to put your glitch project url plus /dblwebhook
ok then what?
you know how to install modules?
yes
then install dblapi.js
i did
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 code for how to use it
yourDBLtoken is the token from your bot's edit page
webhookport should be process.env.PORT for glitch
ok
webhookAuth doesnt matter what you put, as long as you put the same thing in the authentication field in the website
in the url field, it should be YOURGLITCHPROJECT.glitch.me/dblwebhook
then save the setup in your dbl edit page, and hit the test button
you should see the console.log in your logs
@Tim#2373 i used the stuff u said to use now my console gives and error
Error: listen EADDRINUSE :::30003:54 PM
at Server.setupListenHandle [as _listen2] (net.js:1360:14)3:54 PM
at listenInCluster (net.js:1401:12)3:54 PM
at Server.listen (net.js:1485:7)3:54 PM
at Function.listen (/rbd/pnpm-volume/0a96f05c-d7e5-41d5-8422-6adb49bbe599/node_modules/.registry.npmjs.org/express/4.17.1/node_modules/express/lib/application.js:618:24)3:54 PM
Jump Toat Object.<anonymous> (/app/server.js:179:20)3:54 PM
at Module._compile (module.js:653:30)3:54 PM
at Object.Module._extensions..js (module.js:664:10)3:54 PM
at Module.load (module.js:566:32)
Your uptime robot is on the same port
Have them use the same server
instead of a different one
@rose cargo if you already have a webserver, then add it to dblapi
{webhookAuth:yourpassword,server:yourExistingServer}
how do i get my existing server?
acutally remove port, because with an existing server you dont need the port
the existing server is the uptimerobot server
what is your code?
@vapid cape dm me
i cant copy and paste
because im on mobile
and glitch doesnt allow it
so ima have to send u the glitch link
lol ok
@vapid cape i sent it to ur dms
go to the server.js part
this is so confusing
@vapid cape did u check it?
this is so confusing lol
@rose cargo
this should be your server
move that entire code block to the top
and add server:listener to the dbl config
do i remove webhookAuth?
no
@vapid cape now it says cannot read property on of undefined on the dbl.webhook.on
what do i do now
?
@spiral steeple ^
@spiral steeple dm me
Are my dms off?
yes
ok
and you should probably put your dbl token in your env file as well
ok
ok it works
@vapid cape how would i get it to show a users name and discriminator though?
client.users.fetch()
huh
it sends vote
the webhook gives you a user id, and you probably noticed
ye
now you need to use this id to get the user from your bot
how
check your discord library's documentation
for example
I use this but it shows it as undefined
@willow spindle ^
should I use await on the fetchUser?
yes
ok let me try it
Im sorry if im trouble it just that i havent done this type of stuff before
yeah that's good practice
so like if wamted it to send to a certain channel instead of console would i use async (vote, message)?
@spiral steeple ^
no, to send it to a channel you'd have to either get the channel from cache or fetch a channel
then use its send method
add ) after }
thanks.
The python package of dblpy library requires aiohttp<3.60 but discord.py requires aiohttp>3.6.0
Should I use get and set api calls to top.gg instead of using the library dblpy
You need to install of source atm
The GitHub version has been updated for 1.3.1 d.py
Okay, thanks
But one problem:
How to install python library from Github source code
pip install git+https://github.com/DiscordBotList/DBL-Python-Library
Thanks again.
vote webhook test is not working for me
my api doesn't received any data
using postman to simulate the request work fine tho
so url and authorization are fine
when people vote it doesn't receive anything too
was working fine in the past tho
do u get any error?
nope nothing
you used postman to test dbl -> postman or postman -> bot?
postman -> bot
then idk, show relevant code i guess?
actually it doesn't even enter the route of the api
and you used exactly the same url as in your bot edit page?
yup
did you save before using the test button?
yup
but it's the same config for a while now
since it was working before
and just it cease working i don't know why
does the test button also not work?
i just see a confirmation of the webhook being sent but the bot doesn't receive anything
try dbl -> some api tester
any website idea to do so ?
Get a random URL instantly and in realtime test, inspect, forward and script Custom Actions for each incoming request
so dbl is sending
lol
¯_(ツ)_/¯
maybe there was a bug in dbl's database
and changing the url fixed it
maybe
for now test are working but not actual vote tho
i asked for a friend to vote and it didn't work
if anybody have a solution ? would be greatly appreciated
Oh, thank you
Did anybody have an Naruto bot ?
This is api related channel
How can i make Webhooks?
what do you want to do?
if you go to the edit part of your bot
and scroll
down
to the bottom
should be a button like generate token or somthing
thanks
still having problem with it btw ... test work but actual vote don't
and after looking throught my nginx log i can see it doesn't even reach my server sometimes
so not a code problem
but i don't get how i would be the only one to get such an issue
anyway to get a log of what is happening with webhooks on the website part ?
Its almost defo not the website
certainly
Make sure your firewall isnt blocking anything
And check if your port is actually open on that address
like if i change the url
and test it out right away
it works 1 time
and after that never again
basically
could this be cache or something ?
is there any staff i can pm to maybe get a log of what's going on or something ?
cause all my other webhook are working perfectly fine so this is weird
do the test button have a rate limit ?
cause when using https://webhook.site for example webhook are sometime not received too
Get a random URL instantly and in realtime test, inspect, forward and script Custom Actions for each incoming request
<@&264889767072628742> mind at least acting like you care?
-atmods
Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.
Here are some examples of emergencies:
- Raids / Multiple members mass spamming.
- Severe disruption of Discord's ToS (NSFW content, etc)
- Anything that requires more than 2 moderators to handle.
they left
left the server
and i have no idea what you're talking about considering this
did they have a bot in the queue
No
lmaoo
imagine
@restive otter english only
I have a problem with my Bot
When I start my program on the bot everything goes without errors but always after a certain time the bot goes offline on its own server but there is no error message. For this reason, I tried my program with many others and everything went without problems and the bot stayed online. Did I do something wrong or is it up to you?
@restive otter TopGG is not responsible / will not host the bot for you
this channel is to do with the api for the discord bot website
This channel is for the DBL API
You issue belongs more in #development altho it seems to be a hosting problem
ok
js and python are the most popular languages on this server, but you want to be in #development if you have questions about bot development
ask and wait for someone who can answer to help you.
- Url: Your webhook server address (This is normally your IP you host the bot on, port and then /dblwebhook)
- AuthKey: litterally anything
to run a webhook you need to host a webserver that will receive the web requests
the javascript and python libraries can do that for you
then you need to find out your public ip, make sure your ports are forwarded and fill in the details on the website
save before testing
i'm still not receiving all of the webhooks
anyway to get more insight on what is the website side error whenever it send a "upvote" event and doesn't succeed ?
Oops! Error: 400 Bad Request
using dblapi.js
^2.3.0
ping me
recent error after updating to discord.js v12
show full error
that's only the error 🙂
change js dbl.on('error', e => { console.log(`Oops! ${e}`); }) to js dbl.on('error', console.log)
at IncomingMessage.res.on (/rbd/pnpm-volume/ce908d90-1591-4e68-8e70-6fd0493443ea/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/index.js:118:25)
at IncomingMessage.emit (events.js:194:15)
at endReadableNT (_stream_readable.js:1125:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
raw:
'{"error":"Required parameter server_count or shards missing"}',
body:
{ error: 'Required parameter server_count or shards missing' },
status: 400,
headers:
{ date: 'Fri, 14 Feb 2020 11:48:06 GMT',
'content-type': 'application/json; charset=utf-8',
'content-length': '61',
connection: 'close',
'set-cookie':
[ '__cfduid=d834ee1878c0e7a32c303969e7b7e5a671581680886; expires=Sun, 15-Mar-20 11:48:06 GMT; path=/; domain=.discordbots.org; HttpOnly; SameSite=Lax; Secure' ],
'x-powered-by': 'Express',
'access-control-allow-origin': '*',
'access-control-allow-headers': 'Authorization',
etag: 'W/"3d-AG5DMcRAr7VonaedOjpOtCEaVnk"',
'cf-cache-status': 'DYNAMIC',
'expect-ct':
'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
'strict-transport-security': 'max-age=15552000; includeSubDomains; preload',
'x-content-type-options': 'nosniff',
server: 'cloudflare',
'cf-ray': '564ecfa47893cefc-IAD' },
ok: false,
statusText: 'Bad Request' }```
Required parameter server_count or shards missing
Discord.js v12
are you using .postStats?
what's that now?
show your dbl code
ok
dbl.on("posted", () => {
console.log("Server count posted!");
client.channels.fetch("668510061362151425",true);
client.channels.cache.get("668510061362151425").send("Server count posted!");
});
dbl.on('error', console.log)
one taken from the official docs and modified a bit
this worked for me on discord.js v11.5.1
what is isWeekend()?
it seems @arctic arch didnt add the recent v12 changes to dblapi.js yet
okie
likely wont be supporting master right now as it's in development
instead of adding your client to new DBL() use dbl.postStats() instead
okies
@frigid shore on weekends, votes are counted as double
@arctic arch well for now you could simply do something like data.server_count = (this.client.guilds.size || this.client.guilds.cache.size);
tks
ye
yea I could
maybe I will fork it
it's just weird maintaining something for a development version with lots of breaking changes
yeah its understandable
although djs v12 has been in development for years and many people use it in production lmao
but if it seems like this is settled on and v12 is still far away from ever getting stable then I might
including us
yup
is there a time limit of getting votes?
i want to set interval on each second
to get votes
df
?
isnt the votes a event
what?
but i dont want to use webhook
flooding the API with requests is gonna get you told off by tonkku
if you need help with the webhook then ask here and if its JS im sure tim can help ui
ok
I forked the api code and have edited it to just post server count on discord.js v12
https://github.com/SoulHarsh007/dblapi.js
@arctic arch okay with that?
An official module for interacting with the top.gg API. This fork works with discord.js v12 (only post server counts) - SoulHarsh007/dblapi.js
what must be here?
you can do whatever with your fork
okie thanks
help me
@frigid shore nothing, that's just an example of existing routes in the web server
@restive otter you are not logged in
will webhook work with this code?
not when you made the request @restive otter
:((
@frigid shore do you have an existing express server
you can choose
random?
as long as it's over 1024
@restive otter I think you should seek help from someone who can also speak your language
const config = require('./../config.json');
exports.run = (client, member, sql) =>{
snekfetch.post(`https://top.gg/bot/668481980547072007`)
.set('Authorization', config.dbotAuth)
.send({"server_count": client.guilds.size})
.then(() => client.users.get(config.ownerID).send(`Red Music (best bot) has been added to a server.`))
.catch(err => client.users.get(config.ownerID).send(`${err}`));
}```
why no work?
snekfetch is deprecated. did you get that from #312614469819826177
you need to add your webhook details on the website
the url is empty
what is url?
http://<your ip>:<the port you chose>/dblwebhook
server ip:port/dblwebhook
yes
oh
my
god
this conversation, Smoky this all can be found through google
and the top.gg api webpage
no
tonkku is better google 
@arctic arch does the bot need to be online to make webhook?
no, the script that makes the webhook run (i do my dbl stuff in a backend server) must be running
hm.. but it doesnt work..
@frigid shore do you have a static IP
?
if yes you'd need to configure your router to open the port, on a host you just need to make sure there's no firewall blocking it
what's static ip.
google it
your internet provider changes your IP (sometimes at random, once or twice daily even i think) and you would need to update it.
nono
you are going to want that
its
the script

if i put webhook here
YEEE
WEBHOOK WORKKS
v
@arctic arch tks))))
yes..
so the webhook is running but does it receive the test request
i used this script
its ip
show an example
??
show what you put
and authorization you put the same one in your code?
yes
did you save and press the test button?
yes
and nothing appeared in the logs?
appeared
what appeared
not yet
that's what the test button should trigger
but i cant vote
is there a rate limit to it ? (to the test button)
@frigid shore you dont need to vote, just press the test button where you added the url and authorization
please
what is test button?
ok
@little ice I am having no problem receiving every webhook post
yeah
no
using webhook.site it is working
doesnt work
but my for some reason my api doesn't receive all of them
and whenever i use postman (for example) everything is working fine
so i guess there is a problem somewhere
is there a way to see the webhook side error ?
cause my nginx doesn't record the webhook being sent so i don't even receive a request
nope
webhook was working fine before
but it just doesn't work now i don't know why
so for now i'm using Zapier as a work around and it is working
but it is very limited
but it seems the problem is somewhere within your network
maybe but
is your nginx configured with any sort of rate limiting?
why twitch webhooks and zapier one are working perfectly
no rate limit that i am aware of
every other service are working fine
then it should be all about the url with correct ip and open ports
but why ready event works
ready event works because it means the server is running
but if the server is not receiving anything then something is blocking the requests
@little ice try doing something like monitoring incoming connections instead of relying on nginx logs
the connection might be coming but be rejected somewhere before it reaches nginx or by nginx itself
mhh
does anybody speak russian?
niet
any idea how to do that ?
niet
@vapid cape blin, zhalko
-tonkku :(((
Chto ne tak
vebhuk ne rabotayet
Что пробовал, что нет?
Он запускается, а ивент на нажатие кнопки не работает
