#topgg-api
1 messages · Page 62 of 1
hmm i deleted and reinstalled dblpy and still keeps saying 0.1.6
Property 'webhook' does not exist on type 'DBLAPI'.
45 this.dbl.webhook.on('ready', hook => {
it simply doesnt work 😭 @arctic arch
yeah my whole structure is like that.
ah had to restart my bot if anyone was curious if i fixed it :)
yes 2.3.0
because that sounds like there is no webhooks on the version you are in at all
im looking at the typings : DBLWebhook class on line 26. ill
maybe thats typescript's way to say its undefined
make sure you have specified the port or server in the options
get_bot_upvotes() returns this <coroutine object Client.get_bot_upvotes at 0x09383300> ?
dependencies be empty
how does it still have snekfetch
yeah it didnt bring that issue any more.
line 28 i init the dblapi. line 55 is excuting the hooks
not like this?
@ruby yarrow if on_dbl_test works, on_dbl_vote does too
Everything dblpy Client has is async
so await it @ornate abyss

z
is there any way to force-update the cache of votes?
when I check if a user has voted or not, its delayed to give a positive response
@sudden flare if you want instant updates then you need to use webhooks
oh ok, thank you
Someone mind explaining how I would get votes in python?
Users can currently vote every 24 hours for each bot. The /votes endpoint for your bot (the one you use via getVotes) only indexes the last 1000 votes. Please implement the webhook instead if you plan to process over 1000 votes.
Makes no sense because https://discordbots.org/bot/526202417570643968/votes doesn't return votes...
/votes returns votes for the past 12 hrs
@restive otter you need /api/
https://discordbots.org/bot/526202417570643968/api/votes still doesn't work
ah
Did u read the docs 
that was in the docs/
Yes
well how was I suppose to connect https://discordbots.org/api/docs#reference with what I was doing.
¯_(ツ)_/¯
:spam:
@grand plaza no racial slurs dude
why doesn't it work : dbl.webhook.on('vote', async vote => {
Nothing happens when I press the Test button or the user votes
Well what's the rest of the code
dbl.webhook.on('vote', async vote => {
console.log('Voted')
});
const DBL = require('dblapi.js');
const dbl = new DBL(token, { webhookPort: 5000, webhookAuth: 'password' });
How to open it on hosting?
depends on firewall you use
I personally use ufw
but go google how to find out what fiirewall you use or if there is one
Hello
bruh
Is it normal that with
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
I've this error ?
no
Hi,
i have a json file with some data.
How can i embed specific fields to a reply message?
is webhook set up
I don't think... how do we do ?
@opaque pike you didnt put the webhook settings on the new dbl line
look at the example
those?
Ok thank you
How do I use webhooks?
Is there an alternative for msg.reply so that it won't mention the user who sent the specific command?
- #development
- msg.channel.send
How do I use webhooks?
Ohh thanks
@short flint https://discordbots.org/api/docs
but I did not understand how to do it
Oof
Probably just cache
i have to provide shard id :3
Sorry, just for options.webhookPort, where I can find it ? And for options.webhookAuth I don't undestand what string it talk about...
options param in dblapi.js client
which is a map (JSON, I don't remember what it is in js)
object?
You specify the port yourself and webhookAuth is the text you set in Authorization field on your bot's Edit page
but what url I put here ?
Hello, i posted my server count to the API which is 2925 and also with shard ids, and the website still showing only 1013.
The code i'm using is dbl.postStats(await client.fetchGuildSize(), client.shard.ids[0], client.shard.count);
The value of those 3 params are in screenshot. Also the return from dbl API is {}
Perhaps it's a bug :3 If it isn't please tell me where the mistake is.
How many guilds overall?
2925
What's your bot?
@restive otter
Huh
Did you mean the bot link?
Nah, that's fine
My cache was showing 5k guilds but yeah, I don't see what causes that
Does it show 5k on your browser?
Not quite sure ngl
For the URL what I am supposed to put ?
Can you forward regarding this bug(?) to the developer?
I'm not quite sure what shardId param is used for
It said it's the id of the shard and that's what i provide there in second param.
The shardid is so you only send the server count for the current shard
And it'll add them all up
And if you want to report a bug do it on the GitHub
https://discordbots.org/api/bots/BOTID/stats for your bot returns {"server_count":5850,"shards":[null,2925,2925],"shard_count":3}
You're fine since your question is related to dblapi.js
oh, i see now
thank you
It adds up 
i will try to change the code and see the results
1978 guild count after updating 
it's just a hater
ok
Got it working. Thank you 
What can I use for webhooks with java. I feel that it is not possible with the java library.
Of course it is: https://github.com/MinnDevelopment/discord-webhooks (https://github.com/DV8FromTheWorld/JDA/wiki/9)-Webhooks)
Examples: https://www.programcreek.com/java-api-examples/index.php?api=net.dv8tion.jda.core.entities.Webhook
Docs: https://ci.dv8tion.net/job/JDA/javadoc/index.html?net/dv8tion/jda/webhook/package-summary.html
Java wrapper for the popular chat & VOIP service: Discord https://discordapp.com - DV8FromTheWorld/JDA
This page provides Java code examples for net.dv8tion.jda.core.entities.Webhook. The examples are extracted from open source Java projects.
Wow ty 😃

I'd pay most attention to the first link, which is most likely what you'd use. Example 5 and 7 from the examples link might give you a better understanding as well
Okay ty 
@distant trellis @hexed glade those seem to be links for discord webhooks, which are not related to DBL webhooks
Oh right, we're in the api channel
I need to create a listener to the dbl webhook right?
I think that's all explained in here, right?: https://github.com/DiscordBotList/DBL-Java-Library
An API wrapper for https://discordbots.org/api/docs that works in Java - DiscordBotList/DBL-Java-Library
It has examples and all
If you want to use DBL webhooks in java you will probably need to run your own webserver using something like http://sparkjava.com
Spark Framework - Create web applications in Java rapidly. Spark is a micro web framework that lets you focus on writing your code, not boilerplate code.
And accept the post request from dbl
Is it normal that I have a very long delay?
With java: 1-3min
With nodejs: 1s
And with java, I get "null" body
That isn't normal
I'm updating server counter every 30 mins but my bot is shown as offline since the beginning of getting verified. what should I do?
If any discord.py dev's can help with getting things to happen when an event happens, please DM me.
Current Code
import dbl
import discord
from discord.ext import commands
import asyncio
import logging
class DiscordBotsOrgAPI(commands.Cog):
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'token' # set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
self.updating = self.bot.loop.create_task(self.update_stats())
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
while not self.bot.is_closed():
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))
await asyncio.sleep(1800)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))
Are you sure the webhook is actually accepting requests?
test button calls on_dbl_test
vote button calls on_dbl_vote
@sullen nymph how can I test if the webhook is accepting requests?
Really new to webhooks and stuff...sorry
Make sure your IP is right and your port is open and forwarded. Test button on your bot's Edit page
And, just in case, http://your_ip:your_port/your_webhook_path
Non-webhook? get_user_vote but includes ratelimits and delays
Question, this bit of code would work right?
import dbl
import discord
from discord.ext import commands
import asyncio
import logging
class DiscordBotsOrgAPI(commands.Cog):
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token)
#self.updating = self.bot.loop.create_task(self.update_stats())
@commands.Cog.listener()
async def on_dbl_vote(self, data):
logger.info('Received an upvote')
print(data)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))
For just receving votes, forget about posting server count.
Looks good, yep
Allright Thanks!
So the only downside to this method is that the upvotes will be delayed by around 1-5 minutes right?
Yeah and ratelimits if you implement it in a command
alright thanks
Code
import dbl
import discord
from discord.ext import commands
import asyncio
class DiscordBotsOrgAPI(commands.Cog):
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'token' # set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token)
#self.updating = self.bot.loop.create_task(self.update_stats())
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)
def setup(bot):
bot.add_cog(DiscordBotsOrgAPI(bot))
I've doubled checked that the token works but nothing is getting printed.
Did you vote
yea
@restive otter did u set the webhook settings in the bot edit page?
Why do we need a webhook for
import dbl
import discord
from discord.ext import commands
import asyncio
class DiscordBotsOrgAPI(commands.Cog):
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'token' # set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token)
#self.updating = self.bot.loop.create_task(self.update_stats())
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)
def setup(bot):
bot.add_cog(DiscordBotsOrgAPI(bot))
You're not using the webhook but adding an event for it
The example on github repo should help.
Specify at least webhook_port, the rest of webhook stuff will be set by default
So I use this code
import dbl
import discord
from discord.ext import commands
import asyncio
import logging
class DiscordBotsOrgAPI(commands.Cog):
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'token' # set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
self.updating = self.bot.loop.create_task(self.update_stats())
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
while not self.bot.is_closed():
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))
await asyncio.sleep(1800)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))
And then for the webhook on dbl I put mypublicip:5000/dblwehook?
http://ip:port/path
is any port forwarding require on the router side of things or no?
Yep
k
Replace 0.0.0.0 with your IPv4 address
But where I replace ?
When putting your webhook URL in on the website
But it's already done...
How do I get authorization to use webhooks?
It's you who must set the permission by editing your bot at the bottom
😝
😂
I'm updating server counter every 30 mins but my bot is shown as offline since the beginning of getting verified. what should I do?
Is its status "???"
That means it was kicked from here
Can you explain because it hasn't
Off the site
It's been up on the site since it's verification
you need to have it be reinvited @restive otter
As in register for verification again?
-bots 439632807770325012 noembed
Slime Shield Hero#0021's bots:
@clever hemlock
It's not here @restive otter.
Ask a mod to reinvite it, and check the reason it was kicked.
My bot's been getting ratelimited all day.
It goes
Attempting to post server count
Posted server count (39)
Task exception was never retrieved
future: <Task finished coro=<Client.__loop() done, defined at C:\anishapps\python3.7\lib\site-packages\discordlists\client.py:127> exception=Ratelimited("The request to the API endpoint was ratelimited.\nMore data may be available in the 'ratelimit' attribute.")>
Traceback (most recent call last):
File "C:\anishapps\python3.7\lib\site-packages\discordlists\client.py", line 133, in __loop
await self.post_count()
File "C:\anishapps\python3.7\lib\site-packages\discordlists\client.py", line 119, in post_count
return await self.base.post_guild_count(self.bot.user.id, self.guild_count)
File "C:\anishapps\python3.7\lib\site-packages\discordlists\baseclient.py", line 213, in post_guild_count
return await self.__post("count", self.__guild_count_body(bot_id, guild_count))
File "C:\anishapps\python3.7\lib\site-packages\discordlists\baseclient.py", line 120, in __post
return await self.__handle_response(resp)
File "C:\anishapps\python3.7\lib\site-packages\discordlists\baseclient.py", line 91, in __handle_response
raise Ratelimited(json)
discordlists.exceptions.Ratelimited: The request to the API endpoint was ratelimited.
More data may be available in the 'ratelimit' attribute.
But this has been going on all day...and DBL is showing I have 27 servers when I have 39.
Cache
@restive otter are you sure that's the official dblpy library?
@restive otter 403 means wrong token
401 is wrong token
@restive otter 429 is rate limit
why are you talking about response codes when there are none
just stay on topic
and help
ffs
Tonkku eat a chill pill.

