#topgg-api
1 messages · Page 39 of 1
uhhh
when trying to set my bot server count using the api i get this :
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.gson.internal.ConstructorConstructor (file:/C:/Users/user/.m2/repository/com/google/code/gson/gson/2.6.2/gson-2.6.2.jar) to constructor java.lang.Void()
WARNING: Please consider reporting this to the maintainers of com.google.gson.internal.ConstructorConstructor
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
i'm using java
any help ? or should i just leave it ?
const Discord = require("discord.js");
const bot = new Discord.Client({disableEveryone: true});
const DBL = require('dblapi.js');
const dbl = new DBL("token", { webhookPort: 5000, webhookAuth: 'password' }, bot);
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.user)
if (bot.userdata.has(vote.user)) {
let num = bot.userdata.get(vote.user).tiers + Math.round(bot.userdata.get(vote.user).tiers*1000)
bot.userdata.set(vote.user, num, 'tiers')
}
});
``` Would this set user tiers
@summer osprey no because bot.userdata is probably not defined
is that supposed to be a standalone bot?
const Discord = require("discord.js");
const bot = new Discord.Client({disableEveryone: true});``` is literally setting up a new bot
remove those 2 lines
But this is in my main file so don't i need it for my bot stuff 🤔
i thought you just showed your dbl code
im confused, were those two lines already there?
Here this is all the lines
const Discord = require("discord.js");
const enmap = require('enmap');
const fs = require('fs');
const bot = new Discord.Client({disableEveryone: true});
bot.commands = new Discord.Collection();
bot.events = new Discord.Collection();
bot.help = new Discord.Collection();
let cooldown = new Set();
let cdseconds = 5;
Object.assign(bot, enmap.multi(["userdata", "guilddata"]));
const DBL = require('dblapi.js');
const dbl = new DBL("token", { webhookPort: 5000, webhookAuth: 'password' }, bot);
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.user)
if(bot.userdata.has(vote.user)) {
let num = Math.round(bot.userdata.get(vote.user).tiers*1000)
bot.userdata.set(vote.user, num, 'coin')
}
});
Yes
inb4 the url is 0.0.0.0
is it?
I am retarded
lol
Can you test for me?
click the test button in the edit page
it should
so http://0.0.0.0:5000/dblwebhook Would be url?
I feel retarded again
its just the url of your thing on your host
Authorization is webhookAuth:
Correct
Honestly idk cause something isn't right here
if you make a post request to the dblwebhook page with the correct auth does it work?
Honestly i put the right ip and auth and token cause the servers come up correct but the vote doesn't work idk
dbl.on('posted', () => {
console.log('Server count posted!');
});
``` @plain timber It doesn't log this when i add this to the code so maybe this will help cause it isn't posting either
are you using express?
No
Well in aws logs it had a site so I just opened it and then copy and pasted
http://18.221:5000/dblwebhook
I didn't post the whole ip just part
so idk
did you try making a direct post request
How would i?
either run code or use postman
@plain timber Can you explain what do do with postman?
you can make a post request to the url
get request
can dbl post to a webhook made in discord?
no
Ah thanks
How can i get lives
How would i know if the user has upvoted to my bot?
@native cedar idk how would u do it from their library but
var url = "https://discordbots.org/api/bots/" + $"458722701218021391/check?userId={context.User.Id}";
var rc = new RestClient(url);
var response = await rc.SetAuthorization(DblToken).GetAsync(url);
var jsonString = response.Body;
this is a pretty straight idea in C#
Or from the library
var p = (await discordBotListHandler.GetVotersAsync(3)).Select(idb => idb.Id).ToList();
if (p.Contains(guildUser.Id))
{
//.... U voted
}
Well thanks for your support
I'm using js BTW
Do webhooks work at the moment? I don't receive any post requests.
Yesterday it was ok.
webhook not working. it just suddenly stopped.
i cant get it to work anymore
sigh
when are webhooks gonna get back online
@restive otter hey!
?
const DBL = require('dbl-api');
const dbl = new DBL('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(`User with ID ${vote.user} just voted!`);
});```
THIS IS MY CODE
ERROR
the module you're looking for is probably dblapi.js
ok fine
put your token in a string
Like "TOKEN"?
yes
then replace client with bot
I am showing the code
const DBL = require('dblapi.js');
const dbl = new DBL("TOKEN", { webhookPort: 5000, webhookAuth: 'mypassword' });
dbl.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!`);
});```
Yes what to do?
@arctic arch Help us
whats the version you have
Anyone know how to show how many online shard count on dbl with python
Wait there's an endpoint to check of a user has voted or not?
Why isn't that even in the docs
Never mind it's there. I'm just blind
@restive otter just tried, worked for me
ohh noow it works
didn't work before
@restive otter thanks
oh well, looks like i just had to save the webhook before testing
@restive otter wdym
what kind of webhook should i use to recieve votes (other than discord)
you need to receive it on your server
ok
if you're using dblapi.js it has a system to receive the webhooks
if ur not then you'll need to set up a webserver system
Whats the best api for memes?
@cursive imp read the channel topic pls
Ohh okay im sorry
Hey how do I setup a webhook with DiscordBotList
webserver to accept post requests
WTF
Any one see something?
wat

