#topgg-api

1 messages · Page 103 of 1

muted eagle
#

I knew it

#

oh

#

lol

#

success?

brisk vigil
#

no..

muted eagle
#

O O F

#

@raw glade help

#

yum6 oof

#

brb

brisk vigil
#

lol mee6 muted

restive otter
#

-API

novel moth
#

how would i recieve webhooks on my vps using python?

pastel bloom
#

do i need to download pgadmin4 to use it?

hearty lintel
#

do i need to download pgadmin4 to use it?
@pastel bloom i dont believe so, depends on what you're trying to do, but that doesnt seem like what you need

novel moth
#

does its webhook server support server voting too?

hearty lintel
pastel bloom
#

@pastel bloom i dont believe so, depends on what you're trying to do, but that doesnt seem like what you need
@hearty lintel i want to create a db

hearty lintel
#

@hearty lintel i want to create a db
@pastel bloom this doesnt seem related to top.gg api?

pastel bloom
#

oh

hearty lintel
velvet abyss
#

My code: ```py
import dbl
import discord
from discord.ext import commands

class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def init(self, bot):
self.bot = bot
self.token = 'token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) # Autopost will post your guild count every 30 minutes

async def on_guild_post():
    print("Server count posted successfully")

@commands.command(
    aliases=[
        "топгг"
    ]
)
async def topgg(self,ctx):
    dbltoken = "token"
    topgg = dbl.DBLClient(self.bot, dbltoken)
    l = await topgg.get_bot_upvotes()
    g1 = l[0]
    g2 = l[1]
    g3 = l[2]
    g4 = l[3]
    g5 = l[4]
    emb = discord.Embed(title='Last Votes', color=0x147DFF)
    emb.add_field(name=f"{g1['username']}", value=f"{g1['id']}", inline=False)
    emb.add_field(name=f"{g2['username']}", value=f"{g2['id']}", inline=False)
    emb.add_field(name=f"{g3['username']}", value=f"{g3['id']}", inline=False)
    emb.add_field(name=f"{g4['username']}", value=f"{g4['id']}", inline=False)
    emb.add_field(name=f"{g5['username']}", value=f"{g5['id']}", inline=False)
    await ctx.send(embed=emb)

def setup(bot):
bot.add_cog(TopGG(bot))

My error: Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f81ecab3e80>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f81dbdc79a0>, 26.822597434)]']
connector: <aiohttp.connector.TCPConnector object at 0x7f81f9069b70>
hearty lintel
#

@sullen nymph

sullen nymph
#

You're closing the bot while a request was being sent/handled

velvet abyss
#

And what I should to do?

sullen nymph
#

Feel free to ignore that. It's you closing the bot while a session is open

#

So I'd say wait instead of force-exiting from the bot process

novel moth
hearty lintel
sullen nymph
#

not yet, wink wink

hearty lintel
#

oh

novel moth
#

it has webhook support for bots not servers

hearty lintel
#

ohh

#

ok

novel moth
#

is there an eta for when server support will be added?

sullen nymph
#

Within a week or two, probably

#

You can host your own with aiohttp.web or Sanic for proper integration with d.py

novel moth
#

i have no idea how to lol

sullen nymph
#

Eh fuck's sake, scrap dblpy's source code and replace getting bot key from request.data with guild and you got yourself a server webhook

novel moth
#

ill try that

#

also how do i derive a webhook url from my vps ip?

sullen nymph
novel moth
#

thx

pulsar notch
#

Is there is something like

api.on('vote',async(user)=>{
console.log(user.username)
})
hearty lintel
#

using dblapi.js there pretty much is yeah

pulsar notch
#

Oki thanks

hearty lintel
#
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
from <https://top.gg/api/docs>
pulsar notch
#

Thanks ,

stuck socket
#

What updated in new release on pypi?

sullen nymph
#

wig wog see the changelog

#

:^)))

#

Now, excuse me, but why didn't it build the latest version

rapid kettle
#

@oblique sluice it just sends a post request to the URL

{
  "guild": "358630393869631498",
  "user": "247741991310327810",
  "type": "upvote",
  "query": ""
}
```type difference stays the same as DBL webhooks
#

e.g. test / upvote

#

authentication is stored in the req headers

hearty lintel
#

@rapid kettle do you know if isWeekend is present?

rapid kettle
#

It isn't.

#

oh pog

#

docs that didnt exist when i was making my thing

sullen nymph
#

It's not hard to get the weekend status

hearty lintel
#

do weekends on dsl count as double?

sullen nymph
#

Good question

rapid kettle
#

Great question

sullen nymph
#

Let me get my laptop :p

rapid kettle
#

i wanna make a server webhook guide

hearty lintel
#

lmao i inspect elemented dbl webhook and made pogdocs for server webhooks ez

rapid kettle
#

but then again, people who want a server webhook probably won't have a clue how to follow it

#

so hahaa

#

lets see your code

#

@oblique sluice

#

ok so express?

#

@oblique sluice you don't need to use http and express

#

try this js const express = require("express") const app = express() app.use(express.json()) // This allows you to see the post bodies app.post("/dslwebhook", function(req, res) { console.log(req.body, req.header("Authorization")) // This logs the auth and the body })

restive otter
#

I can give role to someone who votes my server?

#

You can use top.gg's implementation of that feature or set up a webserver and do it yourself

mighty shuttle
restive otter
#

guys i need code for mute

#

@rapid kettle

jagged pine
#

Are dbl APIs working?

rapid kettle
#

yes

restive otter
#

what?

willow spindle
#

@restive otter code yourself. We won't give you a code

jagged pine
#

If the dblapi.js library fails to check if a user voted will it return some kind of special object?

#

or just a null vote?

willow spindle
#

hasVoted returns Boolean. Do you mean that?

eternal moth
#

well guys, I don't know how to reward people by voting

#

cuz the bot isn't even responding when people vote for it

rapid kettle
#

do you have a webhook setup

eternal moth
#

like: people when voting, if in a common server with the bot, the bot sends a dm

#

do you have a webhook setup
@rapid kettle I have, maybe there's something wrong with it

rapid kettle
#

let me see.

eternal moth
#
const DBL = require('dblapi.js');
const dbl = new DBL(config.dblToken, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', () => {
    console.log('O webhook do DBL está ativo');
});
#

it does the console log

#

but then

rapid kettle
#

where are you hosting

eternal moth
#

nowhere

#

I guess

rapid kettle
#

what

#

where is your bot hosted

eternal moth
#

heroku

rapid kettle
#

oh dear
have you set the webhook url

eternal moth
#

that's where I failed

#

nope I didn't

rapid kettle
#

you need to set it to the heroku url

eternal moth
#

so it can send info to the bot

#

right?

rapid kettle
#

yes

#

and set auth to the auth in code

eternal moth
#

should be something like https:// botname .herokuapp.com/

rapid kettle
#

depends

eternal moth
#

it's the only link I can access the app itself

rapid kettle
#

thats what you need, yes.