idk why its so hard
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
ty
```send me
Sorry sir..
i said that
Since Google has over 100-200 third party api(s) to connect to their platforms
Aaaaand dm
I'm new to dbl api.
I want to learn how to make it instantly run an action after someone votes
use the webhooks
What webhook though?
read the docs
you set it up
How? I want to know how to
it's just a http server, set one up locally and set dbl to post to it on votes, then get the data and do stuff
Just make a webhook from a channel?
no not a discord webhook
read the docs fml
@obsidian tide https://discordbots.org/api/docs#jslib
dblapi.js can handle it for you
but it has nothing to do with discord webhooks
I installed the npm already
K thx @humble bison I'll try that
How do u create a webhook?
Your server -> server settings -> webhook -> create webhook
They do, you can set up a Discord webhook and link it to DBL
wot
How?
no you cant
How do u setup a webhook?
rtfd
(I'm dumb)
dont think I need any more
@obsidian tide look at the docs https://discordbots.org/api/docs#jslib
please
it has code
Hello, I’m having trouble with the api. I thought to get actual help from a member of staff because I have asked multiple times in the support channel and every time it didn’t work.
The problem is that the vote bit doesn’t seem to work, i took the code off the api website and everything but the vote bit works. Please help!
Here’s my code:
console.log('Server count has been sent to Discord Bot List!');
});
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 => {
let voteembed = new Discord.RichEmbed()
.setColor(0x0000FF)
.setThumbnail("https://cdn.discordapp.com/avatars/560942447488794628/57a6cc87eafda490610284c6982a8918.png?size=2048")
.setTitle(`New Vote`)
.setDescription(`${vote.user.username} has just voted! Thanks!`)
.setTimestamp()
votechannel.send(voteembed);
console.log(`User with ID ${vote.user} just voted for Cryptonox!`)
});
The webhook and the server count works
@flint lava did you set the webhook settings in your bot page?
have you tested it with postman?
k, try doing the post request in postman
?
make a POST to the url
and set the json body like DBL would send
{
"bot": "12345",
"user": "509456861196713985",
"type": "test",
"isWeekend": "true"
}```
and set the Authorization header to your webhookAuth
create a request
My workspaces
open a new tab
fill it out like i showed
hmm
Why I can't post my guild/shard count?
Forbidden: Forbidden (status code: 403)
Traceback (most recent call last):
File "/Users/nemetharon/Desktop/FightMan01_bot/1.2.3/bot.py", line 254, in update_stats
await self.dblpy.post_guild_count()
File "/usr/local/lib/python3.6/site-packages/dbl/client.py", line 130, in post_guild_count
await self.http.post_guild_count(self.bot_id, self.guild_count(), shard_count, shard_no)
File "/usr/local/lib/python3.6/site-packages/dbl/http.py", line 168, in post_guild_count
await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload)
File "/usr/local/lib/python3.6/site-packages/dbl/http.py", line 142, in request
raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403)```
@trim venture wrong token
I regenerated it, still not works.
dblpy version?
I can see two things that could be causing that:
- The dblpy version of yours that is detectdd by Python isn't 0.3.1
- The bot your code is running on isn't on DBL
- I believe I raise 401 when it's invalid token
Output dbl.__version__ to make sure it's up to date 
It must be sending the request before bot gets ready
got this
Huh
Wait!! Heroku posted it!
Great news at least 
Yeah, but my mac can't post it somehow 🤷
And one more question.
I have 1 shard.
I thought that the post_guild_count will post it.
How can I post the shard count?
post_guild_count(shard_amount: int, whatever_shard_you_post_from: int)
ok, thx 😁

I need a little help adding the API. Would I make a new folder in my main directory? Or add it to the init script or bot file?
Elaborate please
I don't know where the this goes. const Discord = require("discord.js"); const client = new Discord.Client(); const DBL = require("dblapi.js"); const dbl = new DBL('Your discordbots.org token', client); // Optional events dbl.on('posted', () => { console.log('Server count posted!'); }) dbl.on('error', e => { console.log(`Oops! ${e}`); })
You need to know how it works
Don't just paste it in
And why is that all one line
❌ 
stupid question but still learning.
setting up the api webhook for voting, is the URL suppose to point to where the bot is hosted?
Fuck that username is a throwback
@vagrant barn yes, if the webhook path is /dblwebhook (default for dblapi.js) then the url is normally http://IP:PORT/dblwebhook
awesome, thanks
@fathom eagle @papa#0001 dumb username
Is the bot discord id the bot's discord id?
yes, what else


my bot was denied for api time??? ``` await this.client.user.setStatus("online");
const statusArray = [
(client) => client.user.setActivity(`${this.client.guilds.size} servers | ?help`, { type: "WATCHING" }),
(client) => client.user.setActivity(`${this.client.channels.size} channels | ?help`, { type: "WATCHING" }),
(client) => client.user.setActivity(`${this.client.users.size} users | ?help`, { type: "WATCHING" })
];
var pick = 0;
setInterval(() => {
statusArray[pick](this.client);
pick += 1;
if (pick === 3) pick = 0;
}, 40000);```
@gusty gyro read the channel topic
read the channel topic lol
im aware
i got this info from staff here. sounds like they need to read the api for denying bots that arent abusing the limit????
how to solve this error http://prntscr.com/oincjp
Not paste a Discord webhook link
Create a webserver that will send a message through Discord webhook on request and make DBL send request to your webserver
How can I check if someone has voted for my bot in the last 12 hours? I’ve tried googling and such but I can’t really find much. I know checking who voted in the last 24 hours is documented, but what about 12?
use webhooks
I guess the only way this is possible is to use webhooks and store the time users voted yourself
Store User Vote and time in DB and check with the bot if its greater than or less than 12 hours
@craggy grove the docs are wrong, everything that says 24 hours is actually 12 hours
yw
and yeah theyre outdated cuz u used to be able to vote every 12 hrs
and ig nobody updated them
The docs need some serious updates
Hi
Hai
Need some help understanding how to setup using dbl
Using the python example what do I define as "bot"?
So just discord.client() no bot tokens?
I dont think the bot token by itself will work
"Client object has no attribute add cog"
this is for help with the discord api
discord.py help can be found in the discord.py support server
oh hi
No this is for this api
sorry i know a cool guy named anish in my school
@restive otter just trying to set up this api, the docs don't help much
For dblpy Client, there's no add_cog.
For discord.py commands.Bot, then we're talking.
I'm using the example in the docs
And the example uses commands.Bot
Setup(bot)
Bot.add_cog
Yes
I'm literally saying "That example discord.py commands.Bot, not discord.Client"
your bot variable is supposed to be an instance of commands.Bot that discord.py provides
OR
adapt the code to discord.py Client
So I run
setup(my bot instance)
If you use cogs
I don't have experience with cogs but that's how the example is
So I can just rewrite the example without cogs? With dbl.client(bot, token) ?
Yes, where bot would be your discord.py Client
Hmm let me try
Still stuck on this
Just trying to do anything with dbl.py client
How do I set it up using the python example? https://discordbots.org/api/docs#pylib
Guys, I don't know how to use that dbl webhooks
I'm hosting the bot on glitch, by the way
does the online status get pushed when the bot logs in or when the server count is pushed
When your bot logs on (with caching)
how would I be able to test another webhook, so that my current webhook isn't impacted? I can't seem to actually change it without saving it, which would affect my current bot
@bronze arch you could try sending a request to it yourself
does anyone have any resources to get started with the voting webhooks using JS besides the official API page? I tried to make a webserver and link the webhook to that but when i use Postman to test it I get a 400 error
Unfortunately thats only the example for JS, although there is an unofficial one that is as simple as download, configure and run @timber orbit
Alright, I’ll give that a look, thank you
Is there an example for python?
how do i send the bot token in the POST?
it returns unauthorized currently because i haven't given it the bot's auth
and so, how do i do that
you need to send it in an Authorization header iirc
uh what
my bigger problem is i have no idea how to send headers
and i can't copy the whole damn token
coro-http integrated in luvit(?)
look up the documentation of the library on how to send headers
huh plz help
Huhuhuh
wtf 
Are you reading
can you read the tiny thing after it?
You arent authorized to use whatever you are doingm
If its dblapi it's the wrong token
Idk how yall getting 401s but I'm fine
The token isn't wrong ._.
DBL says yes it is wrong
Re-copy, make sure you don't remove/add anything to the token
Hey. I have a question. How can I make my bot send message when someone votes for it?
Hey, so I'm trying to get the webhook thing working, but whenever I send a test, nothing happens
@lethal fox you need to configure the webhook
Anyways, as for my issue
Here's the code
Make sure port is open and forwarded
The port is good, since I host a website here
Also vote isn't equal to test
yes
i know that
if (vote.type == 'test')
return console.log('test successful')
let message;
try {
let fetchedUser = client.users.fetch(vote.user);
message = `${fetchedUser.tag} just upvoted!`;
} catch(e) {
message = `${vote.user} upvoted`
}
client.channels.get(config.logging).send(message);
console.log(`User with ID ${vote.user} just voted!`);
});
Notice where it checks the vote type
js?
yes
Oh cool dblapi.js sends both under the same event
Hm, I guess the error could be two things
- I redeclair the dbl thing
when I already declaired it before in client
- The ready event does indeed get fired
but it returns a weird URL, hold on
Webhook running at http://0.0.0.0:0/dblwebhook
https://yamamura-bot.tk/dblwebhook The link that it should be in gives a 404 instead of something else
@sullen nymph
https://gitlab.com/Samplasion/yamamura-discord-bot/blob/master/server.js#L78
https://gitlab.com/Samplasion/yamamura-discord-bot/blob/master/yamamura.js#L62
does it matter that I'm calling DBL twice?
If it is, I could probably merge the two files
Worth a try
I have a question. To update a server's number I need to use api right?
On the website yes
Do I need to do more with API than copying it to my code?
Get your bot approved
Sure, dblapi.js and dblpy provide a webhook, not too sure about other libs
I tried to send a message to the voted user but it doesn't work.
My code:
dbl.webhook.on("vote", vote => {
console.log('User with ID ' + vote.user + ' voted!');
const user = client.users.get(vote.user); // This will get the User Object from the Client#users Collection
if(user) { // This checks if the Bot knows who the User is.
user.send('Thank you for voting!'); // DM the User "Thank you for voting!"
} });
Is it all on one line or something?
No It is weird when I copy it down
Her
My code:
dbl.webhook.on("vote", vote => {
console.log('User with ID ' + vote.user + ' voted!');
const user = client.users.get(vote.user); // This will get the User Object from the Client#users Collection
if(user) { // This checks if the Bot knows who the User is.
user.send('Thank you for voting!'); // DM the User "Thank you for voting!"
} });
Can anyone help me with this?
I tried to send a message to the voted user but it doesn't work.
Yes, we saw your first message
Have you seen if the webhook works in the first place?
It works
But I didn't get the logs
then the webhook in itself doesn't work
How could I fix that
send us your entire code
I am getting my code up on computer
const DBL = require('dblapi.js');
const dbl = new DBL('api key', {webhookPort: 5001, webhookAuth: 'password', webhookPath: '/absolutezero'}, client);
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 + ' voted!');
const user = client.users.get(vote.user); // This will get the User Object from the Client#users Collection
if(vote){// This checks if the Bot knows who the User is.
user.send('Thank you for voting!'); // DM the User "Thank you for voting!"
} });
dbl.on('posted', () => {
console.log('Server count posted!');
});
dbl.on('error', e => {
console.log(`Oops! ${e}`);
});
here
is the ready event correct?
I think so
What does it say?
Webhook running at http://0.0.0.0:5001/absolutezero
that's good
so go to https://discordbots.org/bot/583835501744881664/edit (I assume that's the bot you're trying to set it up for)
scroll all the way down, put that in and replace 0.0.0.0 with your server's ip and make up an authorization key
Oh ok
@spiral steeple Do you think you can help me with my issue?
[DiscordBots.org] Webhook running at http://0.0.0.0:3000/dblwebhook
Yet, when I attempt to send the test webhook, it does not run
Here are my listeners
https://gitlab.com/Samplasion/yamamura-discord-bot/blob/master/events/dbl/hookready.js
@vestal relic have the correct ip?
Yeah, I think I found the error
1|Yamamura | GET /dblwebhook 404 7.123 ms - 5556
The webhook URL itself works
Did you set the authorization?
It's the same as your config.DBLPass
this.dbl = new DBL(config.DBLtoken, { webhookPort: this.express.get('port'), webhookAuth: config.DBLPass, webhookServer: this.server, statsInterval: 7200000 }, this);
yeah, it is
Yeah, the website itself works
if the port wasnt open the request probably wouldnt go through
Yes
Im not sure
Hm, maybe its because of the 404 thing I set up?
//The 404 Route (ALWAYS keep this as the last route)
app.get('*', function(req, res) {
res.status(404).render('pages/404')
});```
I dont use express
What do you use then?
I dont make websites
oh
try commenting it out?
I set up servers with node http(s) and fastify
oh
the dbl webhook is post requests
wait