dbl is not affiliated with discord
how do I get my dbl_token then ? 🤔
I recommend reading this while you get your token
thats a long token
yes
with that token you can access certain parts of dbl API
and modify only your bot's stats
since that token belongs to your bot's page
dbl has no 'client' member ...
hm?
are you trying to use a dbl lib?
ye
have you installed it first?
yes
well I don't use a lib, I just use aiohttp ¯_(ツ)_/¯
O
mmm can someone help me making that vote webhook ? idk
you need a webserver for that
o
setInterval(() => {
dbl.postStats(bot.guilds, bot.shards.Id, bot.shards.total);
}, 1800000);
console.log(`Fortnite Drop Online! Info : ${bot.users.size} users, in ${bot.channels.size} channels of ${bot.guilds.size} guilds.`);
bot.user.setActivity(`for ${config.prefix}help`, {
type: 'WATCHING'
})
})
2018-09-27T17:23:49.766534+00:00 app[worker.1]: dbl.postStats(bot.guilds, bot.shards.Id, bot.shards.total);
2018-09-27T17:23:49.766535+00:00 app[worker.1]: ^
2018-09-27T17:23:49.766539+00:00 app[worker.1]: TypeError: Cannot read property 'Id' of undefined
2018-09-27T17:23:49.766540+00:00 app[worker.1]: at Timeout.setInterval [as _onTimeout] (/app/index.js:25:46)
2018-09-27T17:23:49.766537+00:00 app[worker.1]:
2018-09-27T17:23:49.766542+00:00 app[worker.1]: at ontimeout (timers.js:498:11)
2018-09-27T17:23:49.766543+00:00 app[worker.1]: at tryOnTimeout (timers.js:323:5)
2018-09-27T17:23:49.766545+00:00 app[worker.1]: at Timer.listOnTimeout (timers.js:290:5)```
this crashes the bot
the setInterval thing
to post the servers the bot is in to DBL
i would say (just a crazy guess) that CANNOT READ PROPERTY ID OF UNDEFINED
means bot.shards
is undefined
so it cant get the Id
and i doubt the property is Id, probably id
so u probs dont have shards? make sure theres no an option/way to post without shards if you dont have any
or id is not with capital I
but yea that's a CRAZY GUESS, maaan 'property 'Id' of undefined' what could that be if there's only one id property in dbl.postStats(bot.guilds, bot.shards.Id, bot.shards.total);
its got nothign to do with the capital I 
ar u blind ir says property Id of undefined
bot.shards is undefined
so they arent sharding, but trying to post stats as if they are
don't know JS, thought property is attribute and not the class bot.shards
to post server count and stuff like that
yes
@restive otter It lets you f.e. post the server-count of your bot on the botlist.
So you could post a false server count?
for a few weeks my friend just posted their server count * 10
or 100 i cant remember lol

you shouldnt do that though
No one looking for false count, but if they will figure that - account ban
How can i set the amount of guilds? I use Java and the JDA
@dry mirage #312614469819826177
It doesnt work for me
The discordbots_key is the token from https://discordbots.org/api/docs#mybots, right?
those examples aren't meant to work anyway, they are there just for reference, or to teach people what an "API" means and how to use it
When i use the example, the bot is crashing
String url = "https://discordbots.org/api/bots/"+jda.getSelfUser().getId()+"/stats";
String discordbots_key = "KEY FORM https://discordbots.org/api/docs#mybots";
JSONObject data = new JSONObject();
data.put("server_count", jda.getGuilds().size());
RequestBody body = RequestBody.create(MediaType.parse("application/json"), data.toString());
Request request = new Request.Builder()
.url(url)
.post(body)
.addHeader("User-Agent", "DiscordBot " + jda.getSelfUser().getName())
.addHeader("Authorization", discordbots_key)
.build();
try {
new OkHttpClient().newCall(request).execute();
} catch (IOException e) {
e.printStackTrace();
}```
any way gitlab can be added to the source section of a bots page? i dont use github anymore. a drop down menu with gitlab/github would be nice.
@dry mirage don't do that
you'll leak resources
a) you leak a new JDA instance every time it runs
b) you lean an okhttp client every time it runs
@sudden rampart How can i do it?
install that
An API wrapper for https://discordbots.org/api/docs that works in Java - DiscordBotList/DBL-Java-Library
How can i import DiscordBotListAPI
ok
The token is the token from https://discordbots.org/api/docs#mybots right?
@sudden rampart
ok thx
DiscordBotListAPI api = new DiscordBotListAPI.Builder().token("MYTOKEN").botId("481066842371260416").build();
This isnt working
NoClassDefFoundError is occuring
shade your jar properly
155 chars
IntelliJ does that everytime im building the project
<dependency>
<groupId>com.github.DiscordBotList</groupId>
<artifactId>DBL-Java-Library</artifactId>
<version>2.0.1</version>
</dependency>
This is my dependency
<repository>
<id>jitpack.io</id>
<name>JitPack</name>
<url>https://jitpack.io</url>
</repository>
And this is the repository
Is there something wrong or is it correct?
java.lang.NoClassDefFoundError: org/discordbots/api/client/DiscordBotListAPI$Builder
@sudden rampart Do you know what to do? Nobody is responding
?
@dry mirage ist German your primary language?
where do i set the webhookAuth on the website?
link? is it in the editing bot page?
yes
np
Sorry im kinda new to the whole webhook stuff :P
https://[bots IP here]/dblwebhook - this is the URL for the default location right?
im using the nodejs library
anyone? :3
@forest knoll you should be able to use the domain if you one connected
@plain timber what domain?
a domain is like something.com
oh I see
but can't I just have the webhook go right to my nodejs server?
that would be much more convenient than through my website
i meant you can use the domain if you have it connected to your server
but an ip would probably work too
just make sure its public and everything
what if u try directly making a request with postman
Oh alright
@young cliff Yes German is my primary language
DiscordBotListAPI api = new DiscordBotListAPI.Builder()
.token("token")
.botId("botId")
.build();
This method isnt working for me
Ive installed Java and Screen on my server
And i use Java and the JDA for my bot
noclassdeffound error occures
THis is the full error

