#topgg-api
1 messages Ā· Page 48 of 1
yeah
So i am using the github example for connecting to the api. But my servercount hasnt updated since i first set it up..
And yes it is definitely being loaded with the bot
have you updated it and made sure the client is defined correctly in dbl?
No you were using http
at first i was using dblapi
the with alek we tried the http
const dbl = new DBL("token", { webhookPort: 5000, webhookAuth: "auth" });
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 what i have now
but i get nothing
What URL did you set in dbl
If you use postman does it work
Your vps might not be receiving the request for some reason
Could not get any response
can i do anything from ssh?
@plain timber any ideas as to how to change that? š
All ports are BLOCKED except 22 (SSH), 80 (HTTP), and 443 (HTTPS).
ok so i had to use port 80
dun dun dunnnnnnnnnnnn
4 hours for this
š¦
thanks for the help guys
who have i use bot command and saying message code ?
When I use the .postStats method, I get this errorprolog UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
When I use bot.server_count it will sometimes return 1 even though the bot is in more than 1 server, is there any way to fix that?
anyone elses webhooks not POSTing anymore?
pretty sure the webhooks are doing GET instead of POST
for the votes
Guys what is a shard
i have a message sent to users when they vote and that is not going through, is something broken rn? is happening for a couple of bots i use
its the dbl api, deal with it
was just wanting to know if it was not a user/developer issue š
is the test button working?
š ±roken
@signal hawk I'm having the same issue, I think it's broken
looks like theyve fixed it now
I was wondering, is it possible to retrieve your guild count as a number from the API instead of a widget?
Why not just client.guilds.size?
Well, I believe the docs have a GET for bot info
Iāve been searching all morning and can not find an answer: Can you begin using API features with a server after itās established and it has users?
@humble bison ty!
š
- wrong channel
- discord is having issues
api error ^^
API error
Server count: 2521 but hasn't updated for the website?
Did you update it?
i use the cog
also some issues with discord rn
this has been for a while, it still says 2,145
i mean like a few weeks, ik about that
Oh
i just now had time to say something about it
Idk about that then
@scarlet copper wdym the cog?
the api cogs
What do you mean
One of the API libraries on https://discordbots.org/api/docs?
Or something else
@scarlet copper rewrite or async?
@haughty tundra rewrite
Then if you're not using webhooks the exact code from the api should work.
is there any way to get the status of a bot like the widget shows but in json or plaintext?
https://discordbots.org/api/docs#bots check that I dont think so tho
I didn't see anything there so I guess not
You don't need DBL for that, if it's your bot you can just make an API endpoint for it, if it's someone else's bot use your bot to get it
meowsipglare
We are aware of the issue
Traceback (most recent call last):
File "/storage/emulated/0/Termux/cgbot/cogs/dbl.py", line 23, in update_stats
await self.dblpy.post_server_count()
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/dbl/client.py", line 100, in post_server_count
await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no)
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/dbl/http.py", line 189, in post_server_count
await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload)
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/dbl/http.py", line 160, in request
raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}```
I gave it the token tho
how are you doing that
all my bot stuff is working including webhooks
@soft geode the link is literally in the channel topic...
and this channel is for the api
how do I create dbl vote rewards?
The api is kind of confusing... Where it says URL on the edit page... Where am I getting the url to put there?
@hidden marten if you're using webhooks you will need to receive the post request with your webserver. If you use js then the dblapi.js lib can handle it for you https://discordbots.org/api/docs#webhooks https://discordbots.org/api/docs#jslib
@restive otter you can either use webhooks and store a list of voters in the db, or you can use the check endpoint
I console logged the hook
Are you using js?
Change 0.0.0.0 to the server's IP address or domain
Hi, is it planned to have any timestamp of the last vote of the user ? because its not very handy to only have the voted result
I don't think it's planned, you current bet is to use the webhook
Just log a new Date() (js anyways) when they vote into a database
you can make a lot of this stuff on your own
I did, but when the user vote it makes a certain time before voted goes to 1
so if the user have something else to do, and come back in one hour or so
the timestamp will be different than his next allowed vote timestamp
you now I mean
Use webhooks. When you get the request store the vote and current timestamp so you can refer to it later.
is it better with php or with express
Personal preference really
uh
where do you put the token again? i'm using the dbl java thing but it's not posting
so i need to manually post the updated stats
Authorization header
ah thanks
Can someone help me? I made a bot, but I do not know how to get to the coding part, I know how to code, but I dont have the link or how to get there.
pick a language, look up the library for that language. Also this is a conversation for #development
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
for webhooks
should the hostname say 0.0.0.0 or my server IP?
your server ip
its logging 0.0.0.0, any idea why that is?
it is used as a placeholder
but you said it should be logging my server IP there, but its not, - do you have any idea why that is?
just replace 0.0.0.0 with your ip
it's probably logging 0.0.0.0 because that's the address the server is binding to
which is a special address that means "bind to all network interfaces"
In the context of servers, 0.0.0.0 can mean "all IPv4 addresses on the local machine". If a host has two IP addresses, 192.168.1.1 and 10.1.2.1, and a server running on the host is configured to listen on 0.0.0.0, it will be reachable at both of those IP addresses.
https://en.wikipedia.org/wiki/0.0.0.0
so if your server has 5 ips, all 5 of those would work to access that http server
the module just says 0.0.0.0 at this time, you should replace that with your own IP
alright i was confused because you said it should be showing my server IP, its properly set on the website though to my actual IP
ahhh
the issue was the port 800 was closed on my server
Anything lower than port 1025 requires elevated permission on unix
const dbl = new DBL('TOKEN', { 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('This dude Voted' + vote);
// Do what you need to do
});```
where would i find my webhookAuth password
Might wanna regen that
oh crap
i changed it xD
#265156361791209475 gets edits, regen it anyways
On your edit page of the bot
Scroll down
Should say url and authorization or something
https://discordbots.org/bot/<id>/edit
ty
@spiral steeple I did that and it didnāt work
Do you have your webhook setup correctly?
chill
chill. You don't need to mention him so many times 
does it log Webhook running at...
First, dont mention people for no reason, like Moose
Second, is this part filled out on your dbl page
Oh crap sorry didnāt mean to mention moose meant to mention Jonny 6
I have filled out Authorizatkon but not URL
What do I put in URL
How do you host your bot?
idk how to do it if you use glitch/heroku
Also I really need to sleep I got school in 4 hours, maybe someone else can help you 
I use mine locally
@spiral steeple
Btw I only pinged u cos it said u were online
Hey could someone help me; I donāt know what I put in the URL spot in the webhook setup
Any help?
use your localhost URL or something
What do you mean @limpid shard
const dbl = new DBL('Token.Token', { webhookPort: 5000, webhookAuth: 'MyPassword' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
console.log('This dude Voted' + vote);
// Do what you need to do
});```
whats wrong with this code?
am i meant to change webhookPort
i have made my webhook though
is hook defined somewhere? and is your link on DBL pointing to your bots public IP and port?
@hollow wraith its defined in the library i think and how do i make my link on DBL pointing to your bots public IP and port
in your bot edit screen there is a link for your webhook on DBL.
which would need to be http://botpublicip:5000
@soft geode
what?
when you log in on discordbots.org
you navigate to your bots page, and click Edit
there will be a place to insert a link in the Webhook portion
ok..
if your bot is hosted somewhere it will have a public IP address, and that is where DBL will send the webhook when someone upvotes
places like glitch and heroku have links for your bot and specifically allowed ports, which you would need to figure out. and use that instead of ip address and port 5000
Can someone please send me a chunk of code that makes it so if someone upvotes my bot, It sends a message to a certain channel saying their username r
you would have to tag their name.. I think bot.users is a list of every user in every guild. you may be able to search that list and get the correct user
? you want a user to get a discord invite link to their own server, when they upvote?
or a special server for everyone who upvotes your bot
Yes
No a special server
So simply when someone upvotes they get a DM with a server invite 1 use 1 day
do a collection search on bot.users with the userID of the upvoter and send them a message
bot = the name variable used to define your discordjs stuff
What do you mean
Talk in Dm
Could someone show me a way to find the user ID of whoever voted, then send them a DM
]]snipe
<@&265158261945270273> - a few seconds ago
@soft geode why would you do that
I didnāt mean to ping you
we still get the ping regardless
Could someone show me a way to find the user ID of whoever voted, then send them a DM
Useless and docs shouldnt be used in the same sentence unless they are actually useless, it tells you how to get a user id from a vote
And your libs docs mostlikely say how to send to a user
@spiral steeple , Iām trying to make my bot login, and it sends the right thing, but idk what to put into webhookAuth
webhookAuth is what you choose on the website
??

Ohhh like the Authentication
yes
The port on which your webserver is listening
So how do I find what port that is?
you.. decide on one
But wouldnāt it have to refer to something
do you even know what a webhook is

***I thought it was āyou donāt even know what a Webhook isā
@runic grove could I just leave it on 5000
depends on which port you want it to run, if there's already something running in port 5000, if that port is exposed to inbound connections
^
If itās my first Webhook would that matter what port itās in?
you need to configure it to use a free port
Iām sorry, how would I do that?
tbh
would discord channel webhooks work for checking for webhooks?
like would everything work fine
You mean like enter a discord channel webhook into the webhook thing on the bot page?
ye
No
š
(using discord.js) So Keep getting a error for some reason.
Code: const dbl = new DBL('token', {webhookServer: `link`}, bot);
Error:``` if (server && !(server instanceof Server)) throw Error('The server is not an instance of http.Server');
^
Error: The server is not an instance of http.Server
at new DBLWebhook (/rbd/pnpm-volume/69de6562-01dc-4cbe-badf-09c16eda1645/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/webhook.js:23:54)
at new DBLAPI (/rbd/pnpm-volume/69de6562-01dc-4cbe-badf-09c16eda1645/node_modules/.registry.npmjs.org/dblapi.js/2.3.0/node_modules/dblapi.js/src/index.js:69:22)
at Object.<anonymous> (/app/events/ready.js:8:13)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)```
webhookServer is not supposed to be a string
could I use http.get('link') @sudden rampart ?
have you read the docs?
webhookServers type is http.Server
nvm
high iq
Hi my bot seems to crash every 30 mins from posting the server count, hereās the code: https://github.com/AmigoDevTeam/Amigo/blob/master/events/ready.js
I need to know the error to help
I canāt really get that but Iāll try
Yeah we can't help much without the error
Iāll get it on a bit, itās quite hard as Iām running it on a Linux vps so the logs are annoying to get lul
not really lol
Its just in the console the same way it would be if you hosted it any other way
Most other ways*
Yeah prob
Yeah @snow fiber https://github.com/DiscordBotList/go-dbl/blob/54ccce0e486b189c98d8f569c4a1c39c229c9b9e/webhook.go#L19-L23
Aight
no I use pm2 so it resets each time I load the vps
@shut ibex here's the err https://preach.yiff.church/i/vbqk.png
Are you setting the token
it's where I store the config stuff
Failed to post server count
Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Traceback (most recent call last):
File "/home/pi/Desktop/Bot/cogs/DBL.py", line 25, in update_stats
await self.dblpy.post_server_count()
File "/home/pi/.local/lib/python3.5/site-packages/dbl/client.py", line 100, in post_server_count
await self.http.post_server_count(self.bot_id, self.guild_count(), shard_count, shard_no)
File "/home/pi/.local/lib/python3.5/site-packages/dbl/http.py", line 189, in post_server_count
await self.request('POST', '{}/bots/{}/stats'.format(self.BASE, bot_id), json=payload)
File "/home/pi/.local/lib/python3.5/site-packages/dbl/http.py", line 160, in request
raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
Getting this error when using the example
I forgot if thats token incorrect or auth incorrect
wait what
I think that means either the token or auth is wrong, I may be wrong
hmm
wait, does posting servercount have auth?
I think its the token
idk Im too tired lmao
what the hell
I regenned it
Still doesnt like it
403
Status code error 403
What the hell
I put the token innn
just take itttt
The token is in the header under "Authorization" right?
uhm
Yeah I just realized ugh
when copying
Okay
Also why code on phone lmao
cause it's so late oof
then ask again in the morning
it's literally the example m8 @sand hazel
yea, its just because it doesnt fully copy on mobile
import dbl
import discord
from discord.ext import commands
import aiohttp
import asyncio
import logging
class DiscordBotsOrgAPI:
"""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, loop=bot.loop)
self.updating = bot.loop.create_task(self.update_stats())
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
await self.bot.is_ready()
while not bot.is_closed():
logger.info('Attempting to post server count')
try:
await self.dblpy.post_server_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)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))
use that
use that
wow, i wonder why
what
Request desktop site then. If it dont work then try in the morning
my api key
just use the example I gave, and replace the fields
Then I'd suggest waiting until you can get on your pc
i pasted the patched example
Wait did you?
yeah I didn't see it
import dbl
import discord
from discord.ext import commands
import aiohttp
import asyncio
import logging
class DiscordBotsOrgAPI:
"""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, loop=bot.loop)
self.updating = bot.loop.create_task(self.update_stats())
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
await self.bot.is_ready()
while not bot.is_closed():
logger.info('Attempting to post server count')
try:
await self.dblpy.post_server_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)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))
discord is fucking with me
except Exception as e that srs what python does?
yeah
What's different from the example fishy
Yeah
???
But if you supply a wrong path, it will cause auth to invalid id error
Don't I only need token?
if you use the api, I believe
yeah API key
I am having an issue. When I attempt to post server count from the example from https://discordbots.org/api/docs#pylib I get a 403: Forbidden error. The token is correct. I used the token from http...
so just wait until ready and check if bot is closed
yeah
%Run Bot.py
Task exception was never retrieved
future: <Task finished coro=<DiscordBotsOrgAPI.update_stats() done, defined at /home/pi/Desktop/Bot/cogs/DBL.py:19> exception=TypeError("object bool can't be used in 'await' expression",)>
Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/home/pi/Desktop/Bot/cogs/DBL.py", line 23, in update_stats
await self.bot.is_ready()
TypeError: object bool can't be used in 'await' expression
Bot Online
import dbl
import discord
from discord.ext import commands
import aiohttp
import asyncio
import logging
class DiscordBotsOrgAPI:
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'dont steal' # set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token)
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 True:
await self.bot.is_ready()
while not self.bot.is_closed():
logger.info('attempting to post server count')
try:
await self.dblpy.post_server_count()
logger.info('posted server count ({})'.format(len(self.bot.guilds)))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
await asyncio.sleep(1800)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))```
@restive otter my dude you leaked your token
kek
I regenerate it
anywho, which py version u on