eternal moth
#

since I don't have html

#

it send somewhat of an error

#

it can't display anything to the user

#

there's no page, doesn't mean it can't be accessed I guess

rapid kettle
#

it will recieve post requests, yes.

eternal moth
#

just tell me

#

there's no ports suggested by the host

rapid kettle
#

just put the heroku url into the url section

eternal moth
#

and the template made by the api developers have 5000

rapid kettle
#

as i told you to

eternal moth
rapid kettle
#

yes

eternal moth
rapid kettle
#

it does not serve a page

eternal moth
#

so I did everything nice

rapid kettle
#

yes

#

now put the auth into the auth

#

and the url into the url

pearl ibex
#

how i can make a webhook on my vps for dblapi?

#

does the port automatically open for requests from outside?

rapid kettle
#

the port is normally open @pearl ibex

pearl ibex
#

so ip4_address_of_my_vps:5000/dblwebhook would work?

sullen nymph
#

Oh man, IPv6...

pearl ibex
#

ipv4

sullen nymph
#

Ah, nice. Yeah

pearl ibex
#

sorry i always misspell

#

;-;

rapid kettle
#

yes it would work

sullen nymph
#

Remember to add http:// before that

rapid kettle
#

^

pearl ibex
#

would that work on my local pc?

#

if i used my own ip

sullen nymph
#

Sure. Make sure your firewall won't be blocking requests to port 5000 and that it's forwarded to the right machine in your router settings

pearl ibex
#

oh that ;-;

#

im lazy to do that so ill just test it on my vps

sullen nymph
#

😂 you lazy bum

pearl ibex
#

messing with my router ports always causes trouble

restive otter
#

e

eternal moth
#

this happened

rapid kettle
#

i dont know

sullen nymph
#

"web dyno isn't on" happened

eternal moth
#

makes sense

#

I restarted the bot when a friend voted for it

#

so that all happened

eternal moth
#

@restive otter deleted

#

Fighting Gold

rocky cape
#

on node.js when i do dbl.webhook.on it says cant read property on of undefined

hearty lintel
#

you need to define the webhook parameters in the options in order to make use of the webhook

rocky cape
#

oh

#

I did this

#
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
#

and i set the url to the result of that

#

where i replaced 0.0.0.0 with the ip

#

when i test nothing happens

rapid kettle
#

is it port forwarded?

#

also where u host

rocky cape
#

the port is open

eternal moth
#

2020-09-12T21:46:54.542943+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/" host=gumball-and-penny.herokuapp.com request_id=a31c01c4-6f0e-48ae-a05b-0221be1002db fwd="can't tell xDD" dyno= connect= service= status=503 bytes= protocol=https

#

now the bot is fully online

#

this happens

#

when someone votes, it was supposed to send a DM

#

but it does nothing

#

forget I know what to do

#

it didn't work

#

I had set the procfile to web: node index.js

#

still, it now shuts down the app

#

2020-09-12T23:04:16.226379+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=POST path="/" host=gumball-and-penny.herokuapp.com request_id=14e327b6-d2de-4718-b0f8-77ce8869312d fwd="haha" dyno= connect= service= status=503 bytes= protocol=https

#

someone...?

haughty pier
#

?

sterile talon
#

Ya?

eternal moth
#

I don't have a website for my bot

#

is that it?

#

I just need to have a web dyno running

#

but it shuts down the whole app

#

cuz I have no website to keep it turned on

#

@rapid kettle

rapid kettle
#

yea youd probably need one idk

#

or you could just host on a vps

eternal moth
#

sad

#

heroku shuts down the app cuz the web dyno isn't doing anything

rapid kettle
#

the best solution i can think of is

#

hosting on a vps

eternal moth
#

👏

scarlet gazelle
#

hi pip install dblpy doesn´t work

sullen nymph
#

How does it not work

scarlet gazelle
#

ERROR: Could not find a version that satisfies the requirement dblpy (from versions: none)
ERROR: No matching distribution found for dblpy

#

The api doesn´t exists.

sullen nymph
#

uh

#

Try using pip3

scarlet gazelle
#

already used

mental echo
#

Hiya

#

any API for dsl?

sullen nymph
#

Nope

mental echo
#

oh, okay

sullen nymph
#

@scarlet gazelle what does python3 -V return

scarlet gazelle
#

Python 3.8.0

#

@sullen nymph

sullen nymph
#

python3 -m pip

restive otter
#

Oh shit my cmd say it :
pip is not a command

scarlet gazelle
#

python3 -m pip
@sullen nymph thx

full crow
#

is there api for server list

compact creek
#

@full crow No

full crow
#

oof

compact creek
#

This was answered literally a few messages above

rapid kettle
#

there is.

#

a very basic one

#

webhooks.

full crow
#

oh

kind barn
#

[9/13/2020, 5:12:50 PM] > top.gg webhook running at http://0.0.0.0:5000/dblwebhook
pressing test doing no thing

rapid kettle
#

is it port forwarded?

kind barn
#

no

#

a vps

rapid kettle
#

Ah, a VPS

#

what did you put in the webhook section

compact creek
#

@kind barn I'm pretty sure 0.0.0.0.5000 is not valid

#

btw what lang are u using?

kind barn
#

js

rapid kettle
#

its js i'd think

#

so did you put http://vps.ip.ipv4.address:5000/dblwebhook?

compact creek
#

Hiya I am using the API but how do I get the user object from when a user votes so I can make my own message something like {user} has just voted for Slio on Top.gg!

rapid kettle
#

you dont get a user object

#

just an ID

compact creek
#

I have tried parsing username: str in an arg but that does not work. Discord.py

rapid kettle
#

you could fetch the ID

kind barn
#

so did you put http://vps.ip.ipv4.address:5000/dblwebhook?
@rapid kettle yup

hearty lintel
#

you're using vote webhooks? @compact creek

#

cuz u can just fill <@id> with the id from req.user

compact creek
#

ok

kind barn
#

@rapid kettle any help please

agile fiber
#

yee

hearty lintel
#

you're filling 0.0.0.0 with your actual ip right?

kind barn
#

yup

rapid kettle
#

lets see your dbl.webhook.on code

kind barn
#

in bot's page

#

ok

rapid kettle
#

and is the auth the same as it is in the code

kind barn
#

yeah sure

