#topgg-api
1 messages · Page 46 of 1
alright
For some reason I get a not found error with this code for c# d.net
DiscordBotListApi DblApi = new DiscordBotListApi();
Hi, i want to know. With JDA when we build the DBL Api Object, it will automatic set online the bot on the website ?
No, the bots status is fetched from this server
Meaning, if your bot is kicked the status on the website will display as "???"
Ok ok
So, when my bot is approved(if he is approved) the status will be set to online/offline or if they didn't add the bot on the server it set to "???"
Exactly
Ok thanks u
on glitch? lul
If you can host the DB somewhere else, why are you using gltich to host the bot 
^
thats called a leaked token
My token never flees
also "he" heroku is a company which afik doesn't have a gender
this isn't for #topgg-api
@plain timber no they are not free.
google's cloud firestore is free
Maybe free trial but not free.
Don't you still need to create an account and link your payment details?
If I recall correctly, firebase is linked with Google cloud console, which does require that you add payment details
Also looking at their limits, for a production bot, they are really small....
Could see me surpassing them in a matter of hours
Oh I definitely use glitch
I run my bot 24/7 no cap
i'm trying to use the python api to post my server count
and i get 403 forbidden

i'm just using the example on the site
the only thing i changed aobut it was the dbl token
for my bot
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...
use the example code provided in the readme
thats what im using
you can save data from webhook on vote
save surrent time
than if now < lastvote + 12 h
he has voted in last 12 @safe pewter
idk much about webkook, what should I do ?
I need help about setting up webhooks inside of my bot
i'm using Zapier for webhook
ill look on it when ill go on pc, i didnt know much too but you just copy and paste some code than add what you want and it should work.
w
@sand hazel that's the one i'm using lol, the one that's on the DBL site's api page
that's the one that gives me 403 forbissed
for context people:
i'm trying to use the python api to post my server count
and i get 403 forbidden