I have big confusion
you wouldnt be able to do a GET on it anyways, would you?
It should return 405 automatically if you made it listen to GET requests
I have no idea what is going on anymore
Hm
1|Yamamura | GET /dblwebhook 404 2.119 ms - 149
The test webhook just sends a get request
not a post
I'm logging this using morgan
why are you getting get requests
¯_(ツ)_/¯
I've been getting them too for no apparent reason
anyway I don't think morgan would log the post request
Hm, can someone try sending a POST request to my website?
lets see if its the logger's fault or if its truely sending a GET request
Per rule 4, I can't link to the site
so DM me for a link I guess
You linked it earlier 
oh, I did?
oops
1|Yamamura | POST / 404 3.900 ms - 140
I did it using https://www.codepunker.com/tools/http-requests
I mean the post request to the webhook
oh
it wouldn't get to express since the library takes it
Your dblwebhook path returned 403 for me 👀
What will happen if I test my webhooks?
A test request will be sent to your webhook URL that you specify on your bot's Edit page
Hm, I don't get it either
ok
oh hey, it finally worked. I was just dumb all along
I thought test applied for what was currently in the fields, not what was in the DB
thank you so much for helping me Furuhashi, Tonkku and Tarpergon
[discord.js]
So, I am trying to make my bot PM the owner of the server upon joining, but how would I get the owner of the server
For webhooks, can I use a service like IFTTT or would I have to set up a web server and run it through that? Or is there something built into the dblapi that makes this easy? I’m a little inexperienced with webhooks so I do apologize
Do you have a bot already?
Yes
why not set it up there?
My bot is running on my raspberry pi, wouldn’t I need to set up a web server or something on it though?
I guess what I’m asking is I’m confused on what to use for a url
Would I use the bot’s site url discordbots.org/bot/ID or something
Or would I use express? I feel like there’s a better option than that though
Nvm, I realize now that I need a web server
Hi guys! Quick question, if I'm "enabling" webhook options, will I stay able to use the request method at the same time?
yes
perfect, thanks
hello, I am having trouble setting up the webhook for my bot
@tulip thistle what language?
:blobdance:
How can I display how many shards my bot is using on the discordbots.org website? (my bot is in discord.py)
You can use the official lib? https://discordbots.org/api/docs#pylib
@tulip thistle did you check out the demo? https://discordbots.org/api/docs#jslib
mm its ok I need to work on something else at the moment
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 did have a quick look, but thanks for that
i configured my bots so much im using ts instead of js. makes development quicker and easier
Alright so I have a simple web server setup, the ready message to console is all set, and I replaced 0.0.0.0 with the IP address but webhook still does not seem to be functioning. I’m not sure where the data is sent via pressing the test button so I have no idea if I’m even receiving data. Anyone got any ideas?
Do I need to set up a way for it to receive post requests?
Can someone direct me toward resources of accomplishing this
Does this check if the user ever voted in their lifetime, or if the user voted in the past 12 hours?
for the dblpy library
Alright, thanks!