#
dbl.webhook.on('ready', async (hook) => {
            client.core.conlogger(`top.gg webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
        });
        dbl.webhook.on("vote", async (vote) => {
            console.log('new vote')
        });
hearty lintel
#

is webhookAuth is the same as the auth u put in your bot page right?

kind barn
#

yup the same

hearty lintel
#

are you sure the port is open?

kind barn
#

if the porti sn't opened or in use the console will show an error

hearty lintel
#

no it wouldn't

#

you need to open the port on your firewall

kind barn
#

aha

#

wait

#

let me try

#

done

#

it was the firewall

#

@hearty lintel thanks a lot brother

spark parcel
#

This worked just before, but now that I moved my stuff to docker it suddenly won't run dapperHm

brisk vigil
#

Maybe the api changed?

#

Sorry,i don't use python..

spark parcel
#

This is failing on import, makes no sense...

brisk vigil
#

maybe define it as dbl instead of topgg?

spark parcel
#

Tried that too, same thing

#

Tried importing it after Discord as is shown in the docs, same thing also

brisk vigil
#

line 18 thinkinghard

spark parcel
brisk vigil
#

maybe say

#

import discord as discord1

spark parcel
#

Nope

#

Won't work

#

The issue traces into libraries though

#

As if the name client interferes or something

#

@vital anvil do you have any input here?

sullen nymph
#

Imagine

#

Just imagine

#

line 32 - import discord
line 35 from discord import Client

#

🙃

#

sounds like a hotfix for 0.4.1

spark parcel
#

Would need to do a lot of importing, it's not just the client that I'm using, but sure I'll try that

sullen nymph
#

I'm pointing out my own mistake

spark parcel
#

Oh

#

My bad haha

sullen nymph
#

Do you have any files named discord.py?

spark parcel
#

Oh I do actually, that may be it hold up

sullen nymph
#

or folders, while we're here 🤔

#

Aha

#

Circular imports are fun

spark parcel
#

Well thanks for help, this was stupid KEKW

sullen nymph
#

😂 you had me scared that it was a bug introduced in 0.4.0

spark parcel
#

Gotta love it

restive otter
#

How do we connect our bot with top.gg so we know when a user votes

#

How do we get user ID of the user who votes

rapid kettle
#

its in the vote payload

supple gorge
#

hello

restive otter
#

Where's vote payload

mellow smelt
#

How do I make a webwook for everytime someone votes my bot

unborn canyon
#

open a port on your VPS

#

and have topgg send to that

restive otter
#

Or you apply for api in ksoft api and let ksoft do the job

sullen nymph
#

@restive otter so what exactly was your question in #development? Are you getting requests from top.gg at all?

restive otter
#

im just confused on which channel i ask for help in

#

i wanna use my bot to send a message to users who voted

#

but i dunno how i get the user id

sullen nymph
#

in the vote JSON, get user key

#

It will be a string, so you will have to probably int() it

restive otter
#

vote json?

#

where do i get the json file

sullen nymph
#

Not file

#

Your webhook will be receiving POST requests. Such type allows to specify request body.

With top.gg, you get a valid JSON syntax in a string, so you'll have to json.loads the request body. Once you do that and assign the JSON (now it's a dictionary) to a variable, you can do your_variable["user"]

restive otter
#

can i do it using bot and not webhook?

#

Cant m8

#

so only webhooks?

#

Yes

sullen nymph
#

Could use the API but it's highly unreliable

restive otter
#

not sure what thats supposed to mean

#

i mean i see bots sending messages when you vote

#

KSoftAPI provide webhook service for dbl

#

But its a pain in the ass to get approved

#

which one is easy to set up

#

KSoftAPI for easy, but unreliable

#

Your own webhook server for hard but reliable

#

how do we use KsoftAPI

#

You sure?

#

i mean either way i just want to send a message to user after they vote using my bot whichever works for best is fine by me

#

Thats what ksoft do so, go to their website thats all

#

alright lemme check

restive otter
#

so i set up ksoftapi and message content as this

%userid%
%voteexp%
%votedate%
#

so like when someone votes a webhook will be sent to that channel?

sullen nymph
#

You will only receive the last 1k votes

maiden dock
#

Will votes matter if my gets accepted here?

#

cuz im not able to make a vote log with top.gg api so im thinking to make my own vote page on my bot's site if votes doesnt matter on top.gg

sullen nymph
#

Votes matter and can be logged via webhooks

maiden dock
#

ik and thats the prblm i cant setup that thing theres not YT video for that too

#

no guide on internet

sullen nymph
#

It's literally a webserver listening to POST requests

maiden dock
#

Ok thanks

#

Why i never met u before 02Love
Tysm now finally i can make vote logs ☺️

olive lotus
#

It's literally a webserver listening to POST requests
@sullen nymph I didn't get you?

mellow smelt
#

open a port on your VPS
@unborn canyon whats a VPS?

unborn canyon
#

😩

#

what host are you using

mellow smelt
#

my bot is made with bdfd

unborn canyon
#

o

#

i dont think you can i dont know how bdfd works

mellow smelt
#

oh

#

rip

wicked gorge
#

Turk mod varsa yardim edebilit mi

sullen nymph
#

-notr

abstract mothBOT
#

İngilizceden başka dillerde sohbet etmek için #general-int kanalını, top.gg hakkında (Türkçe olarak da) destek almak için #support kanalını kullanın.
Bu kanalda Türkçe konuşmayın.

restive otter
#

-notr

restive otter
#

who uses bdfd and knows how to make vote logs

#

@restive otter learn real coding

#

Not mobile coding

#

It will be easier to make voting log, trust me

#

i tried cant get it hosting @restive otter

#

Well

#

BDFD cant do webhook shit

#

So youre fucked unless you learn real coding

#

dont wanna pay cant get heroku working

#

😫

#

Instead of heroku, why dont you get a real vps (paid vps)

#

is skysilk the cheapest? @restive otter

mossy sonnet
#

Wait.... you guys pay to host?

restive otter
#

its only 2$💁‍♀️

#

i dont pay

#

@mossy sonnet pay to host is better than free host

#

Let go to development

#

ok

#

Since this is officialy offtopic

burnt trellis
#

Yo

#

-vps

abstract mothBOT
#

A VPS or virtual private server is a virtualized server instance run in the cloud. It acts like a normal server, allowing you to remotely login and manage it just like a physical server or computer. If you're looking for a way to keep your bot online 24/7, a VPS is a great option.

Having trouble choosing a VPS provider or don't know where to start? Click here for a list of common and affordable VPS providers.

restive otter
#

SHOOT

#

SORRY

burnt trellis
#

I should've known ACK

edgy thistle
#

-vps free

#

-free vps

#

-vps

hasty ivy
#

-vps

restive otter
#

-vps

#

-vps

restive otter
#

why

#

-vps

#

lol

restive otter
#

-vps

median badger
#

Stop

rapid kettle
#

stop this

gentle vigil
#

I don't pay for my hosting... I have servers out in England and America somewhere

restive otter
#

-api

#

@sacred shell

sacred shell
#

huh hi

restive otter
#

@sacred shell do -api

sacred shell
#

-api

abstract mothBOT
#

TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs

restive otter
#

Ty

sacred shell
#

np!

restive otter
#

-api

wary ivy
#

how can i solve this error

#

?

#

@restive otter

#

@craggy sentinel

#

can you help me

craggy sentinel
#

you need to call hasVoted with a user ID

wary ivy
#

I already call hasVoted with a user ID

#

@craggy sentinel

vapid cape
#

show code

ancient whale
#

After a bot is approved how does it work to receive the api token and webhook information?

silent pilot
#

hello, where would i find the voting requirments API? i looked everywhere. am i being dumb?

steep zealot
willow spindle
#

you are being ratelimited

steep zealot
#

oh really

#

I want to increase this limit

rapid kettle
#

you can't

restive otter
#

Me too man, me too

#

Also, how are you clustering yet you don't even know what a 429 error is, is there a github repo somewhere that makes clustering super easy for people now? I wanna see NoireSip

restive otter
#

-vbs

#

-vpa

#

-vps

#

-abi

#

-api

#

-api

frigid lantern
#

I don't know if this is by my fault or my host's fault, but after a couple hours of running my bot start to send server updates too often.
My code in my bot.js looks like this:

dbl.on('posted', () => {
    console.log('[top.gg] Server count posted!');
    console.log(`[bot] Bot is working in ${bot.guilds.size} servers with ${bot.users.size} users!`);
})

dbl.on('error', e => {
    console.log(`[top.gg] Oops! ${e}`);
})

How do I fix this so it updates every thirty minutes again?

scarlet river
#

@frigid lantern can you send your code to post servers count

frigid lantern
#

That's literally all the DBL code I have in my files other than the constants.

#

Should I put this in my file:

bot.on('ready', () => {
    setInterval(() => {
        dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
    }, 1800000);
});
rapid kettle
#

no

#

its outdated

frigid lantern
#

oh

willow spindle
#

use autoposter mmulu

restive otter
#

@restive otter wtf is wrong with you

vapid cape
#

@frigid lantern dont put an interval inside .on("ready")

#

either put it outside, or make it .once("ready")

#

.on("ready") can be fired multiple times, when your bot gets disconnected and reconnects for example, so the you have multiple copies of the interval running

frigid lantern
#

That interval snippet is from the docs. Also I don't use that in my bot.

scarlet gazelle
#

work

@client.event
async def on_dbl_vote(data):
    print(data)
``` only with a discord.bot() ?
hardy sleet
#

Hey guys, trying to get the vote events from WH using the JS lib but I don't seem to be receiving event. The doc is pretty scarce so I'd figure I'll ask here.
using:

dblwh.webhook.on('vote', vote => {
    console.log(`${vote.user} voted`);
});

I never received either the vote event from an actual vote or from the test in the bot's page.

#

using ```js
const dblwh = new DBL('topgg token', { webhookPort: 5000 });

shrewd ginkgo
#

-p tera yaar hoon mai

#

Cow dung cake

vapid cape
#

@hardy sleet did you configure the webhook in your top.gg edit page?

hardy sleet
#

Yup, tried with both the domain and domain+path

vapid cape
#

show your current config

hardy sleet
#

Ok, yeah

#

Was me

#

Just realized I forgot to add the port

#

Godbless what work does to your brain

rugged valley
#

I need help in how to create a webhook, i don't understand how that webhook works.

I wanna do a reward for the user which vote fo the bot... but I don't understand that webhook

Anyone can help me? '-' ping me if possible

west idol
#

why does using https://top.gg/api/bots/your_bot_id/check?userId=user_id return an int and not a bool? does it increase to more than 1? or just switches to 1 and 0?

sullen nymph
#

0/1 only

west idol
#

alright

sullen nymph
#

So basically a boolean integer

west idol
#

yep, i thought it increases so it was just weird

sullen nymph
#

👍

white onyx
dull jay
#

Wait

#

there

#

there you can find Example of using webhooks to receive vote updates

rugged valley
willow spindle
#

@white onyx no but you can use vote webhooks

median badger
#

@craggy sentinel

#

@fresh plover

rapid kettle
#

Marco ban this fucker please

median badger
#

@split plinth shut the fucck up

rapid kettle
#

or bean bean bean this child

craggy sentinel
#

hAcKeRpRaNk

rapid kettle
#

hAcKeRpRaNk indeed

restive otter
#

would it be possible to list everyone who has voted for bot in the last 24 hours?

rapid kettle
#

<dbl>.getVotes() in js

willow spindle
#

returns array

rain mulch
#

how can i generate a token ?

#

i actually don't need a token to check who voted my server ?

#

then how ? 👀

#

i don't have my own bot

rapid kettle
#

You can’t check who voted your server

#

Unless you setup a webhook

#

(Not a discord webhook)

west idol
#

about dblpy, does the lib handle the event for when someone votes?

rain mulch
#

can you guys give me idea how can i track if someone upvoted my server ?

willow spindle
#

setup webhook server

gritty hinge
#

Does anyone know if there is a way to count votes using the dbd of the discord bot designer app? i need to know this dsclp ai ._.

#

my friend wants to know that too

restive otter
#
 dbl.getVotes().then(votes => {
            const cEmbed = new Discord.MessageEmbed()
           .setColor('#ff00ee')
           .setTitle('Vote for the bot on top.gg!')
           .setURL('https://top.gg/bot/705259016414298122/vote')
           .setDescription(`Click the blue text above to vote for us!\n\n**Recent Voters:**\n ${votes}`)
           .setFooter("Illusion v2.0","https://illusionbot.xyz/assets/BotLogo.png");
          message.channel.send(cEmbed)
        });```
would this work?
#

it said

Recent Voters:
[object Object],[object Object],[object Object],[object Object]```
summer folio
#

I am not sure why its making us humans objecs

restive otter
#

Does anyone know if there is an api for top.gg/servers votes?
@DeveloperDragon#3967 not yet

fast rose
#

for the python lib, does on_dbl_vote require a webhook?

dapper relic
#

Hello everyone, is there any API docs for Discord Server List?

#

Like creating vote rewards with a bot?

rapid kettle
#

@dapper relic Not currently, but I have worked with the DSL webhooks and their payloads.

#

The auth code is stored in the "Authorization" header
and the body is json { "guild":"guildID", "user":"userID", "type":"test / upvote", "query":"" }

#

the requests are made via POST requests.

dapper relic
#

Thanks a lot! It's a worthy information for me.

rapid kettle
#

No problem!

barren ibex
#

How do I see how many servers my bot is on?

rapid kettle
vital edge
#

how do i do the vote webhook thing?
nvm

frigid vortex
#

using the C# api and you're using AuthDiscordBotListApi it's you're bot's ID not yourselfs id right?

cobalt rain
#

is there a query that will give me the users currently "live" in the voice channels of my server?

#

nvm

rain mulch
#

setup webhook server
@willow spindle would you tell me how can i do that ? 👀

willow spindle
#

do you know any programming language

rain mulch
#

js a little bit @willow spindle

echo solar
#

What's the code for
Seeing how many servers the bot is in? Can any one tell

sullen nymph
#

-api

abstract mothBOT
#

TOP.GG API ONLY!!!
ANY OFF-TOPIC CONVERSATION WILL BE DELETED AND MUTED
This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs

restive otter
#

@restive otter cuz it's an object duh

#

stringify it

#

and console.log it

#

that'll show the contents of it

#

in normal object form inside the code you can do userObject.id to get the user id

sharp saffron
#

-help

plush ore
#

out of every channel you choose api

#

-botcommands

abstract mothBOT
#

Hey! Bots aren't given permissions to send responses in this channel. Please use #commands or #265156322012561408 to run commands. In addition, bots with commonly used prefixes cannot read or send messages in any channel. This is done to prevent spam and bot abuse.

restive otter
#

the api keeps sending random stuff like "AnJo, AnJo, AnJo, AnJo, AnJo", and "KatanaWolf, sigh, GUM GUM PISTOL, Haydes, do-not-know-what-to-type" instead of the actual recent voters

#

sometimes it correctly outputs it, sometimes it sends that random stuff

rapid kettle
#

i have experienced this, yes

restive otter
#

is there a way to fix it?

rapid kettle
#

not that i know of

summer folio
#

Weird

#

It was so weird

#

Anjo anjo

elfin drift
#

hello, please help me. where do i set up webhooks when someone votes fopr a server

#

please help

#

but it gives a 404

#

the pin said it was that

restive otter
#

I don't think there is a server api

#

I think It might only be for bots

#

@elfin drift

elfin drift
#

look at the most recent pin @restive otter

#

ok i found the link

#

however

#

how do i make my bot react to this webhook

#

pelae

#

i need to know

unborn canyon
#

what

restive otter
#

@elfin drift there is an api but very limited currently

elfin drift
#

i know, the site lets me send a webhook

#

i see it

restive otter
elfin drift
#

how does my python code listen for it]

#

no dude

#

as they said

#

the webhook cant send a message directly

#

its not in the format for a disc message

#

its literally right there

#

see the pin

#

the format is not that which could go straight to a server

restive otter
#

the same way you use the bot api is the same way you use the server api

elfin drift
#

how does my bot listen for it

restive otter
#

idk

elfin drift
#

ok thanks dude

restive otter
#

ask @vapid cape our saviour

elfin drift
#

if he knows how then thats great

vapid cape
#

wut

elfin drift
#

idk why he pinged you lmao

#

but do you know how to make a bot listen for the webhook sent when someone votes for a server?

vapid cape
#

did top.gg add webhooks for servers?

restive otter
#

yep

elfin drift
#

but i mean how does my python code listen for webhooks at all

#

the pin says the format these wil be in

#

but idek how my bot can listen for them

vapid cape
#

you need a webserver to listen to them

#

not sure if dblpy would be compatible

sullen nymph
#

soon™️

vapid cape
#

^

sullen nymph
#

will be released in 1.0.0 aka next version

#

Under a new class named DSLClient

vapid cape
#

until then what can they use? aiohttp?

#

or flask

#

or whatever py does

sullen nymph
#

those are async and d.py-compatible

#

If you want to go separate sync process, Flask or Django

restive otter
#

what i must write here ?

#

webhookAuth: 'password'

sullen nymph
#

anything you want

restive otter
#

can i write what i want

sullen nymph
#

Yeah

#

You'd just need to have the same thing in your webhook settings on the bot's top.gg page

restive otter
#

i can't understand

#

i need Turkish moderators :(

#

-tr

#

-turkey

sullen nymph
#

if I enter this

west idol
#

i'm kinda confused, i'm using aws as my vps and it's showing me two ips, one that i see from my cli, and one that i get when i try to curl http://httpbin.org/ip

sullen nymph
#

then webhookAuth must be Bismillah

west idol
#

which one should i use to get the data?

restive otter
#

omg

#

you know whats mean 'Bismillah' ?

mystic mural
#

if you self host do you need to use the token option? Just because of the changing IP address?

west idol
#

but anyway, i tried both and didn't receive anything, so another question, how long does it take to get the data?

sullen nymph
#

a few seconds or minutes max

#

if you self host do you need to use the token option? Just because of the changing IP address?
@mystic mural Self-host? Could you please elaborate?

mystic mural
#

running on my own server with my own router

west idol
#

i pressed the test button from the /edit of my bot's top.gg page 2 mins ago, should i still wait?

#

or i should assume that i'm not receiving said data

mystic mural
#

because every time that the wifi disconnects the IP address changes

west idol
#

token doesn't change even if ur ip changes

mystic mural
#

for the webhook option

west idol
#

the url or the auth one?

sullen nymph
#

That's a hard one

#

You'd have to make sure your IP is static

#

or at best it's updated whenever your IP changes, which is rather a tricky workaround...

mystic mural
#

using the token option isnt a bad thing right?

sullen nymph
#

what do you mean "token thing"

mystic mural
#

the voting api thats not the webhook

sullen nymph
#

Well, it's unreliable but you can use it

mystic mural
#

is there any bad effects of using a static ip?

sullen nymph
#

The ability of being DDoS'd? People pulling info up? If you expose it to the wrong people, that is

mystic mural
#

are webhooks the only way to connect votes now? I dont see in the api that doesnt use webhooks

sullen nymph
west idol
#

yep, i tried both ip and didn't receive any. 22mins have already passed.

sullen nymph
#

Are you sure your there's no firewall to block the requests

#

or that the port you are using is actually correct

#

or the URL

mystic mural
#

oh so theres only gets but theres no events for non webhooks?

sullen nymph
#

events are done either via webhooks/websockets

#

and top.gg uses webhooks for that

west idol
#

yeah the problem is, i don't know which ip i should put on the url, but for the port, i think it's listening just right because i tried to netstat -anp | grep ':5000' and it showed me a python3 process that's listening to it

sullen nymph
#

Can you send me all possible URLs via DMs?

west idol
#

alright

mystic mural
#

what if you create a server using express? Would that take care of changing ip addresses?

sullen nymph
#

express would be hosted on a machine and attached to an IP address the machine is on

mystic mural
#

so I dont need to manually type in the IP address

#

and whenever it changes I can just restart and itll set the new one right?

sullen nymph
#

express will, if you set the IP it will run on to 0.0.0.0, but that doesn't mean the external IP will be updated everywhere where you entered it

mystic mural
#

oh I forgot dbl needs to know the ip as well

#

what I do is use a glitch project as the URL and then the project sends to a discord channel and the bot reads from the channel. Thats my only way right now.

#

The only good side of that is it doesnt require having the package installed with the bot

onyx badge
#

why when im trying to get votes from my bot sometimes gives random numbers?

distant jasper
#

shouldn't the python api example include a def setup?

#

no matter shift f5 fixed it

arctic maple
#

I guess I have made a malformed request.

const fetch = require("node-fetch");

fetch(`https://top.gg/api/bots/405208699313848330/stats`, { method: "POST", headers: { Authorization: config.top_api_key }, body: JSON.stringify({ server_count: 2613, shard_count: 2 }) }).then(r => r.json())

The output is { error: 'Required parameter server_count or shards missing' }
So I'm confused as to how top accepts data.

arctic maple
#

nvm. I figured it out. Forgot to set the content-type header

restive otter
#

Credit give meee

rigid badger
restive otter
#

Is there a way I can have the server vote webhook data (DSL not DBL) sent as https://my.webhook/url?data=stuff

sullen nymph
#

There's no setting for that. The data is always sent in the request body

restive otter
#

@sullen nymph by request body you mean HTTP POST requestbody?

sullen nymph
#

Correct

restive otter
#

oh

#

can you link me the top.gg docs page for DSL webhooks?

sullen nymph
#

insert non-existent docs here

#

see pins

restive otter
#

thanks

lone comet
#

I just want to be clear, if I'm using discord.js I only need the client argument in the constructor, I don't need to do anything else?

sullen nymph
#

Probably dblapi.js

#

@lone comet Could you clarify what you want to use the DBL constructor for?

lone comet
#

To post server stats, sorry.

rapid kettle
#

You don’t.

#

DSL handles it

lone comet
#

???

sullen nymph
#

lmao 2 people just misunderstanding everything

#

Yeah, autopost will activate and post server count every 30 minutes if you pass the client in the constructor

rapid kettle
#

oH server stats made me think its DSL

#

fuck me

lone comet
#

Okay, good I see now.

restive otter
rich wyvern
#

how would I get the voting API to work with it connecting to a plain IP and port? I also dont know what to put for webhook Secret.

manic canyon
#

Is there a rate limit on setting your bot’s sever count via the API?

fleet pendant
#

hi

half cedar
#

my webhook for voting wont respond to anything when i test my code is

const Discord = require("discord.js");
const { prefix, token } = require("./config.json");

const client = new Discord.Client();
client.commands = new Discord.Collection();
const DBL = require('dblapi.js');
const dbl = new DBL('not-today', { webhookPort: 5000, webhookAuth: 'password', client });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});

dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});