i'm just using the example on the site
the only thing i changed aobut it was the dbl token
for my bot
@harsh drum 403 means either wrong token or ur IP banned
I don’t think I’m ip banned, I’ve never had any issues with DBL
I’ll see if my token is wrong
@harsh drum yeah you supposed to use the one on the GitHub readme
Not the dbl site one
a
GET /bots/{bot.id}/stats does not appear to exist.
it does
hi, how can I use webhooks to receive vote updates in python ? there are only in js in the API
@safe pewter you will need to set up a webserver
what do you mean?
Is there something I can use to get started?
idk, you'll have to google how to set up a webserver in python
ok
look into flask
the hasVoted(...) method checks for 24 hours and not 12 hours? I remember the vote being once daily and not twice daily, so wondering if the api was changed to adapt to that
its 12 hours
I need help setting webhooks inside of my bot quote. unquote.
I am trying to use the pinned manual example, wanted to make sure when i initialize dbl, do i need to specify port and auth in the options? actually, generally just need help with webhooks. @ me when someone is willing to help, thank you!
@heavy summit just use dblapi.js
yeah, just needed help with a webserver, but i think i'll just end up using glitch :d
thank you though, also how long does it take for the bot to acknowledge the user has upvoted?
As soon as the webhook sends that information to you
i was testing rn and i received the upvote message in my webserver but the command hasVoted() returns false for approximately 2 mins
hasVoted isnt related to the webhooks
so i should check with the webhook to see if the person voted?
If the webhook told you that they voted, then why do you need to check if they did?
my bot has a 24 hr daily command that they can get some additional currency for voting but im currently using hasVoted to check for it
you can use webhooks to store votes in a db
okay thank you
the following code doesnt seem to work for me :
//code
});```
my webhook receives the vote:
Incoming webhook: {"bot":"CLIENT_ID","user":"USER_ID","type":"upvote","query":"","isWeekend":false}
wdym it does not work?
like that event does not trigger
upon receiving the upvote
i tried logging it on console but nothing
I recommend checking if the webhook turns ready
i literally just learnt about webhooks, im not exactly sure what you mean by 'turns ready'
i am using glitch
The webhook will fire a ready event when it’s ready
oh it does turn ready bc i have this other piece of code:
console.log(`Webhook is ready`);
});```
which does print on console
hmm
i think i may have initialized by dbl incorrectly then
ok
am i doing this right though:
const dbl = new DBL(dbltoken, { webhookPort: 3000, webhookAuth: webauthtoken});```
I’m pretty sure you need to pass webhookHost, but I think it defaults to 0.0.0.0
o-o
i just assumed the api would refer to the url i provided in the discordbots website
and no problem, thanks for trying
maybe webhookPath then?
if anyone is using glitch for their webhook, i'd appreciate if you could help. @ me, thanks
@heavy summit what's the URL you put into DBL?
Also are you also running an Express/http server? If so you'll need to do additional setup to connect them
@plain timber the url is : https://project-name.glitch.me/webhook
and in glitch.me server.js i have it set as app.post('/webhook', ...) where app = express()
(sorry was asleep then, @ me when you reply)
ye
So basically, I have a PHP script going, and it loops the votes endpoint until it finds the user's ID, how do I make it so they can't run the script multiple times to get more rewards, because it sends a message to them in DMs, where they get the rewards. I just don't want people spamming the script, because they've voted twice in the month, and it just checks if their name is in the list.
wait
when they vote and run the script
i'll make a request to my api and check if they've already voted this month
you could just use the webhook
So, i am just trying to connect to the api, but it just comes up with Forbidden (status code: 403)
I am using the example displayed on the website, adjusted for the version of discord i am using
I am using the python package, with dblpy installed via pip
Make sure the token is correct
Yep, it is definitely correct
Which example are you using
Use the one on the Github readme, not the one on dbl site
ok, i was using the one on the dbl site. Since y'know it would make sense for the working example to be the first one you see
Yep... That worked
Could you tell me why?
Whats the difference between the two examples
@heavy summit you can use either app.post('/webhook') or dblapi.js for webhooks, you can't use both
oh hm okay, thanks
wait so is there no way i could integrate webhooks received on glitch to my bot?
there's
how do i go about that?
like in the doc i couldn't find any option to specify a host
just listen for the payload
set a new express route of post('/path')
then just set that endpoint in your dbl bot
ohh i see okay, thanks, sorry im absolutely new to webhooks
well as i said you can do it either way
if you are using app.post in express you do not need to use dblapi.js for webhooks
its either or
so the endpoint in my dbl bot is: my_ip:port/path?
yeah
but for glitch its just https://project.glitch.me/path
yeah but i just cant get my head around on how to make my bot receive the webhooks sent to glitch, they appear in the glitch console, but idk how to inherit them. so i'll just try using the ip method
no, your project ip can change
wdym inherit them?
the votes are getting successfully logged?
yeah they are
its just, like, i still have no idea how to 'get' the body of the webhook or the webhook itself that is being sent to glitch, like where exactly am i supposed to define it
express or dblapi.js?
this is what i had before:
URL in DBL bot website : my-project.glitch.me/webhook
in glitch's server.js i had:
app.post("/webhook", function (request, response) {
if (request.headers.authorization === token) {
res.status(200).send();
console.log('Incoming webhook: ' + JSON.stringify(request.body));
} else {
res.status(403).send();
}
});
//Listener
var listener = app.listen(process.env.PORT, function () {
console.log('Your app is listening on port ' + listener.address().port); //3000
});```
and its receiving the webhooks correctly
parse the body and interpret the contents
the properties are listed here https://discordbots.org/api/docs#webhooks
well my real question is how do i implement that on my bot
like how do i make my bot receive the webhook being sent to glitch
so what do you get when you do JSON.stringify(request.body)
You could try the dblapi module which will build it right in your bot so you could access stuff like the client.
Or you could try to get this process and your bots process to communicate. Could have a lightweight server on your bot which is private so it could transfer the data. That is how I would go at it.
u don’t need to send a response back
@plain timber the webhook received, for example this is the log:
Incoming webhook: {"bot":"ClientID","user":"UserID","type":"test","query":"?test=data¬RandomNumber=8","isWeekend":false}
ok
so what exactly is the issue 
I know right
obviously do you get the response
i dont have a problem interpreting the thing
you can take that data and do whatever you want with it
i am asking that its being sent to glitch, and i want my d.js bot to use it
what do you want to do with it
yeah, well my problem is how to receive it on my bot o-o am i missing something here?
wait, is your bot not running in that glitch project?
no
thats why i initially wanted to set up with my ip o-o but i thought there was a way for me to just receive it on glitch and have my bot connect to that host
but i might as well host my bot on glitch then
you could just store it in a db
can i use a local db on glitch?
it doesnt really seem to be an api question tho
well my initial question i guess was on how to use webhooks since its my first time
well now u know that, you just wanna connect your bot to the glitch project
so #development would be better
alright, thanks
I aGREE
Oof
hm, how would i detect upvotes in discord.py
@trail shadow
- send it in 1 channel not 3 smh
- you want to act on a vote immediately or check if a user has voted?
webhook
you will need to set up a webserver and DBL's webhooks
DBL will send a POST request to your webserver
ive heard flask is good for python
hm thanks
const DBL = require('dblapi.js');
const dbl = new DBL(token, { webhookPort: 3000, 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(vote)});```
^^ my codes are like that, will webhook works? (I'm using glitch)
Yes probably
So if I replace that console.log(vote) to ```let ok = client.channels.get("527308073296199700")
ok.send(📣 ${vote.user} just voted the bot! 📢)
Will that still working?
yes
No actually I didn't try that console log
Wait, should I write the bot url or something to the bot settings on DBL?
I'm not using express, what's my url?
It's whatever you set webhookAuth as in your code
It's to ensure that it's not a fake request
dblapi.js will make sure that the request auth will match the one in the code
Like it will send a log to the console?
I forgot to say, it sends the servers count
And why hasVoted is glitchy? It's delaying like a lot of time
Same problem as above but in Java :/ some commands dont work
well explain the issue
some commands dont run because the check if a user has voted doesnt work properly
and i cant refresh the server count
Just want to make sure, if I'm sharding, I should post the servercount of each shard to dbl?
Like this?
server_count: client.guilds.size,
shard_count: totalShards,
shard_id: shardID```
Well
I did it and it works
So I'll take that as a yes
hey, I have a question
Would I be able to use
console.log(`User with ID ${vote.user} just voted!`);
});```
on another bot other then the one I own (with the defines and stuff at top).
I have a currency thingy and I'd like to give 10 coins every time someone votes.
Would this interfere with anything or cause problems?
@tall comet you would still need to set the webhook settings in the edit page
Hey guys, does anyone know the JDA api?
JDA is the Java Discord API
@flat gull are you asking for help with the DBL API? If so ask your question here, if not go to #development and ask your question there
I think it is java discord api...
Anyone having issues with the DBLPy library? I keep getting a 403 Forbidden error
are you sure the token is valid?
im assuming this is a py lib for dbl
might want to regen that token 
and make sure you're sending it to the right bot, maybe you're using the wrong id?
in the url
i just copied the cog from here
https://github.com/DiscordBotList/DBL-Python-Library/issues/5 apparently this is a prominent issue as well
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...
@restive otter use this
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))
huh
That should still work?
It's the same except Exception as your previous
I just added additional checks