Can't you re-vote each 12 hours though?
:P
can the dbl api stop erroring so much? its annoying in my error monitoring
I'm getting 5XX Errors so 
So?
Malformed request can lead to 500 too
As the server doesn't know how to process it
okay I'm getting 503's and you telling me its my fault?
Yes that's how I roll 
and I'm literally doing nothing besides posting stats with the official package written by Tonkku
Smh
503 Service Unavailable
Use it correctly
I get 500 and 503 sometimes so shush

and if the request is malformed then the status code should be 400 and not 500
Bad server setup leads to 500 quite often
I'm not accusing dbl of not checking request sanity but it happens 
what brings us back to
can the dbl api stop erroring so much?
kthx
Answer is no kthx
through api is how I get the people who voted for the bot?
Ok
why here anyways
How do I update my server count?
Are you already sending your server count to DBL?
Oh, what is this btw?
console.log(stats) // {"server_count":2,"shards":[]}
});```
Stats of a bot that you specify in the function params
The stats need to be posted by owner of that bot
Alright, thanks!
client.on('klasaReady', () => {
client.user.setPresence({ activity: { name: 'for giveaways', type: "WATCHING" }});
const dbl = new DBL('nou', client);
console.log('Posting server count')
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
})```
using klasa
not working
console.log('Posting server count') is working
posted and error both are not triggered
fixed
DiscordBotListAPI api = new DiscordBotListAPI.Builder()
.token("TOKEN")
.botId("ID")
.build();
api.setStats(jda.getGuilds().size());
It throws ClassNotFoundException, why?
Class imported: import org.discordbots.api.client.DiscordBotListAPI;
What is this channel for? I don't know what an API is
I do also want to learn how to make bots for discord so I'm going to try understanding ever
For help with the Discord Bot List API
e.g. posting your server count to the site and gaining bot/voter information
If you need help with general coding like making commands, I suggest you to start with choosing a coding language, and then looking for guides online in that specific coding language
and then when you have questions, you can ask them in #development
@tough grotto
Ok thanks @dense basalt