dbl.on('posted', () => {
  console.log('Server count posted!');
})

dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})```
versed storm
#

probably better to ask in #support then, this is for API questions.

carmine prawn
#

ok

median badger
#

@half cedar it the ip open to the outside?

west idol
#

may i ask what these are for?

#
[2020-09-18 06:59:47] [INFO   ] aiohttp.access: [IP OMITTED] [18/Sep/2020:06:59:47 +0000] "GET / HTTP/1.0" 404 172 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3602.2 Safari/537.36"
[2020-09-18 08:14:09] [INFO   ] aiohttp.access: [IP OMITTED] [18/Sep/2020:08:14:09 +0000] "GET / HTTP/1.1" 404 172 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3602.2 Safari/537.36"
[2020-09-19 00:07:21] [INFO   ] aiohttp.access: [IP OMITTED] [19/Sep/2020:00:07:21 +0000] "GET / HTTP/1.1" 404 172 "-" "Mozilla/5.0 (compatible; Nimbostratus-Bot/v1.3.2; http://cloudsystemnetworks.com)"
median badger
#

Its a user agent

half cedar
#

@median badger yes the ip is open to the outside im using glitch.com

median badger
#

change port to 3000

#

and dont include the port in the dbl edit page

rapid kettle
#

gLITCH

tough oyster
#

Can someone help me, I cannot get the webhook to work when I use the webhook test. I have my server up and i know its working because I can see posts I send to it.

#

This is the code I am using, I removed the token and the full ip of my server, I cannot see the post from the test webhook on the discord site


import dbl


class TopGG(commands.Cog):
    """
    This example uses dblpy's webhook system.
    In order to run the webhook, at least webhook_port must be specified (number between 1024 and 49151).
    """

    def __init__(self, boi):
        self.boi = boi
        self.token = 'token'  # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.boi, self.token, webhook_path='http://ip-address.ngrok.io/dblwebhook', webhook_auth='password', webhook_port=5000)

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        """An event that is called whenever someone votes for the boi on top.gg."""
        print("Received an upvote:", "\n", data, sep="")

    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        """An event that is called whenever someone tests the webhook system for your boi on top.gg."""
        print("Received a test upvote:", "\n", data, sep="")


def setup(boi):
    boi.add_cog(TopGG(boi))
sullen nymph
#

webhook_path="/dblwebhook"

tough oyster
#

so I don't need to put the full address just /dblwebhook?

#

wow im an idiot, I didn't know I need to hit save before test

opal parcel
#

how i can add "shards" in my web bot?

rapid kettle
#

use dbl.postStats()

opal parcel
#

What does that mean

rapid kettle
#

dbl.postStats(<your guild count>, <current shard ID>, <total shard count>)

opal parcel
#
client.on('ready', () => {
    setInterval(() => {
        dbl.postStats(client.guilds.size, client.shards.Id, client.shards.total);
    }, 1800000);
});
#

this?

rapid kettle
#

thats outdated

opal parcel
#

so...

#

what ti do

#

idk

rapid kettle
#

i

#

i just gave an example

#

dbl.postStats(<your guild count>, <current shard ID>, <total shard count>)

keen gorge
#

what is a shard?

rapid kettle
true surge
#

How Do i get a api

trail sigil
#

@true surge regen your token

#

it's always a bad idea to send tokens anywhere

true surge
#

ok

tough oyster
dapper pulsar
#

.[

#

.p

tough oyster
#

Does anyone have this working on python?

opal schooner
#
    dbl.webhook.on('ready', (hostname: string, port: number, path: string) => {
        console.log(`Webhook running with path ${ path }`);
    });

    dbl.webhook.on('vote', async (bot: string, user: string) => {
        console.log(`User with ID ${ user } just voted!`);```
