#topgg-api
1 messages · Page 51 of 1
there is also the bot id
oh
oh you can use that then
thanks for clarifying that
aight thanks for helping worked 😃
How to setup the bot?
I have it in my server but what do i do now to show how much people i have in my server?
you need with a command you can see how much people you have on the server?
You need to grab the guild.members collection, filter the bots out and then get the size of collection
I've been having a problem, my token either doesnt work or idfk, regened it multiple times..
the vote is not going through?
Webhook running at http://0.0.0.0:3000/dblwebhook
tried and it didnt work
replace 0.0.0.0
k then use your vps ip
the public one 
yes we know
i been using glitch for this but i moved to a vps
so its different
idk why its not working though
ok
but, it should say inet addr somewhere
on windows use ipconfig
xD
what is this windows vps
oh u right
I use that one
im useless bye
I use the inet addr
oof using chromebook too long
Im on a chromebook too
what is that windows
yes its windows
windows vps?
isn't your vps like linux
what

glitch is linux
you have a windows vps?
yes
glitch is a container
mk idc

its glitch
The one I use is my ipv4
Also, your host should tell you your ip(s)
wait you can curl on windows?
no
curl is not a windows command haha
lol
but I use WSL
nvm same ip
can u like set up a remote desktop thingy
tonkku advertising ken's site
wait
fishy u idiot
this blur shit is useless
nice blur
lol
thanks sharex
up the intensity
anyways i saved it
time to unblur it
it doesnt look like its working
lmao u can see it w/o unblurring
but ipv6 has letters rite
idk whether its an 8 or a B
LOL
lmao ofc

k probably B
lol
That's some nice blur
I played myself
ya think

advaith thats equivalent to doxxing lmao
??
He doxed himself
where is the inteis8ty
yeah fishy sent it
lol
in a setting thing
also a bot caught it and re-uploaded it to #265156361791209475
Many did
yeah but you reuploaded it
its what you set, the port
The one you set 
wdym
the number after :
webhookPort
oh idk
thats the port it be listening on
it can be anything?
if its open
then you need to open
how
idk how to do that on windows 
google how to open ports and your host
@arctic arch i tried and it didnt work ;/
write what you tried to do here
ok
const DBL = require('dblapi.js');
const dbl = new DBL(process.env.DBLTOKEN, {
webhookPort: 3000,
webhookAuth: process.env.PASSWORD
}, client);```
changed stuff so ye
dont worry about the authorization part
also no response in console so i cant show that
@arctic arch i think thats all i tried
wait
wait
srs tho?
you cant use process variables in something that isnt the process
DBL doesnt have your process
@spiral steeple i said dont worry about the authorization. I blocked off the value
Oh
You see
Its 2:36 AM
and Im tired, imma just go to bed
gl with that issue
set remote port settings to the same as local port
Ks8qqhx
How can I add this status to my bot?
the tools section should have examples
Check bot logs @last cedar
You installed all npm's? @last cedar
😭 still doesnt work ;/
Thanks, but I'm getting this error.
OK. I used the example and it seems to work, but no.
And I see this.
oof
Hey
I voted my bot and every 10 sec my bot tell me that i voted!
How to change it?
Ssum has voted!!!
Ssum has voted!!!
Ssum has voted!!!
Ssum has voted!!!
Ssum has voted!!!
@restive otter wtf it's not supposed to be like this, can you send the code
How else can bots be sorted with dbl.getBots({sort: 'points'})
okey @proud sphinx
bot.on("ready", () => {
console.log(`${bot.user.username} is ready on ${bot.guilds.size} servers!`);
var interval = setInterval (function () {
bot.user.setStatus('available')
bot.user.setPresence({
game: {
name: `Your Moderator+ | /config`,
type: "WATCHING",
url: "https://discord.gg/ScUkhKR"
}})
// dbl.hasVoted("484290187279728657").then(voted => {
// if (voted) console.log("Ssum has voted!!!")
//});
setTimeout(function(){
bot.user.setStatus('available')
bot.user.setPresence({
game: {
name: `${bot.guilds.size} servers!`,
type: "WATCHING",
url: "https://discord.gg/ScUkhKR"
}})
}, 5000);
}, 1 * 30000);
});
nice ad
@restive otter any field from the bot object
Well it shouldnt embed tbh, and its invalid
lol
I hate the auto embed on invites
// dbl.hasVoted("484290187279728657").then(voted => {
// if (voted) console.log("Ssum has voted!!!")
//});
@restive otter you literally did an interval to print every ten minutes if you voted
Why would you do it anyways
I wanna send an user
that "Thanks for voting!"
but idk where should it be
that will be seen only once
Use webhooks
If someone know how to bot dm when someone vote it please ping me
@restive otter no, widgets have nothing to do with webhooks
There's a separate section in the edit page for webhooks
And what language is your bot in?
It’s looks like JavaScript to me from what he sent above
i agree
You didn't even send any webhook code
dbl.hasVoted has nothing to do with webhooks
yes
if you use the example, it will send a url in the console when your bot starts @restive otter
if it has 0.0.0.0, change that to the server's public IP
you don't know your server's public IP?
no
sorry I am not good in webhooks
You mean discord server ip or what? @plain timber
oh
well then you'll need to change the webhook code to work with glitch
does your glitch project also use express?
how do you keep the project online then
if you use uptime robot you need express code in your project
you changed it?
yes
ok so then in DBL, use this URL: https://PROJECTNAME.glitch.me/dblwebhook
change PROJECTNAME obv
wdym
Patience
its there at the bottom of the edit page
yes
but
it still say
Webhook running at http://0.0.0.0:3000/dblwebhook
@plain timber sorry pinging but you are god
... he just said it’s good ...
Yea.
did you set the settings in your bot's edit page yet? @restive otter
Advaith
?
Inv me to DBB in DMs
auth?
the password
Okey
yw 😃

@plain timber last thing
how dm the user?
I made
vote.user.send("test")
but it's not working
so
if the user is cached, you can use client.users.get(vote.user).send(..)
Thanks
but you might want to fetch the user before that
yes in case they arent cached
i think in d.js 11 its client.fetchUser(vote.user), in d.js 12 its client.users.fetch(vote.user)
yw 
💙
@plain timber now help me with MY problem lmao
@last cedar well idk how to fix your problem
wdym u dont know?
I'm using a cmd prompt
and I tried to use https://myip:3000/dblwebhook but its not working
@plain timber ^^^
;/
@commands.command(name="dbl-update")
@commands.is_owner()
async def manual_update(self, ctx):
"""Command used to manually update server count on DBL!"""
headers = {"Authorization": self.token}
end_url = f"/bots/{self.bot.user.id}/stats"
total_servers = len(self.bot.guilds)
params = f"?server_count={total_servers}"
async with self.session.post(self.base_url+end_url+params, headers=headers) as response:
text = await response.text()
embed = discord.Embed(title="Posted Server Count!", description=f"```json\n{text}\n```", color=discord.Color.teal())
await ctx.send(embed=embed)```
Anyone knows why this would happen?
I tried the params argument of post() too but it gave the same results