ok
wait what
are you using the rewrite lib
I did what
now
oh ok
the bot token or api token
bot token @plain timber 
lmaoo
bot wasn't leaked tho
kax
oh rly kk
Show me
yea now that i see it it looks like a dbl token
u reset the bot token too?
well its still a good idea to occasionally reset ur bot token
@luca eval token
so if an old one gets leaked it wont be valid anymore
Which is why you use a config file so you dont have to manually change it in all those places
what
Task exception was never retrieved
future: <Task finished coro=<DiscordBotsOrgAPI.update_stats() done, defined at /home/pi/Desktop/Bot/cogs/DBL.py:19> exception=TypeError("object bool can't be used in 'await' expression",)>
Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/home/pi/Desktop/Bot/cogs/DBL.py", line 23, in update_stats
await self.bot.is_ready()
TypeError: object bool can't be used in 'await' expression
As it says at the bottom.
Your object returns a boolean (True, False).
And it wants to like idk express the boolean using await.
hi, I'm having some issues with the dblapi.js library..
I'm trying to connect to a webhook but it's telling me that client.on isn't a function even though I'm not setting a client in the my setup
so I removed the { webhookPort: 5000, blah blah blah } and commented out all the dbl.webhook.on requests and the code works perfectly now but not how I intend to use the API
Did the API somehow change?
For some reason is the server count of my bot stuck on 675 guilds, while my bot actually is in 753 guilds.
I use the Java library of DBL to post the count
Oh wait....
It was a stupid typo -_-
The most beloved error you can have and make
Do I post stats on the sharding file?
const Discord = require('discord.js');
const Manager = new Discord.ShardingManager('./bot.js');
Manager.spawn(1)
//Here?
Sorry for the ping Daddy
xD
xD
no you don't
So I put it in bot.js?
once all your shards are loaded post in the ready event
As where the bot file is
and use broadcastEval to get your proper count
const postCount = async () => {
try {
let guildCount = null;
await client.shard.broadcastEval('this.guilds.size')
.then(async results => {
guildCount = results.reduce((prev, val) => prev + val, 0);
await post(`https://discordbots.org/api/bots/:id/stats`)
.set('Authorization', `stuff`).send({ server_count: guildCount, shards: results, shard_id: client.shard.id, shard_count: client.shard.count });
});
} catch(err) {
// stuff
}
};
postCount();
setInterval(() => postCount(), 60 * 1000 * 10);
thats what i do
in my main file anyways
wdym what api
For posting
oh
that's using snekfetch because i haven't migrated it yet
const { post } = require('snekfetch'); // npm i snekfetch```
what's happening
const DBL = require("dblapi.js");
// send the stats every hour to DBL
const dbl = new DBL("mytokenishere", { statsInterval : 3600000 }, bot);
dbl.on('error', e => {
console.log(`DBL Error! ${e}`);
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
})
});```
@restive otter what lib are you using?
Is bot your discord.js client?
Hmm that's the latest version
Any idea why this is wrong?
Where did u define bot
at the top
Send the line
const bot = new Discord.Client({disableEveryone: true})```
Here
@arctic arch
const DBL = require("dblapi.js");
// send the stats every hour to DBL
const dbl = new DBL("mytokenishere", { statsInterval : 3600000 }, bot);
dbl.on('error', e => {
console.log(`DBL Error! ${e}`);
});
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
});
is that the discord.js module or from something else
This is a d.js
it shouldnt do that if the client object is from a module named discord.js
Why is it doing it tho
An official module for interacting with the discordbots.org API - DiscordBotList/dblapi.js
@arctic arch I mean, I am using d.js
can you log the output of require.cache[require.resolve('discord.js')]
do you require dbl before d.js
no
Hi!
I would love to know how I hide the servers my bot is and the shards. I saw this in one more docs I just forgot to save .. Anyway if any admin could help me I would be grateful!
This might not work, but send a post req with null values
odd question but can you like, implement vote rewards before your bot is approved
so it's ready on approval
Yeah
error on what
I mean if the bot is not approved, there won't be an endpoint for them to send the payload to regardless
I don't see it from the new bots page
i can't help, but i would like to know what happened
Set webhook on the bot page?
yes and if someone votes and I get a message
Can you elaborate on "not unable to set a webhook"
I clearly don't understand webhooks
@topaz glacier dbl will send a post request to the url u enter
The post body will have the vote information
And what url should I enter? š¤
Well a url that your webserver will receive post requests on
What language do u use?
.js
Oh thanks I understood
I can't login to the web
When I click it, it should show a button on the bottom
But now it doesn't
Help please I want to get my daily rewards
I can't slide to the bottom
you can scroll to the bottom but it's a bit difficult
const DBL = require("dblapi.js");
// send the stats every hour to DBL
const dbl = new DBL("mytokenishere", { statsInterval : 3600000 }, bot);
dbl.on('error', e => {
console.log(`DBL Error! ${e}`);
});
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
});
Anyone help?
Well, idk https://httpstatuses.com/503
HTTP Status Code 503: The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay.
Could be a 503 error or something
Well
But I didn't see lol
A simple search for 503 will give you multiple cases of them talking to users :+1:
503 Backend fetch failed gettings these a lot