#

any idea why the parameters to the callback are returning undefined?

#

the listeners fire

#

but path and user are both undefined

opal schooner
#

nvm

#

types were updated last month

#

cos they were broken

#

lmaoooooo

wide needle
#

any1 can give me code so the bot dm u

willow spindle
#

No

wide needle
#

idk how yo explain it

willow spindle
#

Code it yourself

wide needle
#

i don't how

willow spindle
#

Then learn

wide needle
#

i have a stupid online class !

ruby yarrow
#

can I test votes without using webhook?

#

i guess thats dumb to say

#

maybe its a firewall thing

#

oh wait i was supposed to click save first...

#

bot now I'm getting this

line 275, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 523, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method
sullen nymph
#

Nothing important or fixable

#

You can ignore those tbh

restive otter
#

dbl.postStats(<your guild count>, <current shard ID>, <total shard count>)

scarlet river
#

@quartz heron where are you hosting your bot on?

jagged pine
#

Welcome to programming

austere orbit
#

vote.user returns a ID of user ?

restive otter
#

i think yes

#

or username

austere orbit
#

Ah

austere orbit
#
// VOTING PART //
const DBL = require("dblapi.js")
const dbl = new DBL("montokenwtf", { webhookPort: 5000, webhookAuth: 'password' })
dbl.webhook.on('vote', async vote => {
  const { inventory } = require("./models/indexModels")
  const userExist = inventory.exists({_id: vote.user})

  console.log(vote.user)
  console.log(client.users.cache.get(vote.user).username)

  if(userExist) {
    const data = await inventory.findOne({_id: vote.user})

    data.vote.package ++
    data.vote.cooldown = Date.now()
    data.save()

    client.users.cache.get(vote.user).send("Thanks for voting ! You won a package. See you next time ;)")
  }
})