hey
can anyone help me with the webhook.on part
the http://${hook.hostname}:${hook.port}${hook.path}
nvm
no i got it working
okey
yes i did
client.users.get(vote.user).send("here") @grim hazel
i used client.fetchUser(vote.user).send("ff")
It worked?
nope
try my one
you can?
wait
but it tell you in logs that someone voted?
k
i used heroku
so for the url
ill have it as https://appname.herokuapp.com:8080/dblwebhook ?
yes
i tested it
it doesnt send anything
really?
wait a sec
sure
send me the code @grim hazel
it send you a console log that someone voted? @grim hazel
If it's showing that in the console
It means you're receiving the request
So probably just something wrong in your code
👀
It's not in console
idk heeoku
I think is an error
it show up a message in console = Voted for the bot ID: @grim hazel
or sth like this
huh
what do you mean 'it show up a message in console = Voted for the bot ID: @grim hazel'
wait
if you vote
the test on edit
for the bot
it should appear
User with ID ${vote.user} & with a name of ${tsuki.user.get(vote.user).username} just voted for tsuki
in console
Yes
is that a test vote
i think cuz of path
ye
I setup a webserver for vote webhook, how do I get the JSON Object?
File name you wanna json @wet sequoia
I just know that when someone votes and DBL sends a webhook request it sends a JSON with userId
I don't have a json file
hmmm
yeah
yes lol
is it $_POST["data"] or whot
it sends a POST request but I need the name of it yk
your pass?
for some reason idk why the webhook doesnt work
JS? @last cedar
you need to set up a webserver
^
d.js by itself aint enough
u mean express?
ye
nah ;/
why not?
glitch DOO DOO
No u
I can only get my bot to 7 hours of uptime
So host a web server only on glitch
but without glitch I can go up tp 16
no i dont know php
;/
then
ok ig?
i already know that -_-
😞
thats why Im getting up FOR computer
oyeye
lol
hey so I'm confused on what these settings do, and yes I've read the docs. Do these correspond to options.webhookPath and options.webhookAuth respectively?
oh and ping if you reply
Authorisation is webhookAuth and url is your public ip
We hook path is the path to you webhook
@long yarrow
Can someone help me?
Sure @restive otter! What's your problem?
Bug (I think?): Webhook test in the bot editing page doesn't work until after you save and submit edits, then click edit again afterwards and the test works
You just have to hit submit for it to update
yes lol
can someone please gimme a tut (video if there is some and updated) to how to use the api in node cause it's 5 hours that i'm testing and nothing working >.>
Message deleted; i fucking hate dyslexia
Don't think there is a video, but there's examples on the api docs
ye but i don't recieve anything in the console 
-bots 363035228198928407
User not found
You don't have a bot...
i'm a developeer of @glacial delta and i can proof it if nedded
Discord.js right?
yep
Any commands so far?
ye a lot
i just wanna make a role reward feature but dunno what's the event
(i don't own the bot either the app on the site)
ye the owner gived me the api (site) token
Hm
For server count
Isn't it a like dbl.poststats?
const dbl = new DBL(tokenhere)
I think
Don't really remember
Of course you need the DBL package
welp
this ?
not working i tihnk
it better not be
store your server count
in a var
then do
dbl.postStats(varwithservercount)
you can ignore the shard
I guessing you dont use it
i do but what i want to is know when a user has upvoted the bot
oh
dont you need
webhook for that?
do you need to know when or if a user upvoted?
@rigid shuttle
dbl.webhook.on('vote', vote => { console.log(User with ID ${vote.user} just voted!); });
On the docs
i'll try thank you ^^
so should i use something special when calling the dbl class ? (new DBl())
@glass garden it's says that webhook is not defined so he can't read the on function 
im trying to vote lock a command and i seem to fail..
if (voted);
});
isnt it supposed to work?
@rigid shuttle you didn't include the webhook settings in the new dbl
i did
two seconds
const dblClient = new dblapi(config.dbl_token,{ webhookPort: 5000, webhookAuth: 'password' },bot)
bot.VoteClient = dblClient
dblClient.webhook.on('vote', vote => { console.log(`User with ID ${vote.user} just voted!); }`)});
bot.on("ready",()=>{
console.log(dblClient.webhook)
bot.BetterChannels = new discord.Collection();
bot.guilds.forEach(guild=>{
guild.channels.forEach(chnl=>{
bot.BetterChannels.set(chnl.id),chnl;
})
})
bot.generateInvite(8).then(i=>{
console.log(i)
})
})
@rigid shuttle its working?
nopê webhook is not defined
you installed dbl @rigid shuttle
yep
What is bot.VoteClient = dblClient? @rigid shuttle
hmmm
it's just let me use dblClient as bot.VoteClient on every file
is the password same as web one? @rigid shuttle
i think no
so set it
i'll do it
dbl.hasVoted(message.author.id).then(voted => {
if (voted) console.log("You hav voted!!!")
});
im trying to make a vote lock command but i cant seem to find a way to get the persons id .. the one who run the command ... i tried message.author.id but it doesnt work
@restive otter Still not working 
@restive otter dblClient.getVotes().then(votes=>votes.find(v=>v.id == msg.author.id))
i think this will work
@restive otter it will be better to just store all the people that voted in a database
guys did anything happen with the api for nodejs
Error: Cannot find module 'dblapi.js'
no?
even after I ran npm install -g dblapi.js --save
I tried to install it before but it didn't help, is it necessary?
It's your own code, you don't know what's necessary?
mongodb is not a prerequisite of dbl, check your package.json for dependencies or peer deps
ok will do
Isn't there just a way to check if someone has voted by their id
Like on the dbl has voted . Inside the () can't you put something that gets fee user's id
/bots/{botid}/check
I need the users Id not the bots
I also tried userid but didn't work
if (voted) console.log("You hav voted!!!")
});```
Users.(Userid) ?
Yeah you can use hasVoted, /bots/{botid}/check accepts a query param of the user id
hasVoted wraps that
Hah I'm confused .. where do I out the bots/botid?
does hasVoted() not work?
If I leave it blank ?
no
It says that an id Is needed
and
It didn't work
if(command === `${prefix}voted) { dbl.hasVoted(message.author.id).then(voted => { if (voted) { console.log(message.author + "has voted!!!"); message.channel.send("You voted in the last 24h!"); } }); return; }
This should work @restive otter
But what if we spam the command
rate limit
add db limit
@restive otter I don't want to check if I have voted or not I want to make it so a command can only be run when you have voted .. and if you haven't it will send a message saying that you need to vote
Can anyone help me with this error? Does it mean that my internet is bad or there's something wrong with DiscordBotsOrgAPI cog?
https://paste.ofcode.org/44abammf6WSRUbPxMvcrKf
(It was working before for months,)
looks like a discord.py problem
I've temporary disabled that cog to see if it happens again.
@restive otter check docs
I don't know, randomly
Mind sending code?
Well, honestly, I would recommend posting to DBL api directly with aiohttp
dblpy is kind of outdated
Sorry for posting 26, later XD
Forgot that we were talking here
Feel free to mention me
@restive otter i tried the vote command u said
if(cmd === 'voted') {
dbl.hasVoted(message.author.id).then(voted => {
if (voted) {
console.log(message.author + "has voted!!!");
message.channel.send("You voted in the last 24h!");
}
});
}
and it says forgot to ctch a promise rejection let me catch the rejection 1 sec
@restive otter you wanna sth when for one voted to your bot, to dm? @restive otter
all i want is to vote lock a command
what you mean with lock command?
@restive otter
lets say that i have a command.... for example the prefix command .. I want to make it so in order to use the command you need to upvote the bot else it wont work
oh
so
check if member has voted in the last 1000 votes @restive otter
wait I will send you it
ok
But he doesn't want that?
Pretty sure he wants it to be an active vote as in voted within the last 12h
It doesn't return timestamps of votes
And using hasVoted is a bad idea as people could spam the command
Which would spam dbl
what should i use then?
So preferably you use webhooks to know ~exactly when people vote
all i did was follow the guide
i have alrerady set that up
dbl.webhook.on('vote', vote => {
client.channels.get('545963588251156480').send(new Discord.RichEmbed()
.addField("New vote on", `DBL for <@${vote.bot}>` )
.setColor('RANDOM')
.addField("User ID:", `${client.users.get(vote.user)}`)
.setTimestamp()
.addField(`Attempt to mention `, `<@${vote.user}>`)
.addField(`Tag`, client.users.get(vote.user).tag )
.setThumbnail(client.users.get(vote.user).displayAvatarURL)
)
this posts a messsage when someome votes
If you have the webhooks then why are u doing this lol
..
Save it to a DB
I want to vote loc a commmand
idk how to write a timestamp in db
When they use the command check in DB if that user has a vote within 12h
Do you not know how to write it to a DB or do you not know what a DB is
dont u mean quick.db ?
That works
ye idk how to use that
I never used quick.db so I don't either
hmm
Read their docs I guess
any other suggestions of things i could use?
Is your bot online 24/7
You could just put them in an array then
hmm
But it would be lost if your bot shuts down
If you want to make things more professional you should figure out how to use a DB
okay
@restive otter there are many different databases, quick.db is one
But I've heard quick.db isn't good
Easy isnt always best*
^
where i can get a token?
On the discord developer site
here is the link: https://discordapp.com/developers/applications/
Integrate your service with Discord — whether it's a bot or a game or your whatever you wildest imagination can come up with.
oh
DBL token
on the dbl bot page
where?
I don't know
I think your bot needs to be accepted
@untold marten found it it's here but the bot needs to be accepted https://discordbots.org/api/docs#mybots
/^
I am here
hi there
Hi
Hi here im Jared

starting to look like general
fack
Dont post your token pls
okay calm down, it was Jared's we're trying to figure it out.
I regened it it's fine
Good 
const DBL = require('dblapi.js');
const dbltoken = 'ha not this time son';
const dbl = new DBL(dbltoken, { webhookPort: 5000, webhookAuth: 'GarbageIsNotTheBest' });
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);
// Do what you need to do
});```
no leaks
that doesnt matter
XD
plus it's the wrong password i see what you did there goat
XD
:p
got em
on the /bots endpoint with the fields param, does All fields actually work for getting all fields, or do we just set it as ''?
I wouldn't imagine an API implementation that would accept All fields, just don't include it if you don't want any specific fields
I would imagine that as a pseudo rather than actual
Then again, this API had some questionable implementation in the past, I wouldn't be surprised
to upload my bot - do i have to use this codes in my code?
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)
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:
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))```
i cant upload my bot and this code updates a few things of the bot on the website
also i mean before i have this code into my codes it doesnt work
???
Your bot will get approved once a website moderator approves it
I'm having some issues with the vote function
I wat to log them in a discord channel
therefore the bot would need to send the data in a discord channel.
I don't know how to go ahead with this tho.
I've tried this: ```js
dbl.webhook.on('vote', vote => {
client.channels.get('545963588251156480').send(new Discord.RichEmbed()
.setColor('RANDOM')
.addField("User ID:", ${client.users.get(vote.user).id})
.setTimestamp()
)
});```
My knowledge about web hooks is very bad.
Do I have to set my webhook URL to anything specific for it to work?
Your exposed endpoint
To which part of it?
@junior lintel lol Just make it like
let embed = new Discord.RichEmbed()
.setColor('RANDOM')
.addField("User ID:", `${client.users.get(vote.user).id}`)
.setTimestamp();
dbl.webhook.on('vote', vote => {client.channels.get('545963588251156480').send(embed)}
wat
${client.users.get(vote.user).id} exists inside the vote callback scope
You moving out of it will cause it to be undef
@junior lintel http://yourip:port/path
Lol why isn't rr on the list?
Reasons, not gonna mention it
alright
when i try to check votes, i use this:
https://discordbots.org/api/bots/490644041806118923/check?userid=354741784061935619
But its tells me:
{"error":"No query userId, add ?userId= to your request"}
o nm i got it
capitalization
is auth neccessary for checking votes?
yes
ugg
How long does the api take to update server counr?
Should be quite fast.
Xd
I sent my testing bot info
which was only in 1 server
now my bot looks fishy
can someone tell me how do i know if someone from a certani guild has voted for my bote
bot
im new to this pls help
no
well then read it 
Well it says this Instead of requesting our API to see the users who have voted for your bot, we now have webhooks! Webhooks will send a post request to a URL of your choice when your bot has been voted for.
where can i find an example
hm
i dont think the c# lib supports votes
so make the HTTP request yourself
ther is nothing related to voting apparently
just run a web server
look for POST reqs
or just run a webserver for webhooks
do your stuff
where shall i put that link 🤔
do you know how to make http requests or run a webserver
i know how to run a webserver
but i never programmed for web servers
is this the base url
oh it worked thank you
Why doesn't this call back my ip? Webhook running at http://0.0.0.0:5000/dblwebhook
I've set my secret, port and ip correctly.
I don't believe that glitch is localhosted, so no

@junior lintel it's good, if you host on glitch it will work
you will get that is 0.0.0.0:5000 but it will work
replace 0.0.0.0 with your public ip
on glitch that will be project-name.glitch.me and you have to use port 3000
so I just put my ip as the name of the project or?
Giving the port 3000 makes it call back this error: Error: listen EADDRINUSE: address already in use :::3000
level 100 blob typing (advaith)Today at 6:26 AM
hm
i dont think the c# lib supports votes```
that and don't use the official c# library, it's full of deadlocks and tonkku refuses to use any other libraries in the docs
you're better off writing your own, that thing is a mess and full of deadlocks
complexity > productivity
@junior lintel that means you are already running a webserver, possibly through express. you will need to use webhookServer to connect dblapi.js to the express server.
you can only run 1 webserver per project
but dblapi.js can connect to an existing one
How do I use the api?
If you're using JS you can take a quick look here and this should explain it rather well. https://discordbots.org/api/docs#jslib
@restive otter thx
Would It go in the index.js
@plain timber im using a command handler
ok?
i dont think you even said what you want to do with the api
there are tons of different things you can do
you can get information about a bot or a user, you can check if someone voted for your bot, and you can post your bot's server and shard count to the site
you can also set up a vote webhook and run code as soon as a user votes
but i don't think you can use the api until your bot gets approved and listed on the site @restive otter
@restive otter
Hi! I used the example to make my bot server number thing on the website. But it doesn't works. Any idea?
@restive otter check api https://discordbots.org/api/docs
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)
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:
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))```
``
dbl.postStats(bot.guilds.size, bot.shards.id, bot.shards.total);
^
TypeError: Cannot read property 'id' of undefined
``
Why lol?
cos the proprty id doesnt exist in 'shards'
Hi, when you fix the command m!trade and m!sell?
@restive otter You have the wrong channel and the wrong server entirely
Try asking in the bot's support server if they have one.
can someone tell me why I still get http://0.0.0.0:3000/dblwebhook whilst connecting to my webhook?
because 0.0.0.0 is local host, the port you defined is 3000, the default path is dblwebhook
how am I meant to put it up on the webhook then?
Did you set the webhook up right?
I followed the example
403 means either wrong token or your ip is banned
How can I customize my bot's DBL website? Not the description
with css?
Maybe, I don't know
The answer is yes
Time to learn then
Okay but how can i link the ccs to my dbl website?
Thanks



please when you answer