On the site, you click on API or something along those lines and it's the top button on the left side I believe
There, you should be able to generate a DBL token @quartz heron
Yup
Could some one explains why do i get this message when i'm trying to send the certifiacation form ? http://prntscr.com/m91yfi
wrong channel
just resubmit the form
General or development perhaps
How can I get upvotes for the last 24 hours? I tried with await self.dblpy.get_upvote_info(onlyids = True, days = 1), but it seems to ignore the parameters and gives me the upvotes for all 31 days.
the parameters dont exist anymore
Oh, then, what's the way to go?
you can get if a single user has voted in the past 12 hours, or use webhooks
Via DBL-Python-Library? Or is there any minimal viable example for this, in Python?
I dont think the python library is up to date
A lot of the API is outdated 
Why i prefer making my own dbl handler
// send the stats every hour to DBL
const dbl = new DBL("mytokenhere", { statsInterval : 3600000 }, bot);
dbl.on('error', e => {
console.log(`DBL Error! ${e}`);
})
// Optional events
dbl.on('posted', () => {
console.log('Server count posted!');
});```
Wait what the provided client is not supported 
already ran it
I can't read, what lib you using
IDK how to help then sorry
yup..
Well Im guessing whatever it the "client" was wasn't supported in the version you used 
yeah
thanks guys
The dblpy doesn't seem to be updating my server count
-botinfo @burnt heart
See
Its supposed to update every 30 mins
the site itself is pretty broken rn
-botinfo @restive otter
I used this const DBL = require('dblapi.js'); const dbl = new DBL('token', { 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!`); });
It doesn't log the votes
and it creates a webhook with link like this 0.0.0.00/webhook
and yeah I provided the correct token, server count code is working properly
@plain timber false
@topaz glacier you haven't put in the webhook details on the edit page
@spiral steeple @restive otter what error are you getting?
Never had any issues with any webhooks what so ever.
I followed the example on the website, same as Otaku. I get an error telling me the token is not defined.
is that a warning
No.
Just tells me it's not defined.
The index is looking like a mess anyways now, will have to clean it up with a config, perhaps that might help.
@arctic arch should I put he weebhook creted on the log?
yes but you need to replace the 0.0.0.0 with your public ip
your IP is project-name.glitch.me and you must use port 3000
aren't glitch default to 3000? @arctic arch
ye
then just giving the link should work? right?
I tried doing that once but it didn't worj
-botinfo @signal flower
Not even get a error
Im not getting an error?
Yeah I was having API key issues but we sorted that out
now it's not printing a error
Or a success message
@bot.event
async def on_ready():
params = {'shard_count': str(shardscount)}
headers = {'Authorization': "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjUyMjQ5MDA1ODU5OTY5NDM1NyIsImJvdCI6dHJ1ZSwiaWF0IjoxNTQ3NzcyOTY1fQ.ZyHePD5BpXob1E9wymvnRtasv_IlTNRzHpR5QSkt4oU"}
async with aiohttp.ClientSession() as cs:
async with cs.post('https://discordbots.org/bots/522490058599694357/stats', params=params, headers=headers) as postshard:
return
return
print("Bot Successfully loaded")
this doesnt seem to be posting the shard count
yes i regenerated
Is that the actual auth token
Can you show the code
@bot.event
async def on_ready():
params = {'shard_count': str(shardscount)}
headers = {'Authorization': "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjUyMjQ5MDA1ODU5OTY5NDM1NyIsImJvdCI6dHJ1ZSwiaWF0IjoxNTQ3NzcyOTY1fQ.ZyHePD5BpXob1E9wymvnRtasv_IlTNRzHpR5QSkt4oU"}
async with aiohttp.ClientSession() as cs:
async with cs.post('https://discordbots.org/bots/522490058599694357/stats', params=params, headers=headers) as postshard:
return
return
print("Bot Successfully loaded")```
i already posted it
thats the code
wait
-botinfo @burnt heart
WHAT THE HELL
yes
find('a', 'b') is deprecated
use a function
or delete your question
that works too
@restive otter you're only trying to send a shard count, that's invalid
you need a server count
Im sending that now but
Ohh
Wait a second
you should make it so I can sent shard count separately
cause I kinda only want to shard when the bot wakes up
shard count is optional
it still isn't doing server count
show your updated code
async def backroundupdatestats():
await bot.wait_until_ready()
while True:
data = {'server_count': len(bot.guilds)}
headers = {'Content-Type': 'application/json', 'Authorization': "don't touch this token m8"}
async with aiohttp.ClientSession() as cs:
async with cs.post('https://discordbots.org/bots/522490058599694357/stats', data=data, headers=headers) as postshard:
return
return
asyncio.sleep(1800)```
atTonkku#0107
It runs every 30 mins, lemme get it to run again
LMAO, I think it crashed
Hmm, restarting it now
-botinfo @burnt heart
@arctic arch
aka data in your code
your syntax might be wrong
it's worth asking someone who knows python
Use json.dumps(data)
Dump string
Json.dump is for working with files
But I'm pretty sure you can also set json instead of data
So just json=data
are you coding on phone
what the fucking hell