It's not detecting it :/

rocky cape
#

for some reason today by bot isn't receiving vote webhook

austere orbit
#

@rocky cape How can you check vote when someone does it ?

#

Because it's not working now sueur

rocky cape
#

theres a webhook.on thing for it

austere orbit
#

@rocky cape Yes but it's not working

#

It should work

rocky cape
#

check your token is right

#

check your firewall is allowing the port

austere orbit
#

firewall ?

#

@rocky cape Should I do something other than this ?

rocky cape
#

check that your auth is correct

#

and i recommend using an express server as the webhookServer

#

instead of the built in on

austere orbit
#

Heuu

#

I have done something fast

#

In glitch

#

When I'm voting (test)

#

It's sending a post request

#

So that should be fine ?

#

@rocky cape

rocky cape
#

im not sure about glitch

#

i just used a web server

austere orbit
#

Heuuu yes But I can't host it xD

#

@rocky cape Can you show me an exemple ?

#

If you can

rocky cape
#

not sure about how to do it on glitch sorry

austere orbit
#

No

#

Just the code

#

So I understand

#

@rocky cape

rapid kettle
#

use express

austere orbit
#

I have done this

#
const express = require("express")
const app = express();


app.use(express.static("public"));

// https://expressjs.com/en/starter/basic-routing.html
app.get("/", (request, response) => {
  response.send("OK")
});