stop tagging people
ఋ Triple fesses !
i do not want to update my python ver from py 3.5
any other way to post server count?
trying to upgrade python in apt won't give python 3.5.3 or higher
gonna update the repos now and test
nope
not working
i need to get python 3.5.6
no python 3.6
for reasons
you can try to install it directly from pythons website
installed from source with wget and tar, for some reason not replacing old distro
ye when installing from source you need to specify it
i want to try to get 3.5.6
is there a reason for 3.5?
ubuntu 16.04 LTS server
how would i go about that? i usually install via apt lol
so first you need to download source from https://python.org
where should i install it to? do i use wget?
bear in mind that ubuntu preinstalls 3.5.2
also first read this: https://github.com/python/cpython/blob/3.5/README
running through checks
im trying to do the api and it keeps erroing this
at IncomingMessage.res.on (D:\TinyMe\TinyMe\node_modules\dblapi.js\src\index.js:115:25)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
(node:11700) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11700) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
Reinstall 
reinistall is not working @mystic wing
did you realize this is the wrong channel?
hi
-bots @daring solar
@inland nymph
-bots @deep hemlock
Bots don't have bots, silly.
-bots
@south wing
-bots
This user has no bots
Does anyone have any idea how not to look like this?
https://gyazo.com/935ba27c2a5563c23c610162c37f2b83
when its hovered make it do nothing
I have a quick question for catching vote updates with the DBL webhook. Is there an existing webhook service I can use to make the DBL webhook work? And if yes, how do I fetch the votes from the service?
(Feel free to tag me, as I have the server muted and can only see tags)
@past reefWhat do you mean exactly?
And which programming language do you use?
u can find everything about dblapi there
I'm having a look at the docs right now, but I still don't have everything answered, Eren
Because if its node, for example, there is an webhook example
ask the thing that u didnt figure out then
and there is everything u need to fetch votes
I use discord.js, I simply don't know what to put in the URL field of the DBL webhook
I probably come across as a very stupid developer rn, but I'm still learning.
And do you have a thing on that URL that fetches the votes?
I'm very new to webhooks, but I still want to learn it for my bot @velvet iris, so I can set up rewards for upvoting it.
And with very new, I mean I never used it before
I understand what you mean
but its not that hard to check if user has been voted or not
sending it with webhooks is a bit harder
I'm only gonna check it, then save their user ID to a database upon upvoting it, and then they can use the Bundle Radio for 12 hours before being deleted from the database again.
That's all
u dont need to save it and remove it after 12 hours
Hmmm-
the thing can check if they voted in 12 hours
go into javascript library in docs and read
Then yea, I'm gonna use it in a command lol
and after u installed and set ur token and stuff for dblapi
u can just check if they voted
with <dbl>.hasVoted(authorhere)
<dbl> will be the thing that u const as dblapi
its just dbl in those examples
hope i helped you 
Wow, that's really helpful. I'mma try this out! Thanks a lot Eren, appreciate it!
eren you could save the user once and update every time they upvote
If the form box they used might have an ip only restrictions
@obtuse flicker works with domains
@restive otter @silent perch @feral iron do commands in #commands, #265156322012561408, or #265156361791209475
You pinged me and I was like of shit did my bot get deleted.
well you're not allowed to do them here
When sorting by server count https://discordbots.org/api/bots?sort=server_count&limit=10&fields=username,server_count,id why does the first entry have null as server_count 🤔
Also comes up as infinity on the site
He abuses
Yup
lmao what
That the database can't store
is that the freaking infinity sign
Yup
Yes
lmaoo
Ban the bot 
@arctic arch @surreal junco I think he posted a number above the max number but still in the big int range
a larger number than 64-bit, I assume
Lmao I accidentally pushed a server count for my canary branch of my bot that I was testing so now my server count is at 1 lmao
17 votes 1 server lmao
<--- Anyone able to help this fool setup a webhook to receive votes? Confused about how to actually setup the url information should be sent to
Ok
stop using @abstract moth in this channel
it's #topgg-api not #commands
read the description.
@wooden sparrow What language do you use
js
i need some help
i do not under stank any thing on the library
idk how it works
and idk how to use them
"stank"
and what do you mean by the library
Bot's library *
choose one
that
you mean
idk how to do anything from the drop down menu
in the fucking form
do you not know what your library is
i going off of this https://www.devdungeon.com/content/make-discord-bot-python#install_python_package
Why are you here
so your library
wait
no
im not going tell you what your library is
i just dont understand how i code it
if you don't understand
learn how to
Hi everyone,
I'm trying to use webhooks using java with spark
Here is my code :
public static void startListening() {
post("/votes", (req, res)->{
JSONObject body = new JSONObject(req.body());
switch(body.getString("type")) {
case "upvote": handleUpvote(body);
break;
case "test": System.out.println("Test webhook received: " + body);
break;
}
return null;
});
}
I call the startListening() method in the ReadyEvent of jda
I'm testing on my computer
When i use the test button in the website nothing happens....
What's wrong ?
...on your computer?
don't tell me you are trying to post with a discord webhook...
no
no
not a discord webhook
its in the bot
when i say on my computer i mean when running it in my ide
are your ports open?
yes
dont tell people what your ip is
this isnt ip
ip format is x.x.x.x
thx anyway @restive otter
my ip is 127.0.0.1
now people are able to track you down
same
are you done?
what can i do to make it work ?
ok @loud gulch
i'm new to all this stuff
i'm using heroku whitout a webserver
what ip should i use in the website ? 0.0.0.0 ?
well... i use a heroku free dyno that is already running my bot
i can't add a webserver...
i'll try with 0.0.0.0
0.0.0.0 should be ur public ip afaik
@amber yacht probably your something.herokuapp.com site
it's not a web app, i'm using a run Procfile
i abandonned the idea because i can't get the dyno ip
so...
const DBL = require('dblapi.js');
const dbl = new DBL("token", { webhookPort: 5000, webhookAuth: 'password' }, bot);
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.user)
if(bot.userdata.has(vote.user)) {
let num = Math.round(bot.userdata.get(vote.user).tiers*1000)
bot.userdata.set(vote.user, num, 'coin')
}
});
dbl.on('posted', () => {
console.log('Server count posted!');
});
dbl.on('error', e => {
console.log(`Oops! ${e}`);
});
``` why doesn't vote.user log when i click test?
how would i post my server count without using the predone python api?
i dont want to use the predone api due to it not being compatible with my python install
(and, fear of upgrading my python breaking everything requiring an os reimage, because it happened)
Sharding on heroku omegalul
lmao
@zenith marsh Not sure if node works like python file wise but try to find the main source file. Then go through it and use what you need and discard unsupported stuff....
But it could break dbl so I advise against it
read the api documentation, not the wrapper but the actual api and do your web POST requests @zenith marsh
Code:
import aiohttp
dbltoken = "token"
url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
headers = {"Authorization" : dbltoken}
async def on_ready():
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
async def on_server_join(server):
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
async def on_server_remove(server):
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
**Error: **
Unclosed connection
client_connection: Connection<('discordbots.org', 443, True)>
Unclosed response
client_response: <ClientResponse(https://discordbots.org/api/bots/490636168900116489/stats) [200 OK]>
<CIMultiDictProxy('Date': 'Tue, 02 Oct 2018 15:20:15 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '2', 'Connection': 'keep-alive', 'Set-Cookie': '__cfduid=de2636b4a489a5ce972e3457cf97b358c1538493615; expires=Wed, 02-Oct-19 15:20:15 GMT; path=/; domain=.discordbots.org; HttpOnly; Secure', 'X-Powered-By': 'Express', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': 'Authorization', 'Etag': 'W/"2-vyGp6PvFo4RvsFtPoIWeCReyIC8"', 'X-Varnish': '876150903', 'Age': '0', 'Via': '1.1 varnish-v4', 'Accept-Ranges': 'bytes', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains; preload', 'X-Content-Type-Options': 'nosniff', 'Expect-Ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'Server': 'cloudflare', 'Cf-Ray': '463826e63c944427-BRU')>
Lib: Discord.py
Code From: Hugop#2950
IDK but I think its related to the web, as I see cloudflare ect.
Maybe one of the Website Administrators could help me/say what is wrong?
nothing wrong server side
Ok, but do you have any idea what it may be could be?
Sorry, I'm not good with website dev. yet.
Trust me no one is good at ws
idk about python
😢
could someone please show me how do I show my server count on the page with the API?
Anyone made a bot with kickstarter/patreon api?
same
@late jay what language
python @plain timber
@zenith marsh just directly post to the stats endpoint https://discordbots.org/api/docs#bots
@late jay http://dblpy.rtfd.io/
thanks
Sorry
Not sure what my issue is with it in JavaScript
what
I have an issue where all the events that I use including ready and posted work but voteevent isn’t triggered for some odd reason when I run a test or a real vote
@haughty tundra having the same issue here
Unclosed connection
client_connection: Connection<ConnectionKey(host='discordbots.org', port=443, is_ssl=True, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None)>```