🦐:shrimp:
Random emotes in #memes-and-media but don't spam
On dblpy, I'm not sure why my on_dbl_vote is not working. There's no error being outputted. Since it's each 12 hours, I'm not sure how to test it either.
on_dbl_test exists
Try playing with port opening/forwarding
The port being the one you specify in dblpy's Client with webhook_port kwarg
Is there a default port?
Alrighty
Alright.
Wtf do I do because idk if I put the code or invite it’s like asking for both
Thank you
Your dblpy version changed
Might rename dblpy Client to something else since some errors make it hard for all of us to live
yeah
can someone show the script for sending server stats for a bot. sorry forgot
js?
no spoonfeed
i mean its on here lol https://discordbots.org/api/docs#jslib
Oh he mean that?
Why is this not done on the website? I always call the method on startup.
Try again
oh ok
can someone help me? xD
just post your question
@runic grove look up
oh
:(
does the website show any server count
i guess double check your tokens
I don't know why
I already did it but I can do it again
No, all is right @fickle junco
what does the POST json response the api expects look like? i tried encoding a lua table with json.encode, but i'm pretty sure it's formatted wrong
What is it?
@narrow geyser the guilds wasn't loadet
CODE: https://hasteb.in/edipumat.js
Problem: Nothing happens if I vote
Have you already set up webhooks on the dbl website?
@finite remnant You need to portforward
using the webhook stuff is like hosting a website
@sudden depot i dont understand
Nubs
what is this.?
Can someone help me?
Does anyone know why it could be that when I run the Vote Command and the bot on the V server is not working but when the bot is started on the IDE it works?
Fixed
does anyone have a python example to use the webhook vote api?
import dbl
import discord
from discord.ext import commands
import asyncio
import logging
class DiscordBotsOrgAPI(commands.Cog):
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
self.updating = self.bot.loop.create_task(self.update_stats())
@commands.Cog.listener()
async def on_dbl_vote(self, data):
logger.info('Received an upvote')
print(data)
def setup(bot):
bot.add_cog(DiscordBotsOrgAPI(bot))
A simple API wrapper for discordbots.org written in Python - DiscordBotList/DBL-Python-Library
Does the DBL api automatically get values from all shards? (discord.js)
If you pass your client to it and have all shards on that client
@shut crest
@arctic arch not sure if it was just bad luck or some api problems today, but a lot of people complained today that they've voted and they have not received their reward.
I've checked them manually via their id, and they show as voted: 0
sorry
Hey, I'm using the .NET lib to update all my stats, but I'm a bit confused on how to update my shard count. It takes in an int array but I manually hardcode the shard count, what would the int array be for?
guild counts for each shard
ah okay
If I pass that in, do I still need to manually update the guild count, or does that take care of both
The python server count example is a tiny bit out-dated
there has been a new way to do background tasks added
A simple API wrapper for discordbots.org written in Python - DiscordBotList/DBL-Python-Library
thanks

Done
async def clear(ctx, amount=100)
```is api abuse more than 100?
max is 100
does anyone know how to check if ctx channel is nsfw
im using python
but its not rewrite
- #development
- @worn quail if you don't mind
Might wanna edit the lib code at this point tho

lazy is offline btw
Time is money :^)
ehe
What did you do?
@knotty snow I accessed the api directly.
I want my method to be well known, so im going to post it on github or sth
since a lot of people still use async
(Without sending another request, might just edit the lib and add is_nsfw property to an instance of Channel)
@worn quail I just decided to bite the bullet and upgrade to rewrite
needed to do it at some point lol
will be working on it throughout the day
says a whitename
@sullen nymph changing from async to rewrite was actually really easy lol
Yeet. Just a reminder that this is #topgg-api 
yeah np
is dbl (server add function) down?
Rewrite is above async
Everyone can agree
Async support was dropped in most servers anyway
Preach
Well, you learn something new everyday
im so confused with the discord.js api
do i need to change the webhookPort and webhookAuth
i think im getting there
no
It's emitting it for me
is your code in the index?
yea
hmm, let me try that then, i have mine in a seperate handler
const dbl = new DBL(token, { webhookPort: 5000, webhookAuth: "chaosiscool" }, bot);
just simply did dat
dbl.webhook.on("ready", hook => {
console.log(Webhook running at http://${hook.hostname}:${hook.port}${hook.path});
});
this normally emits
don't publicly post your damn webhook auth
its not my real auth
?
@deep bay did ya try it?
yeah, putting it in the index emits the ready event
Im keeping it the same
same
well the ready event works so
yeah
it can't be my code itself since
console.log("ff");
I got this at the top
And it's not logging
yeah i got a console log in there too but doesnt do anything
im gonna try using the error event for it
BUT
In the docs it says it gives post requests right
Which means
actually nothing lmao
mhm, imma try this
dbl.on('error', e => {
console.log(`An error has occured: ${e}`);
})```
damn
should we ping some mods?
ima ping vinnie, he is cool he won#t be mad
just ping ken
who's ken
pensive
Kyoyu#7777
@azure pollen who's ken
Ken, might helping me and Iska?
what's the problem
the api is not emitting the vote event
^
are you writing a webhook thing yourself?
But the ready event is emitting fine
^^
tries to use brain
if you don't want help i can leave :^)
task manager crashed while trying to close brain.exe
nono
shitposting stays in #memes-and-media then :^)
F
i would like your help, im just trying to understand what you mean
Oki
sorry if im coming off as a troll
are you using webhooks or are you making api requests
Wait so, the ready event is normally emitting which means that it should work right?
api requests
show code
i guess


@plain timber