app.post("/dblvote", (req, res) => {
  console.log("Post from dblist")
  console.log(req.headers)
})

// listen for requests :)
const listener = app.listen(5000, () => {
  console.log("Your app is listening on port " + listener.address().port);
});
#

It's all I done

#

And in my bot

rocky cape
#

follow the guide on the api docs page

austere orbit
#

Yes but the webhooks.on doesn't work

#

In my I have done this

#
// VOTING PART //
const DBL = require("dblapi.js")
const dbl = new DBL("montokenwtf", { webhookPort: 5000, webhookAuth: 'mypassword' })
dbl.webhook.on('vote', async vote => {
  const { inventory } = require("./models/indexModels")
  const userExist = inventory.exists({_id: vote.user})

  console.log(vote.user)
  console.log(client.users.cache.get(vote.user).username)

  if(userExist) {
    const data = await inventory.findOne({_id: vote.user})

    data.vote.package ++
    data.vote.cooldown = Date.now()
    data.save()

    client.users.cache.get(vote.user).send("Thanks for voting ! You won a package. See you next time ;)")
  }
})
#

But still not working :/

#

I didn't understand what should i do exactly

runic timber
#

in discord js if I fetch a message, as in get one not in the cache, will I have access to the reactions of that message?

willow spindle
tardy nimbus
#

help i sharded my bot

#

how do i tell top.gg that i sharded

#

thanks

mental seal
#

how i found the "webhookAuth" ?

novel moth
#

do i need a dbl token to recieve server vote webhooks

willow spindle
#

No

austere orbit
#

@novel moth Use a a web server inside your discord project to interact betwenn discord.js and your server

restive otter
#

can i make a docs page for DSL api

willow spindle
#

there is no DSL api

restive otter
#

there is

#

@willow spindle there is one

willow spindle
#

where

restive otter
willow spindle
#

it is webhook, not api

restive otter
#

my brain hurts

silk echo
#

guys, I'm here trying to understand the api.
wanted to know how the bot sends in a channel to see who voted for the bot.

#

help me who can GWslippyPeepoH

restive otter
#

guys, I'm here trying to understand the api.
wanted to know how the bot sends in a channel to see who voted for the bot.
@silk echo waitWhatSpin

silk echo
#

I want my bot to say in the dm... Example: Thanks for voting me: D

restive otter
#

@silk echo detect who voted

#

Then dm the user

#

Done

#

The API provides a lot of info about who voted

silk echo
#

the more she doesn't send.

restive otter
silk echo
#

I think she can't find the user '-'

#

you understand me?

restive otter
#

yeah now

#

can you send the code?

silk echo
#

yeah

#

can I send the open source, or do I send only the code?

restive otter
#

can I send the open source, or do I send only the code?
@silk echo you send the part of the code that DMs the user when it detects a vote on DBL

silk echo
#

const client = new Discord.Client();
const dbl = new DcBL(process.env.dbltoken,
{
	webhookPort:5000,
	webhookAuth: process.env.senhadbl
});
dbl.webhook.on('vote', vote => {
	console.log(`User with ID ${vote.user} just voted! `);
client.users.cache.get(vote.user).send("Obrigada por votar em mim!")
});
#

I forgot to say that I changed the Dbl to dcbl

#

don't ask me why i did it '-'

restive otter
#

Lmfao

#

@silk echo does it log anything in the console when someone votes?

silk echo
#

nope

restive otter
#

@silk echo where is DcBl defined?

silk echo
#

Yes

#

is higher on the code '-'

restive otter
#

send it

silk echo
#
const express = require('express');
const talkedRecently = new Set();
const DcBL = require ('dblapi.js');
const { Client, Collection } = require('discord.js')
const Discord = require('discord.js');

const client = new Discord.Client();
const dbl = new DcBL(process.env.dbltoken,
{
	webhookPort:5000,
	webhookAuth: process.env.senhadbl
});
dbl.webhook.on('vote', vote => {
	console.log(`User with ID ${vote.user} just voted! `);
client.users cache.get(vote.user).send("Obrigada por votar em mim!")
});
#

😂

restive otter
#

imma head out

silk echo
#

and who will help me?

restive otter
#

@vapid cape ask these guys

slim hemlock
#

how to log who voted for server?

silk echo
#

more wait ...

rapid kettle
#

how to log who voted for server?
@slim hemlock have a server listening for POST requests.

slim hemlock
#

how?

#

@rapid kettle

rapid kettle
#

I use express

#

I can give you some basic code

slim hemlock
#

yeah sure pls

rapid kettle
#

ok

slim hemlock
#

so you mean i need to make a bot?

rapid kettle
#

yes with express integration

slim hemlock
#

Glitch?

rapid kettle
#

NO

slim hemlock
#

idk how to host bot 24/7 online lol

rapid kettle
#

using a VPS

slim hemlock
#

whats VPS? ik VPN

rapid kettle
#

it’s a virtual private server

slim hemlock
#

ah gotta look for it on yt first

rapid kettle
#

they go for about $3/month

slim hemlock
#

wtf bro any free plan?

rapid kettle
#

read

slim hemlock
#

bruhhh

#

my mom dad won't pay me for such stuff

rapid kettle
#

they aren’t expensive?

slim hemlock
#

still

rapid kettle
#

ok fine

#

at least use https://repl.it/

slim hemlock
#