@summer osprey did you set the webhook auth and port in your code, and the URL and auth in the edit page?
const DBL = require('dblapi.js');
const dbl = new DBL("token", { webhookPort: 5000, webhookAuth: 'password' }, bot);
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.user)
if(bot.userdata.has(vote.user)) {
let num = Math.round(bot.userdata.get(vote.user).tiers*1000)
bot.userdata.set(vote.user, num, 'coin')
}
});
dbl.on('posted', () => {
console.log('Server count posted!');
});
dbl.on('error', e => {
console.log(`Oops! ${e}`);
});
``` Here is my code and yes i did put in the edit page
what did you use as the url in your edit page
what if you try directly POSTing to it with postman
I have it but no clue how to use
@summer osprey headers > make an Authorization header
How
set the name/title/key to Authorization
Ok and am i making a post or get request
post
Ok
Is it in a json/application that i make the body if so is there somewhere i know where to put everything? @summer osprey
@plain timber ^ Honest gg for tagging myself
so something like this?
{
bot: 368486558346772480,
user: 335893092756488205,
type: "upvote",
isWeekend: false,
query?: ''
}
@plain timber Would that work as a post?
probably
I did still same bad string
I change it all to ""
🤔
Shouldn't it be "bot":"that long number here"
Sometimes my brain is slow sorry
👍
im just straight up dumb
dream yes
You is smart
nono
oh ok
yes
So where do i put auth now?
In header in a key?
Cause i think that's what the other guys said idk
@sterile sleet ?
sec
Ok
Wait so i put Authorization and then the auth in value
yes
The auth being the thing i set or the token?
the thing you set
Ok
There was an error connecting to...
That's nice
const DBL = require('dblapi.js');
const dbl = new DBL("token", { webhookPort: 5000, webhookAuth: 'password' }, bot);
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.user)
if(bot.userdata.has(vote.user)) {
let num = Math.round(bot.userdata.get(vote.user).tiers*1000)
bot.userdata.set(vote.user, num, 'coin')
}
});
dbl.on('posted', () => {
console.log('Server count posted!');
});
dbl.on('error', e => {
console.log(`Oops! ${e}`);
});
``` So if this is my code i put `password` as Authorization *Sorry i keep asking just need to be clear*
@plain timber ^
yes
Ya that's what i did and There was an error connecting to...
aws
What @plain timber
there might be a domain that you can use instead of the IP
if you cant connect to the IP
i dont really know how aws works
And why are you posting this in api again
Show more
So for all you nerds.... https://arcanebot.xyz/i/AIaHBA.png Does this count for the 24 hours.... like it says.. and am I stressing over nothing or is it the "newer" 12 hour system
12 hour
Were can you find the full dbl documentation (python) ?
(Like something similar to the Docs from discord.py?)
I think this is the closest thing https://discordbots.org/api/docs#pylib
@arctic arch this works?
const DBL = require('dblapi.js');
const dbl = new DBL(`tok`, { webhookPort: 5000, webhookAuth: 'mypass' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
bot.channels.get('494876840385708032').send(`${vote.user} voted!`);
});
this
yea that works
go to the edit page of your bot
yes
thats where you'll put in the url as well
yes but the url is wrong
it should point to your bot
http://ip to your server:port/path
@arctic arch it's good?
replace the ip with the ip tho
where are you hosting
Thanks to everyone for helping us hit 100K subs🤘 #NEFFEXNation The song in this video is copyright free to use in your YouTube videos and content. Spotify: h...
@haughty tundra https://dblpy.rtfd.io
Ty ❤
Yw
@restive otter its name.herokuapp.com
Clicking "Open app" in the dashboard will take you to it
Are you guys sure the webhooks are set up correctly? I've tested mine several times and nothing has come through
Waited 5 minutes btw
Could you post your configuration on your settings page?
Nevermind I'm stupid and didn't put http:// before the url
How can I actually post the guild-count for my bot?
I already done that before, but the issue is now, that I want to post the guild-count for all shards of my bot (even tho it's only one shard atm), but it looks like, that the amount is only provided as a long and not as an integer....
And ideas?
Tried manually converting it into an integer?
async def servcount():
await bot.wait_until_ready()
while True:
serverc = len(bot.servers)
headerss = {"Authorization" : "noToken4u"}
async with aiohttp.ClientSession() as dblsess:
async with dblsess.post("https://discordbots.org/api/bots/452598458625425428/stats", headers=headerss, json={'server_count': serverc}) as log:
print(log)
await asyncio.sleep(900)
anything wrong i'm doing?
It's data, not json
But, in aiohttp's docs, the example says to use json
Which example
I've never used json
Data is what always has worked for me
Maybe these docs are outdated
Also make sure you import aiohttp
yup
GOT IT!
finally
@tidal burrow what is a good interval to post the server count at? i set mine to 15 minutes
60/60 is the deadline
@tidal burrow wdym
60 requests in 60 seconds
No that's a bare limit, I just wanted you to make sure you don't exceed that
alrite
I send one on guild join
unless you get 61 a minute forever, that's good enough for me
same @vagrant python
@tidal burrow Sorry, was away....
I honestly have no idea how I would to that.... I guess such a simple thing like Integer.valueOf(long) doesn't exist....
Why is it even a integer?
Wouldn't it be just better to directly have it as a long? Or to at least support a long?
Anyone have issues with their bot sending amount of guilds?
One request is 401, then it works with a 200 response code, the token has been the same. Besides when I regenerated yesterday. 
.
if (voted) console.log("Tonkku has voted!!!")
});```
how do I make the id of the person voting?
you don't
can I get an example of how to post to my bot's stats (server count)?
like, how do I do the authentication before I send the post request
set the token as "Authorization" header
wait, how do I even make the request?
I forgot it's post and not get
I guess I can use requests...
ok, it doesn't work...
how should it look like in python?
what is the full url?
Not really the best thing...
that's the only way to convert from long to int
Why is there not just a option for also having longs?
because no bot has 2 billion guilds
But when even sharding has long as default.....
It wouldn't hurt that much... But I already made that int-thing...
why is this #topgg-api
Do you like need to use the DBL API thingie like this?
await dblpy.get_upvote_info(days=1)
(I'm meaning the "days" thingie)
That thingie is a parameter
You could easily see for yourself by just not passing it
I just looked through the src and it's optional.
Christian
help me
some_insanely_secret_path
what should i change this to?
do i need
api.login(my api token)
?
(it has some delay)
s]'
@arctic arch How can I find out how many votes has my bot to put at r!stats
${dbl.getVotes()}
?
dbl.getBot().then(bot => console.log(bot.monthlyPoints))
and th totals?
for all time votes bot.points
just console.log?
no thats an example
ok thank's
ok thx
but it has to be an async function
ik
`${await (dbl.getBot('488653202607177738')).points} (${dbl.getBot('488653202607177738').then(bot => bot.monthlyPoints)})`
@arctic arch
oh
ohj
I think the await should go inside the parenthesis
(await dbl.getBot('488653202607177738')).points
ok
for the object Promise, you can't do it inline
ok
either the async await or you do it outside the string
yes
same...
its undefined ([object Promise]) because the first one is trying to read property points of the promise which is undefined, and the second one isnt awaited
probably it should be like:
`${await dbl.getBot('488653202607177738').then(r => r.points)} (${await dbl.getBot('488653202607177738').then(bot => bot.monthlyPoints)})`
ok
wait
thank you
or you could just await it before, then use .points and .monthlypoints
instead of making 2 requests 
👍
I only just now realized red is getting points and monthlypoints
Lol
regheton
How do I use the api again?
About this announcement: do i have do to anything about it? i haven't touched my bot in a long time.
why we are in voice chat xD?
it only affects you if you use the discordbots api without a key
cause tonkku in
How would it require the token every time we use an api? need details
so will it be signed request or? also does it affect server count requests?
Alright
so if all we do is send the server count we good?
yeah, you're good
👍
ya ive got a question brother
why
should I refresh my token?
to control abusive api usage
So https://discordbots.org/api/bots/432533456807919639 would require an auth token?
How so?
@arctic arch nice, ty
Brother.
@thorny parrot yes
Sister
Oof
according to line 4 i belive i am using a token https://github.com/tumblenet/discordPhoneBot/blob/master/discordbot.js
I would agree
ok but wait
why does every single endpoint need to be locked down that's just not very cash money of you dbl develops
😂😂
Its bad when slow mode is enabled in api
hm
cuz announcement and chat goes crazy
means i can’t line spread 😭
^
edit the previous message with line spread 
So, If i am owning bot, i need to give my bot token to someone?
the token you'd use for stat posting
The token we get from DBL?
yes
Ok
so if stat posting is the only thing i do, i dont need to change anything right? only GET requests are affected?
yeah
correct
Wht
can you confirm that one more time
just ban people who api abuse
you can disable slowmode now tonkky there’s like two people typing
But you would think that you would want to prevent false server counts before anything else
Wth
How would you do that?
probably the same as posting server count
i still cant figure out why posting server count sometimes leads to a 401. 
huhh, 60 per minute? 😮
@restive otter I'll have to investigate that further later
I wanted to create a command which can browse and show bots from DBL
Thank you. 
but that'd exceed the limit I think with 700k+ users xD
you can cache them slowly @neat wedge ?
i don't think they would have a problem with that
Well, the user can specify the bot's name that he wanna see
like informations
I cannot cache every bot info
how to vote ?
oh god
you definitely can
first of all, most of these 700k users won't search for a bot, very few people would use it
I am talking about the /bots/{bot.id} endpoint now tho
second, you can progressively cache it and update the cache regularly

you can keep a cache of it for sure, this is how i handle @round sapphire
will see then
and you can just do for loop to get the bot ids
tonkku i want my question answered
why does every single endpoint need to be locked down
did we run some tests on how popular these api endpoints were or something
just keep it at 1 request/sec and you should be ok
how will this token thing work?
this is how i understand it
can we have like a part of the website to test posts/endpoints
honestly, i don't see a point in locking down every endpoint
what is this mean
@half delta absolutely correct, what a genius
a couple, sure, but not every single one
👀
i am outraged
these endpoints are used by people
and these people dont need to sign up for your service
does authorization for all api endpoints include /api/bots/botid?
yes
aleite
yes
AND if you had a decent api TONOKu you wouldn't need to put it behind auth
im just upset tonk
why do it
true
lul

because people scrape the api and started clone sites
@half delta yeah, and you're correct but why not do all of them
When will certification be available?
so instead of ratelimit or not having a limit of 500, we just force auth 
just to be sure
ok tonk you're a little ***** why ignore me
because multiple discord accounts never happened 😶
@restive otter ratelimiting doesn't stop it