any ideas?
shit
@sand hazel anyway to make this shit work without this exception
i dont get whats wrong lmfao
nope
i did a complete copy-paste
i've been googling around and apparently its like
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))
try ag a in

uhhhhhhhhhhh
use your old example
except replace
while True:
with
await self.bot.is_ready()
while not bot.is_closed():
TypeError: object bool can't be used in 'await' expression
man what is this py 3 bs
it should work with 3.5

anywho, but just figure out a way to add ready check
from dpy
that's the problem with 403 forbidden
@sand hazel patched some shit together and i'm still getting a 403 with the new code
i'll just drop a comment on the git and manually do it then
thanks again!
So wait
whats the endpoint to post bot shit
nvm im dumb
@sand hazel sorry for the ping but you're the only one active
i'm trying to send the payload with server_count and
url = 'https://discordbots.org/api/bots/421879566265614337/stats'
payload = {'server_count': str(len(bot.guilds))}
headers = {'Authorization': 'uwu', 'server_count': str(len(bot.guilds))}
r = requests.post(url, data=json.dumps(payload), headers=headers)
print(r.content)
b'{"error":"Required parameter server_count or shards missing"}'
can you print payload
posted
Yeah for some reason I don't see the body
try using like
r = requests.post(url, json=payload, headers=headers)
TypeError: request() got an unexpected keyword argument 'payload'
curses
uh
thought that lib has that
but nvm
hue
back to your original
but can you pass an application/json in Content-Type as a header
I can't post the Servercount to DBL🤔
error?
no error
code?
inb4 "no code"
so i have this code:
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
dbl.webhook.on('test', test => {
console.log(`User with ID ${test.user} just tested!`);
});```
and every time i try testing from the edit bot page in discordbots, it gives me:
`User with ID 'my_id' just voted!`
does on('test') not exist?
o okay, thanks
afaik
hey guys, does anyone know why I keep getting the 403 forbidden error when I try to update the server count?
Im storing the token as an environ variable
most likely wrong token
should I get a new one?
are you sure youre using your dbl token
i had the exact same issue last night
yup okay discord.py is broken
lemme get you my code
also regen keeps giving me the same token
common this is not "spoon feeding"
this is advanced problem solving
totally
@loud gulch shut it
i got help last night
so
idc
Post to DBL using discord.py instead of using DBLPy - post.py
@arctic arch could you pin that to this channel so people with the same problem know the solution?
thx ill look into it
oh ok
isn't requests blocking?
what?
the python requests module
wdym "blocking"
exactly what i said
isnt requests block the python requests module
i'm not sure what you're asking here
@sudden rampart
and jacc
i know what blocking is
@sudden rampart if they just fixed the lib we wouldnt have to use such a janky solution
¯_(ツ)_/¯
It's prob better off if you pr the python module
or make one to replace it
the original author seems to be gone
eh ig i can see what i can do
@restive otter if you do a pr, I can merge it
on the webhook it says to enter https://discordbots.org/bot/:ID/edit do i replace ID with my bots id
never mind
how do i get the webhook url
It is where you are running the code for the webhooks
(server address + subdirectory)
1.1.1.1/webhook ex
i dont have one i think...
then you need to get one
how
what language are you using?
javascript
so in the url i just put that
@tepid garden the URL is the servers ip address
And then /whatyouset
As mentioned use dblapi.js
dblapi.js/whatiput ?
im complete new to this
you need to code the webhook
so if i use glitch.com can i use the website for that?
yea
do you have a const listener = app.listen line?
i deleted it but i can add it back then yes
well you need to put the webhook code below that
but change webhookPort: 5000 to webhookServer: listener
in the bot's edit page the url is https://PROJECTNAME.glitch.me/dblwebhook
thanks
I may have an issue with the Java api..
Every 5 minutes, I send stats to DBL but I can't see guilds count on my bot's page 
ooooh
I'm a stupid guy
nvm
wew

Are we allowed to edit the DBL API (the one we have installed)?
Just to make things easier.
@arctic arch (I would assume you would have a say about this since you're an web adminn)
yes?
So its allowed.
why wouldn't it
@haughty tundra you can't install an api, are you referring to a library for the API? If so why wouldn't u be able to edit it, it's just code you can write yourself but packaged
Advaith is right, you can even make your own lib for the api
@plain timber indeed xP, IDK just wanted to be safe
just don't break the license @haughty tundra
how can i send a private message to the user that voted
@tepid garden what language and library are you using?
discord.js, node.js, javascript
node.js isnt language ok
^ actually
hey any of yall here use the random puppy generator API
^^
Do you know how to limit the generator, (since you can change which subreddit it pulls from) to not pull images from NSFW channels?
@abstract moth
Your talking about reddit api?
yea
Never used it, will look into it for you tho
@low ginkgo this channel is only for the DBL API as the channel topic says, for help with other apis go to #development
oh kk
Is there anything built into the API for checking the account ages of connections
Or do I have to connect to each respective API
wdym account ages
wrong channel
yes
Wrong channel, you should ask in #development instead
Is there any way to get account age metadata from a DiscordAPI connection object, or do I have to connect to, say, the FB api
oh
Ooooh my b
Is there a delay in the results of /bots/{bot.id?}/check being updated?
Yes it's cached iirc, it's recommended you use the webhooks instead
I can't really test that locally though :<
And does it do backoff in case my bot goes down for a bit?
(node:4605) UnhandledPromiseRejectionWarning: TypeError: dbl.hasVoted is not a function```
why?
code please
dbl.hasVoted(message.author.id).then(voted => {
if (!voted) return message.channel.send(`Bu komutu kullanmak için botumuza DBL'den oy vermen gerekiyor. Oy vermek için **v/dbloy**`);
if (message.channel.nsfw === true) {
const get= require('superagent')
.get('https://nekobot.xyz/api/image')
.query({ type: '4k'})
.end((err, res) => {
message.channel.send({ file: res.body.message });
});
} else {
message.channel.send({embed: {
description: "Bu bir NSFWF kanalı değildir! Lütfen bir NSFW kanalında deneyiniz."
}})
}
});
};```
Please look
@manic igloo bu ne komutu ?
Is it against some kind of tos to use a oauth app to automatically bot for bots?
It would be cool if the api provided if the bot is offline or not.

Just find the bot from this guild and check its status
the API would return the status for one shard
hello what to press to get the full api key ?
you can find your bots api key on the modify page or on the api docs
i am there but for some reason it doesnt give me the full code only half of it 😦
you need to copy it then
Guys what is shards
no bully plz ;)
minx.confused()==True
"shards" not in minx.dictionary["programming"]
what
I don't know what you mean when you talk about a bot having multiple shards
this is #topgg-api for DBL api
Good point, I guess I just saw people mentioning shards earlier in this channel and asked here
I'll move to... Idk
Hello everyone, I really need some help with the Python API:
#Importing libraries
import discord
from discord.ext import commands
#Defining the bot
gopbot = commands.Bot(command_prefix ='!')
import dbl
import aiohttp
import asyncio
import logging
class DiscordBotsOrgAPI:
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjQ1ODQwNDkyMDk3MDk2OTA5OCIsImJvdCI6dHJ1ZSwiaWF0IjoxNTM4OTQ2ODk3fQ.B90Jn0yasKskZE5rpyyz_n3z-NfTF2YT_mGHeGFsipw' # 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:
print('HAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHHAHAHA')
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(20)
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))
setup(gopbot)
Gives:
HAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHHAHAHA
Failed to post server count
AttributeError: '<class 'discord.ext.commands.bot.Bot'>' object has no attribute 'guilds'
Traceback (most recent call last):
File "/Users/Zl109819/Documents/PythonBot/botjes/spy blin.py", line 40, in update_stats
logger.info('posted server count ({})'.format(len(self.bot.guilds)))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/discord/client.py", line 296, in __getattr__
raise AttributeError(msg.format(self.__class__, name))
AttributeError: '<class 'discord.ext.commands.bot.Bot'>' object has no attribute 'guilds'
What I did wrong, I don't understand.
I took the code from the example.
You need to run the bot at the end of the code, after setup
I did.
bot.run("your_bot_token")
#Get's the bot online!
gopbot.run(Token)
Yes
But you need the discord bot running to be able to post server count
Otherwise how does DBL know how many servers the bot is on
Oh
Idk then
Just saying, the python lib doesn't support the ext framework
Is shit
I don't use discord.ext
You are suppose to pass a discord.py bot into it
logger.info('posted server count ({})'.format(len(self.bot.guilds)))
should be:
logger.info('posted server count ({})'.format(len(gopbot.servers)))
Then it works fine
What is this Cyka example
Wtf is discord.ext
@meager folio is written using dpy, with a separate piece of code running the bot with discord.ext with server count updater
from discord.ext import commands
discord.ext is what you use @fringe epoch
which version are you using
Me?
no
there might be some attributes changes
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))
This is the updated one with the ready check
If the example itself uses "from discord.ext import commands"
Exactly
however there may be some version conflict
Then u can't blame me.
I already found the problem
The example is incorrect
logger.info('posted server count ({})'.format(len(self.bot.guilds)))
should be:
logger.info('posted server count ({})'.format(len(gopbot.servers)))
well whatever floats your boat, it works for most people here
Insult people in Shakespearean English
@sour garden don't advertise your bot please
Ok
It's for rewrite, definitely
we need to get the doc updated :/
?
That I tried to use the example serval other times
Like a month ago
And therefore 2 months ago
What you tried it with the rewrite branch
No, I never used rewrite
Because there are small amount of examples
I use original
The maintainer of the DBL py lib is inactive, so I have no idea
Your bot is currently rewrite
you use discord.ext
You can also make the call yourself to the DBL API
someone posted a snippet using request few days ago
@restive otter's bot @restive otter does that
Well then explain my why gopbot.guilds DOESNT WORK (rewritten command, read the api...)
And GOPBOT.server sdoes work
So again, I don't use rewritten
That's weird
well, the dbl api page is outdated
I already said 3 times that I did do that
I don't think it's even updated
Oh...
Your best bet is to look on the Github repo readme
Ah well it works now
And I don't like dbl api that much that I am going to read it while it works
As long as it works, I'm not going to read.
Whats API means?
like, application programming interface or some cool crap
yes
Is it against some kind of tos to use a oauth app to automatically vote for bots?
its probably not possible
but idk if its against the actual tos
actually yeah it might be possible
Afaik upvoting the bot requires visiting the dbl website, so that would violate ToS if you got a scraper working
i dont see it in the tos
Guess I'll just ask a website admin or mod

x
"the API would return the status for one shard"
That's fine by me. Since the information is already acquired by DBL, why not put it in the API too?
Would be nice.
I do use the vote webhook, but sometimes some votes don't appear through webhooks either because the connection is bad or the bot is restarting currently.
That's why I'd like to fetch the last 1000 votes using dbl.getVotes() every 5 minutes and check if the specific user has voted in the last 12/24 hours and if they have received their reward yet or not (in case the webhook didn't go through).
Unfortunately .getVotes() doesn't tell me the timestamps when someone voted which means I can't compare it and check if the user voted in the last 12/24 hours.
Any other idea how I could do what I'm trying to achieve?
you can check if one user has voted in the last 12 hours with .hasVoted(id)
I'd have to use this method for a lot of users then.
Not the best way in my opinion.
well I'd make a command to check if the user didn't receive their reward
If you're gonna check every 5 minutes anyway, you could save the previous values and compare them with the new values. All the new ones would mean they voted in those last 5 minutes 
yeah that is a good idea too
Anyone know why my bot says ??? for online status?
Its not in this server
Hi.
I have no clue on how to retrieve my vote info using webhooks.
May anyone be so kind to help me out?
@regal rivet It might take some time if ur bot just got added. (atleast it did for me)
My bot has been there for 3 months
It has 545 servers
And just recently it decided to make the status for the bot ???
on the website and i dont know why
exactly
Like it was working perfectly
then i added a new version of the bot
and it decided to go all autistic
Message staff about it. ^^
wait tf it means dms on empty prefix
dbl.webhook.on('vote', vote => {
let ok = client.channels.get("527308073296199700")
let votea = new Discord.RichEmbed()
.setColor("GREEN")
.setDescription(`${vote.user} just voted the bot! 📢`)
ok.send(votea)
});```
Error: ok.send(votea)
^
TypeError: Cannot read property 'send' of undefined
what's the problem?
@old grail ; i think
still not working ;/
huh why? but console.log works well
what
what does console.log have anything to do with what you are have problems with
my problem is
Error: ok.send(votea)
^
TypeError: Cannot read property 'send' of undefined
but if I use console.log('testing 1 2 3')
works.
what's that??
ok.send({embed: vota})
ok is undefined, thats what the problem is lol
the problem is ''.send''
meaning the channel doesnt exist
maybe you are right
i am right
and it's not exactly relevant to the api itself, this is more of a #development issue
node.js and discord.js is a library @fleet tide
Hey! My stats won't update 😢
%eval dbl.postStats(client.guilds.size)
Even when I eval it nothing happens
is dbl defined properly?
Yes it is
const Discord = require('discord.js');
const DBL = require("dblapi.js");
const client = new Discord.Client();
const config = require('./config.json');
const dbl = new DBL(config.dblToken);
const embeds = require('./embeds.js');
const cooldown = new Set();```Thats at the top of everything
I thought I might have been blocked because I changed it every time the bot joins or leaves a server but a block is just 1hr
An I changed it now
client.on('ready', function(){
console.log("MemberCounter is ready!");
dbl.postStats(client.guilds.size);
setInterval(function() {
dbl.postStats(client.guilds.size);
}, 300000);
client.user.setActivity('%help', { type: 'PLAYING' });
})```This is my ready event
em, error from console? :p
Wait a sec
Hm strange
When I host it on my PC it works 
But it doesnt work on my Raspberry
🤦 I forgot the dbl token in my config on my Raspi
But thank you 
gg
just asking: with
dbl.on('posted', () => {
console.log('Server count posted!');
})
the server count only gets posted at start
i have to do an Interval to refresh it?
read the docs
@restive otter here you can get help for posting your server count i don't have time right now someone may have
@primal plank OwO you are hosting on rpi as well? 😅
Of course! Raspberry is the way to go when starting coding and having small bots. But yesterday we had a power breakdown and everything was down but thats okay xD @hallow prairie
;p
still trying to get mine working on boot
it's being one pain in the arse
it worked then decided
nah
I don't like you
and now my bot is offline
reee
oof
I think I know the possible problem
OOF
I didn't run cd xd
reee
it all makes sense now
yey
xd
consider using less new lines pls
Ok
Can someone help me with webhooks?
const DBL = require("dblapi.js");
const dbl = new DBL('no token4u', { webhookServer: server, /*webhookPort: process.env.PORT,*/ webhookAuth: 'probably same thing as above' }, client);
dbl.webhook.on('vote', async (vote) => {
console.log(`someone with id ${vote.user} voted.`)
});
doesnt work
@misty scroll you need to change 0.0.0.0:0 to your IP/domain:port
how to check total votes from a bot?
@old grail just use the get bot endpoint, points is total votes and monthlyPoints is the monthly votes
.getBot("id").points?
then how?
wait for the promise to be fullfilled 
@plain timber 🤔 How tho? using express().listen(port) doesnt work
express
k so then in DBL, the url should be https://PROJECTNAME.glitch.me/dblwebhook
yes you cant visit it in your browser
but it works?
yes
thanks uwu'
The If(UserVoted) Check doesn't work properly🤔
it uses cache results and if ur bot has more than 1k votes it doesn't show
Does anyone know how to get google's youtube data v3 api to fucking work
I keep getting
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "accessNotConfigured",
"message": "Access Not Configured. YouTube Data API has not been used in project [redacted] before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=[redacted] then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
"extendedHelp": "https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=[redacted]"
}
],
"code": 403,
"message": "Access Not Configured. YouTube Data API has not been used in project [redacted] before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=[redacted] then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
}
}
@solemn knot #development
@humble bison #memes-and-media
@amber dune 
this chanel is for the dbl api
Here's an idea
be nice everyone
"dbl-api-support"
but it says in the channel topic
Also can that ned flanders looking ass that ghost pinged me fuck off?
nsfw url plz 😄 xD
im still getting a forbidden with the server post cogs
ayy 3rd time on starboard
cool but why you posting in api 
idk
@idle apex that means you didnt provide an api key, however are you sure the error is on this list?
well you didnt provide an api key
But, i've been,
well thats what the error says 
is voting broken atm?
Doesn't appear to be, why? @tiny swallow
show code
i have the correct api token
its the example on the dbl website api
Sorry about this again tonkku but i haven't been able to update my server count in a while
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))
try this
yeah idk which line that is, discord doesn't have line count
logger.info('Posted server count ({})'.format(self.dblpy.guild_count())
what did you do?
added ready check and ws check
Thanks for the help!
Hello, I want to ask, that .hasVoted is 24hours or 12 hours?
@old grail 12 iirc
For the C# / Discord.NET API I get an error saying The type or namespace name 'ISelfBot' could not be found (are you missing a using directive or an assembly reference?)
for: ISelfBot me = await DblApi.GetMeAsync();
Is there something else I am supposed to include?
?????
@oak dagger #development
-_-
I just got a "Forbidden" error when posting to dbl. It didn't update my server count (obviously) what does this mean or how do I fix it?
Nvm I was using the wrong ID, this is also the wrong channel forthis 👌
does dbl.webhook.on have to be in a bot event?
then there must be another reason im not getting ym votes thro on the bot 
a few reasons. ports, hosts, url..
where are you hosting your bot
VPS server
the url would be your public ip for your vps and the port u put the listener on.. http://123.45.67.89:5000
ofc the actual public IP
and port
thanks
working?
i need to get my public IP i have a confusing system for the VPS bcuz I get it for free 😄
do u have a web browser on your vps?
idk i dont get access to it
its a personal machine from a company in london that hosts my bot for free
how did u get your bot on it
it is but then i realise im getting it for free and i shrug it off
they're quite active anyways
that's good. I'm assuming your bot is written in js
there are some free hosting places I believe like heroku and something else
;receive
How would I dm a user if they upvoted my bot, I added the dbl connection
But having troubles with messaging them
I assume I use the
});```
is bot dming not against some form of TOS whether its bot or api?
Its not lol
Sending a user a DM when they do a certain action is not against tos..
Sending lots of DM to lots of users simultaneously would be against ToS, but sending a message when somebody votes is fine (lots of bot do that)
I assume you're using discord.js
yes lol
ye ik how to dm lol I guess im more confused on how the api works
});```
Would this be the right way to do that ^^
the hasVoted function worked but that only works in the message event right? I want to do it right away when they upvote?
vote should be your return object.. if I recall what I've seen of the JS code. So it should have user defined in the vote object.
Somebody can help me with posting stats ?
user is just the user id
so you would have to define the user
guild.getUsers(user) or whatever the function may be
hmmm
wesley said client.users.. maybe thats a collection of all users on all guilds.. idk
you'll get an error if that user isnt found on any guild your bot is in
let voteUser = bot.users.get(vote.user);
voteUser.send(embed);
hmmm 🤔
bot.users is basically client.users for me
cuz of the way I wrote the code
yeah however u defined discord.js object..