it kinda seems known

rapid kettle
#

So, you wanted code right?

slim hemlock
#

yes

rapid kettle
#
const Discord = require('discord.js'); // basic require statements
const client = new Discord.Client();
const express = require("express")
const app = express()
app.use(express.json()) // this allows you to see the DSL post requests

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});
app.get("/", function(req, res){
  res.send("Alive!") // This will send the word "Alive" if you go to the link in your browser.
})
app.post("/", function(req, res){
const Auth = req.headers("Authorization") // This grabs the authentication code sent with the request
if(Auth !== "Your Auth Password")return // This stops all false POST requests.
console.log(req.body) /* This should return {user: "USERID", guild: "GUILD ID", type:"test OR upvote", query:"dont worry about this"} */
})

client.login('token'); // logs the bot in
#

you can do stuff with the body.

#

you could send a DM to the user

#

you could send a message to a channel

fiery pagoda
#

If the API sends a POST request to my URL, what would the body be?

#

never mind its okay

rapid kettle
#

@fiery pagoda which type of webhook?

fiery pagoda
#

bot

#

@rapid kettle

#

it should be:

{"user": "USERID", "bot": "BOTID", "type":"test OR upvote", "query": "something"}

right?

rapid kettle
#

I think so yea.

fiery pagoda
#

lemme see

strong yoke
#

Hey so I have a question according to the api and the votes.
it says: Bots should not be rewarding users for voting for another bot
But it's ok the reward them with f.e. Coins when they vote for my own bot?

fiery pagoda
#

Let's say you vote for Bot 1.

Bot 2 can't give you currency for voting for Bot 1.

#

But Bot 1 can give it's currency for someone voting for Bot 1.

strong yoke
#

OK thanks

fiery pagoda
#

what is the response if a bot gets a vote?

strong yoke
#

wdym what my bot sends?

#

is there a way to like imitate a Vote to check if my code works?

rapid kettle
#

the test button

bold magnet
#

Can someone help me with posting to webhooks with python?

strong yoke
#

Where's a test button I might be blind but I can't find one

#

ok nevermind I found it

patent cloak
#

what URL am I supposed to put in the "url" section on the webhook settings

jagged pine
#

http://yourVPSIP:port/dblwebhook

patent cloak
#

thank you

#

and if i wanted to test it on my local machine, i would just put in my public ip?

jagged pine
#

Yeah but you would need to adjust your router settings too

patent cloak
#

oof ok, ill just test it on a vps haha

formal current
#

at least use https://repl.it/
@rapid kettle that thing shows your code to everyone

#

use heroku.

restive otter
#

Repl will show your code, but if you create a .env file that you can hide your bot token in, you should be fine, as when other people acsess your repl they can't see .env files

formal current
#

alr but it doesn't stay 24/7

#

anyways, what vps hosting would you recommend

#

like paid one

#

for bot hosting

#

cuz I plan on buying one

rapid kettle
#

I use oxide

formal current
#

oh

rapid kettle
#

cuz i dont want any of us to be muted

formal current
#

alright.

pearl arch
#

hi. for some reason, I get a "cannot access client before initialization" error on the line where I put my DBL token. does anyone have any idea what's going on?
const DBL = require("dblapi.js");
const dbl = new DBL('token here', client);

willow spindle
#

where is client

viral veldt
#

client is your discord library

#

for me my client is client = new Eris(config.botToken)

cobalt rain
#

is there an api to fetch all available emojis (custom and non)

opaque jetty
supple ginkgo
#

speak spanish

quiet iron
#

How do you do voting detection when sharded?

#

@pearl arch you need to define client before you do new DBL(..., client)

#

nvm

jaunty cliff
#

hey

#

I have a question regarding dbl api

jaunty cliff
#

I am having few commands in my bot which are only accessible by the premium members but i want the premium command to be available for those who voted for my bot on top.gg!

#

is it possible to do so?

rapid kettle
#

@jaunty cliff use dbl.hasVoted(user ID)

onyx vine
#

anything change with the dblapi.js

#

is it dbl.postStats(servercount, [shard id], [total shards])?

#

bc mine isnt working

onyx vine
#

nvm its working now

onyx sundial
#

I'm doing it on the phone and bot desinger for discord Can someone who knows me if they need codes to turn on music and come to the audio room in the app

restive otter
#

BDFD GWseremePeepoGGERS

rain heart
#

Ikr

restive otter
#

bot designer for discord

#

ffs

#

an ANDROID APP

hybrid yoke
#

J

grand copper
#

helo

#

helo bandung

unique vessel
#

ok

thick viper
#

ok

#

This is not a place for singing, Revan.

wise cairn
#

Wads dis?

ionic abyss
#

an ANDROID APP
@restive otter ios to (;

restive otter
#

WHAT

ionic abyss
#

its on apple to

restive otter
#

@fiery pagoda there's a additional weird field called discord_bot that's a repeat of the vote payload

#

had to add that in to my validator, but yeah its not exactly whats documented

hasty mortar
#
client.on("ready", async () => {
  client.shard.fetchClientValues('guilds.cache.size')
    .then(results => {
        let food = (`${results.reduce((prev, guildCount) => prev + guildCount, 0)}`);
setInterval(() => {
  snekfetch.post(`https://discordbots.org/api/bots/stats`)
    .set('Authorization', `${dblToken}`)
    .send({ server_count: food })
    .then(() => console.log(`Updated top.gg server count`))
    .catch(err => console.error(`Whoops something went wrong: ${err.body}`));
}, 600000)
  }).catch(console.error)
})
#

Does this not work anymore? Apparently my server count is 700, but it should be 3500.

inner venture
#

@hasty mortar How many shards do you have

hasty mortar
#

5

inner venture
#

You're posting one shard's guild count as your bot's guild count

hasty mortar
#

Oh

#

But i thought that little fetchClientValues got all of em

inner venture
#

if you include the shard id+total in the post, dbl will automatically figure out the total for you

#

@hasty mortar

hasty mortar
#

But it does display how many shards i have

#

On the page as well

inner venture
hasty mortar
#

What the-

#

It said 700 servers with 5 shards before

#

This is weird

#

I know I'm not insane

#

I saw what I saw

#

Someone said it was cache related

queen fossil
#

@inner venture

inner venture
#

@queen fossil ???

#

why did you ping me

#

i wouldnt know

queen fossil
restive otter
#

@queen fossil please speed

queen fossil
#

I am not ful speaking English i am speaking kurdish

tardy sandal
#

@queen fossil it usually takes 4 - 6 weeks lmao

#

I've been waiting a month

restive otter
#

@tardy sandal it take 1 to 4 months

#

Also -api

kindred iron
#

1-4 months!? It says 5 weeks

restive otter
kindred iron
#

oh damn

tardy sandal
#

@restive otter it says 5 weeks

median badger
#

So 1-4 months

restive otter
willow spindle
#

so

restive otter
#

idk

grizzled coral
#

i submitted my bot like 11 weeks ago