@snow fiber I changed dump to dumps and it didn't do it anyways
Hmm should work tho
-botinfo @burnt heart
See
@arctic arch sorry I was off what did u give? a glitch project?
Okay @snow fiber can you help me with this please
Lemme get it
async def backroundupdatestats():
await bot.wait_until_ready()
data = {'server_count': len(bot.guilds)}
headers = {'Content-Type': 'application/json', 'Authorization': "ok"}
async with aiohttp.ClientSession() as cs:
async with cs.post('https://discordbots.org/bots/522490058599694357/stats', data=json.dumps(data), headers=headers) as servercount: return
return
asyncio.sleep(1800)```
WAIT
that return shouldn't be there
I removed it
-botinfo @burnt heart
522490058599694357
GameBot
2148
Game Themed Bot | Has Fortnite Commands, Splatoon Commands, Roblox coming soon | Click on me to learn more
g!
62
43
No server count
@plain smelt
Okay
I removed the return on same line as servercount:
And still doesn't work
:/
Where?
just replace ClientSession() with it
Ah, okay
Right next to bot.run
And if you put a print('test') statement in the code?
Let me try
Also, before or after run?
Aight
522490058599694357
GameBot
2148
Game Themed Bot | Has Fortnite Commands, Splatoon Commands, Roblox coming soon | Click on me to learn more
g!
62
43
No server count
@plain smelt
ugh 
Can you do under as cs: print(await cs.text())
So print(await cs.text()) instead of return
Also keep in mind if that return is there it won't loop
>>> %Run Bot.py
test
ready
Task exception was never retrieved
future: <Task finished coro=<backroundupdatestats() done, defined at /home/pi/Desktop/Bot/Bot.py:28> exception=AttributeError("'ClientSession' object has no attribute 'text'",)>
Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/home/pi/Desktop/Bot/Bot.py", line 35, in backroundupdatestats
print(await cs.text())
AttributeError: 'ClientSession' object has no attribute 'text'```
sleepy auxim
Server count?
so needs to be x.text()
lemme see
522490058599694357
GameBot
2148
Game Themed Bot | Has Fortnite Commands, Splatoon Commands, Roblox coming soon | Click on me to learn more
g!
62
43
No server count
@plain smelt
Doesn't this mean you can fake it
Yeah
-botinfo @burnt heart
there's also a rule that you will get banned if you do
YES
Yes, and your bot will be removed if you do
soooo
Also, just a note
yes a note
cs = aiohttp.ClientSession(loop=bot.loop) somewhere before the function
okay
You can just include shard_count in the json
what's the point of updating every 30 minutes tho lol
^^
Because it isn't neccesary to be accurate up to the second
yes
But you can do 5 or 10 minutes and it's fine also
I mean I think you can
yes 60/m rate limit
The ratelimit is 60 per minute
Whytho
But you wouldn't have any other queries left
that's like the only endpoint I ever request to
Same
spam and get ban
what?
you dont need to update stats so often
Can I do every 10 minutes tonkku?
i cannot invite the bot to my server how to invite
it's not spam if it's under the rate limit 
for dblapi.js, the shotest allowed is 15 minutes
oof
I update stats everytime my bot gets invited to or kicked from a server
isnt that smart?
@restive otter ask in general
yes
if I see you in logs requesting every second tho I'm gonna manually ban you
Wait so

10 minute = allowed?
yes
@wet sequoia updating on guild join/leave is dangerous
there were cases of discord spamming guild joins/leaves during outages in the past
okay I'll change that, thanks for telling
How to make votelocking use webhooks?
on vote store the users ID in your db
in x hours remove it
and on cmd just check your db
hey, is the DBL api an event?
I'm trying to get the API thing to work, so I can have the site show how many server I am in and such
Discord.py rewrite btw
A simple API wrapper for discordbots.org written in Python - DiscordBotList/DBL-Python-Library
@plain timber how would I make something where if a user voted, it would dm them they're vote was registered and that they can use vote-locked commands
@restive otter use webhooks
well
for the dm u need webhooks
for the votelocking u can just use the api
no db needed
yeah that's what ive been doing
but it's slow
and takes like 5 minutes
for the user to actually run a votelocked command
well the only other solution is to use a db
and then in 12h remove it ig
Hello guys !
I'm trying to get a list of users who voted for my bot. But each time i try to get it, it returns this error :
Ignoring exception in command_error
Traceback (most recent call last):
File "C:\Users\Belhadi LahcĆØne\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 62, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\Belhadi LahcĆØne\Documents\2_Larcks_Discord\TRU_Guibot\Guibot_0.5.1\main.py", line 47, in test
await dblClient.get_upvote_info()
File "C:\Users\Belhadi LahcĆØne\AppData\Local\Programs\Python\Python36\lib\site-packages\dbl\client.py", line 156, in get_upvote_info
return await self.http.get_upvote_info(bot_id, onlyids, days)
File "C:\Users\Belhadi LahcĆØne\AppData\Local\Programs\Python\Python36\lib\site-packages\dbl\http.py", line 210, in get_upvote_info
return await self.request('GET', '{}/bots/{}/votes?'.format(self.BASE, bot_id) + urlencode(params))
File "C:\Users\Belhadi LahcĆØne\AppData\Local\Programs\Python\Python36\lib\site-packages\dbl\http.py", line 160, in request
raise Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403): {"error":"Forbidden"}
The above exception was the direct cause of the following exception:```
My code is the following :
```python
import discord
import asyncio
import logging
import aiohttp
import dbl
from discord.ext import commands
@client.command(pass_context=True)
async def test(ctx):
dblToken = 'MY_TOKEN'
dblClient = dbl.Client(client, dblToken)
await dblClient.get_upvote_info()
print('{}'.format(dblClient.get_upvote_info()))```
Any idea please ?
(using discord.py -rewrite)
This is what i do, i replaced the token to post my part of code here ^^
Hey, dbl library doesn't work well. I'd recommend posting it using aiohttp
It has a strange behaviour, when i pass my Bot's token, i get the Forbidden (status code: 401)
But when i pass the token that i got from discordbots/api it returns the Forbidden (status code: 403) š¤
I'm not very sure, but i guess that this issue is returned because of a bad token passed, i got the error 401 when i try to pass a bad token to use functions like get_user_info().
@restive otter Hmm, how could i get a voter list using aiohttp ?
Oh, your getting voter list?
Yes i'm trying to get voters to give them some rewards you know
idk about that, sorry. I just thought it was a server count poster
Ah np, ty for help
Any other way to get the last voters ? š¤
Webhooks
Try it and see
How do i fetch who voted for my bot?
read the docs
i've never used webhooks
@plush ore if you want to run code when someone votes you need to use webhooks, if you want to just check if someone has voted you can use the API route but it's still recommended to use webhooks + db
The API route may not change instantly
For the url you put your webserver
For the authorisation you put a password or some other crap
@plain timber so using the api route, would I have to set up a 1 min interval or so to check for votes?
Why?
trying to get the server count working, getting this error
Traceback (most recent call last):
File "C:\Users\Aave\OneDrive\Bot\Main\Discord Bot\bot.py", line 17, in <module>
from discord.ext import commands
ModuleNotFoundError: No module named 'discord.ext'
Yea i figured that out, turned out that i didnt even need that anymore and was just putting it into all my commands but it never gave me a problem till now, thanks
What's your bots name on glitch @restive otter
I just realized the http npm is dead
That's why my webhook is not working
What can I replace it with?
http is built into nodejs
what are you doing looking at http on npm, also #development
Is your token on glitch @restive otter
Yes it's on my .env


