#topgg-api

1 messages · Page 110 of 1

steel acorn
#

heroku

formal sparrow
#

Does it give you any IP or sub domain for your project or whatever you call it as

steel acorn
#

no

formal sparrow
#

Then it's not possible to use webhook afaik

#

If you can listen to a port, you probably should be able to get an IP for it tbh since if it's not public, it'd be allocated to you

#

Do you have access to terminal? @steel acorn

steel acorn
#

yes

formal sparrow
#

Is it linux?

steel acorn
#

no

formal sparrow
#

What is it?

#

Which OS

steel acorn
#

Windows

formal sparrow
#

I'm asking about your heroku app, not your PC if you're talking about your PC

steel acorn
#

heroku is a website.

formal sparrow
#

I know, I asked whether you have access to your app's terminal in your website, you said yes

steel acorn
#

I use github to place the bot files, and I use the visual studio code application.

formal sparrow
#

I'm talking about your host tbh, not GitHub nor your editor

#

If you find a way to get IP or buy a domain and link to your heroku app, then you'll put it in your bot's edit page

glacial rose
#

How can I make it to where someone votes for my bot it logs it in a channel

regal hill
#

shame that API token is unavailable until the bot is accepted

restive otter
#

Hello, how can I do so that I can put text in paragraphs in the same field for my embed messages?

fringe zephyr
#

thanks for that stack overflow link

#

i was also looking for that

#

sorry, i take my thanks back

#

didn't get what i was expecting

west wave
#

Hey, with dbl.py I don't understand what I need to write here :

def __init__(self, bot):
        self.bot = bot
        self.token = self.bot.config['dbl_token']
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path = '/dblwebhook', webhook_auth = 'password', webhook_port = 5000)

webhook_path, webhook_auth and webhook_port
(vote detection)

marble quiver
#

I've been having problems with dbl.js, It takes some time to identify a vote, and I know is the API beacuse I got a veryfier and it gives me false when I vote and in 5 more minutes i finally can get it true.

jaunty plank
#

you should really be using the webhooks to get when someone votes

boreal kelp
#

royal dock
#

is it possible to post the servercount without the library?

#

what for a url would I need to send data to and what data?

rapid kettle
#

It is, yes

royal dock
#

cool!

rapid kettle
royal dock
#

just post json there?

rapid kettle
#

Yea, server_count and idk shard count

#

don’t forget the Authorization header

royal dock
#

ok good! thanks matthew 😄

pale fulcrum
#

is it possible to use ipv6?

#

for a webhook

rapid kettle
#

I mean it should be?

#

it’s a real try it and see moment

pale fulcrum
#

ok

#

which lib is the js one?

#

dblapi.js?

rapid kettle
#

Yes

sullen nymph
#

@west wave webhook_path - route to use for the webhook, comes after the URL. Default value is /dblwebhook

webhook_port - port to run the webhook (listener) on

webhook_auth - password to use when requests are sent so that you can confirm that it's top.gg sending requests

west wave
#

Ok

#

Thanks

jovial kiln
#

Is the DBL api going to get comments/reviews added?

rapid kettle
#

by using DBL webhooks @restive otter

#

you can't really DM tho

#

you can

#

but you're likely to run into errors

#

just use a webhook

#

and use vote.user which is the ID

#

to fetch user

#

and then get ratelimited by discord kekw

wheat oar
#

Does DBL Webhook have an event for new reviews? Like this: dbl.webhook.on('review', review => {

rapid kettle
#

no

wheat oar
#

Ok thanks

rapid kettle
#

i mean at least i dont think so

wheat oar
#

Ok

patent lintel
#

im trying to post guild count in py ```py
import discord
import dbl
from discord.ext import commands

class TopGG(commands.Cog):
def init(self, bot):
self.bot = bot
self.token = 'token' # The token is correct
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)

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

def setup(bot):
bot.add_cog(TopGG(bot))``` But it doesn't work? How is bot defined?

#

is it bot = commands.Bot()?

#

or what

#

or is there anything else I'm doing wrong?

rapid kettle
#

bot is your client

#

i think

patent lintel
#

so bot = discord.Client()?

rapid kettle
#

it'd be your client that you use .run on

#

i think

patent lintel
#

ok wait we need to add client.run('bot token') at the end?

#

why would we need to run it?

rapid kettle
#

no?

patent lintel
#

oh

rapid kettle
#

you need your main bot client

patent lintel
#

wdym

rapid kettle
#

the one that logs in

patent lintel
#

wut?

rapid kettle
#

no

patent lintel
#

password is the auth

rapid kettle
#

its a password you make and put in the authorization section on the page

patent lintel
#

yeah

#

it can be anything

#

u make it up

#

@restive otter

#

and u put that password in the webhook auth section

#

you need your main bot client
@rapid kettle i still dont get it

#

wdym

#

what main bot client

rapid kettle
#

the one that you use in events

patent lintel
#

so that would be client

#

bot = discord.Client() ?

rapid kettle
#

yes i guess?

patent lintel
#

ok

#

still doesnt post

#

do i need to add client.run('token') at the end?

rapid kettle
#

are you running it already?

patent lintel
#

uh yeah

rapid kettle
#

then it should work

#

but i don't know python

patent lintel
#

aw ok

#

but for me it doesnt work

jaunty plank
#

If you have an http server already you put it there

#

If not, the library will make it for you and you can just delete that part

patent lintel
#
import discord
import dbl
from discord.ext import commands


class TopGG(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.token = 'token' # The token is correct
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)

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

def setup(bot):
    bot.add_cog(TopGG(bot))``` but apperantly setup is never getting called? How is it called, and how is bot defined?
#

no you cant use a discord webhook, you code your own webhook

#

read that

#

bot is the id of the bot

#

user is the id of the user that voted

#

isWeekend is if it is a weekend (if u want to give extra stuff on weekend)

#

uh u are logged in when you vote?

#

and it knows the id of the person who voted

#

NOO DUDE TOP.GG is sending a request

#

and that is the reques

#

t

#

they just added that as an example

#

but irl, top.gg will send a request

#

it explains everything

jaunty plank
#

Get the vote webhook.
On the event get the user via its id

#

Then user.send()

#

The fetching the user would be in your bot libraries docs

#

What language is your bot on?

#

Okay, on the page I linked to click javascript library

#

The second example shows how to use the webhook

#

Fetch the user with your bots library

#

Thats sending a message

#

Not fetching

#

The code example on the top.gg js docs is how to make the webhook

#

Get that part working first then you can worry about sending a message

#

The url is just
http://ip:port/path

#

Ip is the public ip, port is whatever you set in the code, same as path

rapid kettle
#

no

#

/dblwebhook if you didnt specify one

jaunty plank
#

Wheres the code your running hosted?

#

Ip will be the glitch url iirc.
Port youll have to use the env port variable glitch gives you

#

Glitch url that glitch provided.

#

I'm not sure, your the glitch user here

#

Yes

#

The environment port variable glitch provides

#

You can just use the environment variable

versed storm
#

Just a side-note: glitch doesn't allow bots on their service unless you're paying for it.

jaunty plank
#

^

#

Heroku is only 24 days a month now iirc

versed storm
#

Well that's certainly reason more to learn to use environment variables like process.env.PORT 👍

versed storm
#

where you want to use... the port

#

no...

#
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!`);
});

webhookPort is the port

patent lintel
#
def setup(bot):
    bot.add_cog(TopGG(bot))``` HOW DO WE DEFINE `bot`????
#

nothing seems to work

jaunty plank
#

bot as in the client?

patent lintel
#

no that doesnt work

#

bot = discord.Client() is what you are saying @jaunty plank

#

because that didn't work either

jaunty plank
patent lintel
#

ok

#

yes that is exactly what i said

#

bot = discord.Client()

jaunty plank
#

are you defining two clients?

#

because you want just one

patent lintel
#

no? But my bot is already running in another file

#

will that affect it?

jaunty plank
#

well, the library depends on it being the bots actual client, it can be a separate process, but it needs to be an actual client.

patent lintel
#

but if not discord.Client(), then what else

jaunty plank
#

it should be discord.Client() but the client needs to be a logged in instance of your bot

#

hows it work for you if you dont have a verified bot 🤔

restive otter
#

alt GWseremePeepoThink

acoustic dove
#
def setup(bot):
    bot.add_cog(TopGG(bot))``` HOW DO WE DEFINE `bot`????

@patent lintel that's a cog

#

Are you initializing it "on_ready"?

#

You would use load_extension("cogs/TopGG") assuming your py file is named TopGG.py

#

In your main bot file

mortal onyx
#

Or you could put this in your main.py file

for filename in os.listdir('./cogs'):
    if filename.endswith('.py'):
        bot.load_extension(f'cogs.{filename[:-3]}')
#

That would load it whenever you start up the bot, along with all the other cogs.

restive otter
#

Is there a rating API?

jaunty plank
#

rating api?

jovial kiln
#

you mean rate limit?

#

Read the last tab of the docs if so

tranquil sphinx
#

How would I make it log to the console when my bot gets a vote? I tried that example code on the documentation but it didn't work.

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

jovial kiln
#

member intent only to find member tho?

#

What about finding user?

#

@scarlet cobalt

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

jovial kiln
#

You can't fetch a user from the client without guild member intent?

scarlet cobalt
#

One message removed from a suspended account.

jovial kiln
#

nor did I but it isn't working so

#

That is why I confusion

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

jovial kiln
#

Meanwhile homie is certified

scarlet cobalt
#

One message removed from a suspended account.

jovial kiln
dry hawk
#

members intent should only cover getting an entire guild list from the api, you can still get individual members from it

hollow barn
#

does the dbl.on('posted') automatically update servers or should I put this within a guildCreate? Thanks

jaunty plank
#
dbl.on('posted', () => {

});

is just an event for when the server count was posted, you shouldnt put events in other events.

#

the auto poster posts every 30 minutes.

hollow barn
#

okay I'll try that

#

thanks

mental sky
#

{
success: boolean,
approved: boolean,
message: string,
}

twin vine
#

🤔

trail parrot
#

Hello

proud shell
#

there

sullen nymph
#

See channel topic

formal sparrow
#

@willow sphinx any updates about the PR? I've signed the commit, just waiting for your approval and merge tbh, I don't think I have to do anything else

cursive steppe
#

Can someone help me?
My bot server isn't isn't being sent to website

rapid kettle
#

client.guilds.cache.size

hearty lintel
golden adder
#

Ok i'm sorry to ask this since it's probably been asked before. Will there be a review webhook added to the api?

hearty lintel
#

probably™️

grizzled hollow
#

whats the tm for lmao

quaint pendant
#

i have the code ```import dbl
import discord
from discord.ext import commands, tasks

class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""

def __init__(self, bot):
    self.bot = bot
    self.token = 'token'
    self.dblpy = dbl.DBLClient(self.bot, self.token)

@commands.Cog.listener()
async def on_dbl_vote(self, data):
    print(data)

def setup(bot):
bot.add_cog(TopGG(bot))```
why doesnt this work?

jaunty plank
#

whats not working

restive otter
#

@quaint pendant use pipedream

quaint pendant
#

whats that

restive otter
frigid crater
#

hey, im trying to create a vote webhook thingy, but the code provided in the js docs isnt working, am i missing something or what? also i am not very good at js so that might be part of it.

jaunty plank
#

is there an error?

frigid crater
#

nope

#

nothing happens

jaunty plank
#

did you fill in the webhook url on your bots page?

#

along with the correct auth

frigid crater
#

i have filled in the webhook url, but i havent filled out the auth

jaunty plank
#

the auth needs to be the same as the auth in your code

#

webhookAuth: 'password'

#

both need to be the same

frigid crater
#

so i get to choose the password or am i stupid and it is predefined

jaunty plank
#

you choose it

frigid crater
#

alr

jaunty plank
#

also, just a few things.
if your hosting off a home network or not from a proper server, youll need to port forward.
if you have a firewall on your server youll need to open the relevant port open

frigid crater
#

alr

#

thanks!

feral marlin
#

im using the discord.py library and trying to get some sort of voting notification system. I'm having lots of trouble with this and help would be aprechiated :)

curent code:

from discord.ext import commands

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, bot):
        self.bot = bot
        self.token = 'dbl_token' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/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 bot on top.gg."""
        self.bot.console_webhook.send(f"Received a upvote:\n{data}")

    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
        self.bot.console_webhook.send(f"Received a test upvote:\n{data}")


def setup(bot):
    bot.add_cog(TopGG(bot))
patent loom
#

how does the dblapi.js webhook work

jaunty plank
#

when a vote happens, top.gg sends a post request to an http server at the url set in the webhook section of the bot with the relevant info

#

you can think of it like requesting data from an api, but in reverse.
rather than sending an api request asking if theres any new votes, when a new vote happens top.gg sends the data to you.

timber latch
#

After coming in section i feel like WTF am i doing with my life

#

:P

rigid marsh
#

.trade cancel

mighty wharf
#

how do i set up the voting event?

#

i have troubles with setting up the webhook

#

because i dont know how to use webhook on the discordgg

mighty wharf
#

how do i even find the webhook password or auth or authorization

#

this is so fucking complicated

#

ive been sitting on it for a hour and nothing is working

twin vine
mighty wharf
#

yeah ive already seen it its just that what i took from the example (```Python
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='auth', webhook_port=5000

needs path (which im not sure what is it, auth which i dont know what is it either and port 
where they share just the ip and not the port
twin vine
#

oh you use python

mighty wharf
#

yup

twin vine
#

hmm

#

port should be the port your bot uses

#

to host the webhook

#

and for example

#

if you hosted your webhook at 127.0.0.1/dbl/webhook then the path should be /dbl/webhook

#

if you understand what i mean

mighty wharf
#

ehhh im not technically hosting the webhook, im using a site called pipedream to host it
and the url is https://(random code).m.pipedream.net

#

so does it means that the path is (random code).m.pipedream or did i miss anything?

#

also if we solve it theres still the auth parameter that i cant figure either >_<

restive otter
#

I have problem (javascript)

#

I have code:

client.dbl.hasVoted(message.author.id).then(voted => {
            if(!voted) return message.reply('vote on top.gg')            
        });
// command

#

why command is running?

twin vine
#

wrong channel

lapis kestrel
finite moat
#

Yes

jovial kiln
#

Still works fine

restive otter
#

i need help

#

pls help me

#

.setImage("https://top.gg/api/widget/697348519295713302.png?usernamecolor=FFFFFF&topcolor=000000") isnt sending image

fluid siren
#

I think you have to put this on sendmessage

restive otter
#

@fluid siren heres my whole code const Discord = require("discord.js"); module.exports = { name: "dblinfo", execute(client, message, args) { const exampleEmbed = new Discord.MessageEmbed() .setDescription(`:teslabot: ‎‎**[VOTE FOR TESLA BOT ON DBL](https://top.gg/bot/697348519295713302/vote)**`) .setImage("https://top.gg/api/widget/697348519295713302.png?usernamecolor=FFFFFF&topcolor=000000") .setColor(0x0b0b0b); message.channel.send(exampleEmbed); } };

fluid siren
#
  .attachFile('https://top.gg/api/widget/697348519295713302.png?usernamecolor=FFFFFF&topcolor=000000')
  .setImage('attachment://697348519295713302.png');
#

try this

jaunty plank
quaint veldt
stuck loom
#

so

#

to reward-

#

hhhhhhh

#

that counts as server ads

quaint veldt
#

You aren't a moderator

#

How will u help me

stuck loom
#

because my good sir/ma'am

quaint veldt
#

Bruh

#

Ok

stuck loom
#

i know how the api works

quaint veldt
#

Go there

#

Vote also plz

stuck loom
#

no lmao

quaint veldt
#

:)

stuck loom
#

@craggy sentinel ads

quaint veldt
#

Why did u want my link then

jaunty plank
#

Inb4 muted

quaint veldt
#

I am just confused

stuck loom
#

i didn't ask for your link

#

i said go here so i could help you.

quaint veldt
#

That is why I wanted a moderator

craggy sentinel
stuck loom
#

to ask for your link so they could vote?

#

hhhh

#

marco

jaunty plank
#

I was confused to. This question has nothing to do with the api

#

Dsl isn't part of the api

stuck loom
#

,,,

#

he didn't say dsL

#

He jUdsT SaId HeLp

jaunty plank
#

He didn't have to

#

His questions about his server

#

It has to go through dsl

stuck loom
#

sand he said voting so i thought it was about there api for getting votes.

jaunty plank
#

Nope, just dsl for servers

stuck loom
#

my bad hhhh, that was my fault

craggy sentinel
#

(there is also a webhook option for DSL but yea - if someone is mentioning role rewards then its usually the option directly via DSL)

stuck loom
#

okay, thank's i will add that to my help folder when my pc starts up

jaunty plank
#

Been here so long, never seen that once mentioned. I wonder what percentage of servers use the webhook.

stuck loom
#

Been here so long, never seen that once mentioned. I wonder what percentage of servers use the webhook.
@jaunty plank thats why i said aPi

jaunty plank
#

Its never been used for roles before

#

🤔

#

Otherwise you'd be making a bot to give roles

stuck loom
#

no

#

you can make a api to interact with dsl api

#

for there webhook

jaunty plank
#

Which would be a bot

stuck loom
#

not really

#

actually wait

#

this is why your dev senpai

jaunty plank
#

Not like dev role means anything

stuck loom
#

no

#

i say dev senpai because

#

you like point out my errors and stuff

#

you would need a bot to interact with the dsl api to give the role

#

in my hea di imagined you could make a api and use http;s request to pull people who vote and use the api wrapper to give the wole

#

sorry if my spelling is aids i'm typing faster then i normally do

jaunty plank
#

Coffee?

stuck loom
#

yeah

#

I'd like that lmao

#

brb

jaunty plank
#

I've been buying preground beans since Rona started. Miss good coffee :(

cyan terrace
#

can someone help me setup a webhook to know when someone votes?

jaunty plank
#

depends on what lib you are using

cyan terrace
#

depends on what lib you are using
@jaunty plank none-

#

BDFD

#

well JavaScript could be made

#

ima have to think x3

distant oak
#

Mamamia

jaunty plank
distant oak
#

I think you cant do vote system on BDFD

cyan terrace
#

The thing is that i dont know javascript, i barely learned like 20% :v

jaunty plank
#

I dont either. but I dont think they provide a public url or ip for top.gg to reach

dreamy sky
#
                .token("asdasd")
                .botId("dasdas")
                .build();

        top.setStats(api.getServers().size()); ```
I did this...But what did now change for the Bot on the Website?
#

someone there?

jaunty plank
#

🤔

dreamy sky
#

Should it show on the Website on how many Servers my Bot is?

jaunty plank
#

yeah

dreamy sky
#

ok...Mby it has to load a couple of minutes

jaunty plank
#

it can take up to 30 minutes to an hour due to caching.

dreamy sky
#

And how can I set the DND on the Website on Online?

#

it can take up to 30 minutes to an hour due to caching.
@jaunty plank ok

jaunty plank
#

new bots are not added to this server anymore, so their online status isnt tracked from what I understand.

#

not sure why your bot would show up as dnd

dreamy sky
#

my Bot is on this Server

#

ah nvm

#

or wait

#

api.getThreadPool().getScheduler().scheduleAtFixedRate(() -> top.setStats(api.getServers().size()), 1, 120, TimeUnit.SECONDS);

#

Is that too often?

#

It sends the Server size every 2 min

#

@jaunty plank ?

wheat copper
#

Does it need to send that often??
Check docs for any limits on how frequently you can send...

jaunty plank
#

you should really be doing it once every 30 minutes

#

since your guild count shouldnt change often enough to need more than that

dreamy sky
#

you should really be doing it once every 30 minutes
@jaunty plank ok

fast meteor
#

i may be making some stupid mistake but is it possible to get data from votes for a bot from a different bot? im trying to test a vote-for-currency feature (on my beta testing bot) but it uses the token of the real bot. is this a problem?

#

its just it doesnt seem to recognise votes

#

i.e. nothing happens when ppl vote

jaunty plank
#

are you using a webhook?

knotty oak
#

hi

fast meteor
#

im using the python library:

#this line is in the init:
  self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=False)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
  #some stuff
#

sorry im probably missing something big here

jaunty plank
#

on your bots page, edit in the webhook section did you fill in the auth and url?

dreamy sky
#

Does it need time to recieve my ServerCount information?

fast meteor
#

on your bots page, edit in the webhook section did you fill in the auth and url?
@jaunty plank oop no

#

but what url?

#

and what auth

dreamy sky
#

Does it need time to recieve my ServerCount information?
@dreamy sky ?

jaunty plank
#

the url to your webhook,
http://ip:port/path

fast meteor
#

but i thought you didnt need that if you use the on_dbl_vote?

#

i.e when theres a vote, it receives it

#

and i can do stuff with the data param

jaunty plank
#

it should have shown up for you by now @dreamy sky
I dont know the language your bot is in, but can you log any errors that may be happening?

#

the on_dbl_vote is a webhook listener

dreamy sky
#

it should have shown up for you by now @dreamy sky
I dont know the language your bot is in, but can you log any errors that may be happening?
@jaunty plank no errors and JAVA

fast meteor
#

the on_dbl_vote is a webhook listener
so whenever someone votes for the bot, it sends it to a webhook url. then the webhook listener hears that and knows theres a vote?

jaunty plank
#

yeah

fast meteor
#

so do i need to declare something in the code

jaunty plank
#

the self.dblpy needs to be filled in
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
and the

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        logger.info('Received an upvote')
        print(data)

stuff needs to exist

fast meteor
#

ahhh ok thx

#

so my webhook url could be a discord webhook?

jaunty plank
#

no, top.gg webhooks dont work with discord

fast meteor
#

ok so it needs to be the ip of the server im running my bot on

jaunty plank
#

you are filling in the token and bot id correctly right @dreamy sky ?

#

yes

fast meteor
#

could it be localhost?

jaunty plank
#

no, it cant be localhost

#

it has to be the actual ip, or domain

#

otherwise top.gg would be sending it to themselves

fast meteor
#

yeah

jaunty plank
#

which, admittedly kinda funny.

fast meteor
#

yeah

#

ok thanks

dreamy sky
#

you are filling in the token and bot id correctly right @dreamy sky ?
@jaunty plank yes

jaunty plank
#

honestly, i am not sure then.

fast meteor
#

ok im really confused about this webhook thing

#

would http://my.ip.address work as the webhook url

stuck loom
#

i'm not quite sure

jaunty plank
#

its
http://ip:port/path

fast meteor
#

wdym /path

jaunty plank
#

so for example
http://0.0.0.0:5000/dblwebhook

#

the path

fast meteor
#

why does it need a path

jaunty plank
#

it doesnt have to have a path, you can make your path empty.

#

giving it a path may be useful, it may not be 🤷‍♂️

fast meteor
#

ok thx

stuck loom
#

it's one of those possibility things

fast meteor
#

possibility things?

jaunty plank
#

it makes sense to have a path

fast meteor
#

but why

#

what does it do

stuck loom
#

it's not needed

#

but it is recommended

#

that's what i ment by possibility things

jaunty plank
#

if you wanted to have something else on the server, for example another webbook receiver you can put it on its own path.

fast meteor
#

ahhhh

jaunty plank
#

theres no reason not to use one

fast meteor
#

so its for differentiating

jaunty plank
#

yeah

dreamy sky
fast meteor
#

yeah

#

ok i really cant see what ive done wrong here:

#in init
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='http://my.ip.address:5000/dblwebhook', webhook_auth='password', webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_test(self, data):
  #some stuff
#

the webhook url and auth matches the one i put on the website

#

and i have pressed "test" a load of times

#

none of them work

jaunty plank
#

the path should just be the path

#

'/dblwebhook'

#

not the entire url

fast meteor
#

oh

#

k

#

thx

jaunty plank
#

also, if this is hosted on a home network, the port will need to be portforwarded.
If you have a firewall the port will need to be opened aswell.

fast meteor
#

ok that still doesnt work

#

oh yeah

#

portforwarding

#

oop

#

can i set the port to a different one?

#

one that i have already set up port forwarding on?

jaunty plank
#

yeah any valid port

fast meteor
#

nice

jaunty plank
#

if the port is in use already by another program it wont work

fast meteor
#

yeah

restive otter
#

How do i create a vote command?

#

And it'll give rewards

meager hazel
#

How does the authentication works in the DSL?

rapid kettle
#

Gets sent in a header

meager hazel
#

Ok, thx

west knot
#

is there any guide on how to make a discord bot give players who vote for a discord server, a role for 24 hours after they vote?

#

or just give them a vote role in general

#

Ping me when you respond please./

jaunty plank
#

The dsl bot will give a role for 13 hours if you configure it to.

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

warm tapir
#

just finished making it so you can see my bots server count on top.gg it was very easy!

jaunty plank
#

ay, saddly its quite hard for some. glad it was easy for you however.

timber latch
#

Can some1 tell me where can i see the bots which i uploaded on top.gg

warm tapir
#

ay, saddly its quite hard for some. glad it was easy for you however.
@jaunty plank Thank You!

steep skiff
#

How do you make it like whenever the bot gets a vote the bot dms the user who voted

#

In python

warm tapir
#

Idk

#

Just look at the doc website

#

Should explain it

mighty wharf
#

when i use the API from the browser it lets me use it but when i use it from my code it returns {'error': 'Unauthorized'}

#

so i read that Authentication is performed with the Authorization HTTP header in the format Authorization: TOKEN but i am not sure how to use it

restive otter
#

hello I added my bot to top.gg but it's still not accepted. Can you help me? <@&695153281105920070>

restive otter
#

🤦‍♂️

restive otter
#

why using 🤦 emoji

#

@restive otter

rain heart
grizzled sundial
#

I mean I've seen it but i don't quite understand how to use those classes with get_user_vote attribute

dim nebula
#

sg!vote

random kindle
#

I need help.

rain heart
#

What do you need?

random kindle
#

How do I send a message to a channel via the dbl.webhook.on function?

stuck loom
#

is there a way to get the total vote count for a bot

#

like if a bot has 50 votes is there a way to get the total vote count (being 50) and post it and each time someone new votes (ex: 50 - 51) it auto update so instead of still saying 50 votes it says 51

#

@jaunty plank hhhh dev senpaii

hidden aspen
#

places SEX DM

tender ice
#

^nani

neon stirrup
#

If you aren't logged in and try to vote

#

you are forced to watch an ad

#

then login

#

then watch an ad

#

then you can vote

jaunty plank
#

I think they are trying to fix that

stuck loom
#

@jaunty plank halpp

jaunty plank
#

What

stuck loom
jaunty plank
#

So you want to get the vote count then get every vote aswell?

#

To count up

sudden flare
#

im constantly getting 503

#

i think its from website's side but no one else seems to be having this issue

#

so im worried that it might be related to me

jaunty plank
#

Its the server.
You should try catching the 503 errors.

sudden flare
#

im catching it

sacred spire
#

im constantly getting 503
@sudden flare me too

jaunty plank
#

Site is down

#

Everyones getting them

sacred spire
#

Oh

#

K

sudden flare
#

not the site

#

the backend server probably

#

site is up for me

jaunty plank
#

Both have been up and down for awhile

sudden flare
#

I see

#

should we inform a team member?

#

or they're aware?

jaunty plank
#

They know. I think they are the ones taking them down fixing bugs tbh.

sudden flare
#

I see

#

alright

grizzled sundial
#

Is it possible to use get_user_vote in a regular command?

jaunty plank
#

sure

random kindle
#

How do I send a message to a channel via the dbl.webhook.on function?

jaunty plank
#

inside that event, get the relevant channel via whatever method you like then channel.send

steel terrace
#

How do I send a message to a channel via the dbl.webhook.on function?
@random kindle you using eris or discord.js?

#

and are you running the bot on your local host or on a VPS?

hot axle
#

Hmm

#

Is it possible to do something like test votes?

steel terrace
hot axle
#

Oh alright

#

Thx :D

steel terrace
#

anytime

formal pollen
#

-p pergi hilang dan lupakan

ancient kindle
#

Is there an api for dsl?

#

cuz all I see is for dbl

sullen nymph
#

There isn't one

ancient kindle
#

awh

#

ok thx

thorny thicket
#

hello, I need some help with setting up upvote webhook.
In webhook URL Do I put discord webhook url?
and my token in Authentication?

grizzled sundial
#
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000021927AD4C08>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x0000021927AF0978>, 623430.703)]']
connector: <aiohttp.connector.TCPConnector object at 0x0000021927AD4D48>

what's this error about

thorny thicket
hidden wave
#

@thorny thicket it triggers the voting webhook

civic beacon
#

what does it do

thorny thicket
#

But It doesn't log anything : @hidden wave ```js
dbl.webhook.on('vote', vote => {
console.log("Vote Triggered!");
console.log(vote);
// Do what you need to do
});

#

I used dbl.postStats and it worked perfectly

#

but i am having trouble with webhook

#

It also logged Webhook running at http://0.0.0.0:5000/dblwebhook on ready event

civic beacon
#

/////

const DBL = require('dblapi.js');
const dbl = new DBL('eyJhbGciOiJIUzI1NiIsIXXXXXXXXJ9.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.1UhYEc7K-lyIL-ph0ygx0m58q_sXXXXXXXXfv62jUw', { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook: http://${hook.hostname}:${hook.port}${hook.path}`);
})
dbl.webhook.on('vote', vote => {
      client.channels.get('742147798115418162').createWebhook(vote.user.username)
    .then(webhook => webhook.edit(vote.user.username)
        .then(wb => {
            const hook = new Discord.WebhookClient('eyJhbGciOiJIUzI1NiIsIXXXXXXXXJ9.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.1UhYEc7K-lyIL-ph0ygx0m58q_sXXXXXXXXfv62jUw', wb.id, wb.token);

  hook.send(`\`${vote.user}\` Oy verdi!`);
  hook.delete()
}))
          });```
//////
#

is it true

#

?

jovial kiln
#

cache

#

call the cache not channels

civic beacon
#
const authorizationKey = '',
      webhookID = '',
      webhookToken = '';

const express = require('express'), // 
      app = express(), // 
      bodyParser = require('body-parser'), // 
      morgan = require('morgan'), // 
      { RichEmbed } = require('discord.js'), // 
      { WebhookClient } = require('discord.js'), // 
      hook = new WebhookClient(webhookID, webhookToken); 

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(morgan('combined'));

app.post('/vote', (req, res) => {
    var authorization = req.headers.authorization;
      
    var bot = req.body.bot;
    var user = req.body.user;
    var type = req.body.type;

    if (!bot || !user || !type || !authorization) {
        res.setHeader('Content-Type', 'text/plain'); 
        res.statusCode = 403;
        return res.end('MISSING_PARAMS'); 
    };
      
    if (authorization != authorizationKey) {
        res.setHeader('Content-Type', 'text/plain'); 
        res.statusCode = 403;
        return res.end('WRONG_SECRET'); 
    };

    if (type === 'upvote') {
        var embed = new MessageEmbed({
            color: 3447003,
            title: `Yeni bir oy alındı!`,
            description: ` bota DBL üzerinde bir oy verdi!`,
            timestamp: new Date()
        });
        
        hook.send({ embeds:  });

        res.statusCode = 200; 
        return res.end('OK');

    } else if (type === 'test') {
        var embed = new MessageEmbed({
            color: 3447003,
            title: `Başarılı!`,
            description: `DBL test başarılı Votehook düzgün şekilde çalışıyor!`,
            timestamp: new Date()
        });
        
        hook.send({ embeds:  });

        res.statusCode = 200; 
        return res.end('OK');

    }

})```
jovial kiln
#

tf

hidden wave
#

@thorny thicket

thorny thicket
#

yes?

hidden wave
#

did you try adding this to the code?

        if (client.uptime) {
            client.users.fetch(vote.user).then(user => {
                user.send("Thanks for voting!! your vote means so much to us!")
                client.channels.fetch('Channel ID').then(channel => {
                    channel.send(`Thanks for voting!! ${user.tag} your vote means so much to us!`)
                })
            })
        }
    });```
civic beacon
#
const authorizationKey = '',
      webhookID = '',
      webhookToken = '';```
#

What should I write in these parts?

hidden wave
#

if it says client is undefined then change client to bot @thorny thicket

thorny thicket
#

Nothing

#

I click on test and this pops up

#

but nothing in console

hidden wave
#

then add this

        console.log(`Oops! ${e}`);
    })
    dbl.webhook.on('ready', hook => {
        console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
    });
    dbl.webhook.on('vote', vote => {
        if (client.uptime) {
            client.users.fetch(vote.user).then(user => {
                user.send("Thanks for voting!! your vote means so much to us!")
                client.channels.fetch('Channel ID').then(channel => {
                    channel.send(`Thanks for voting!! ${user.tag} your vote means so much to us!`)
                })
            })
        }
    });```
thorny thicket
#

i'll just add the err event, I already have other one.

hidden wave
#

then add

        console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
    });
    dbl.webhook.on('vote', vote => {
        if (client.uptime) {
            client.users.fetch(vote.user).then(user => {
                user.send("Thanks for voting!! your vote means so much to us!")
                client.channels.fetch('Channel ID').then(channel => {
                    channel.send(`Thanks for voting!! ${user.tag} your vote means so much to us!`)
                })
            })
        }
    });```
thorny thicket
#

nothing.. no error

hidden wave
#

how about you replace client with bot since you use VSC

thorny thicket
#

what's the difference?

hidden wave
#

i don't use VSC so idrk

thorny thicket
#

that's not the problem

hidden wave
#

i use glitch

#

ok

thorny thicket
#

I have to use Discord Webhook URL in Webhook URL right?

hidden wave
#

no

#

ohhh wait that's what ur problem is about

thorny thicket
#

starting with https://discord.com/api/webhooks/.....

#

no?

hidden wave
#

wait brb i gotta do smth irl

civic beacon
thorny thicket
#

yes

#

??

jovial kiln
#

It’s fine

#

Still works

#

Dw

thorny thicket
#

Can you tell me what Webhook URL I have to put?

#

The one starting with https://discord.com/api/webhooks/..... ??

restive otter
#

the url

#

just put the url there

thorny thicket
#

But it's not working, idk what am i doing wrong here

hidden wave
#

the wrong that you are doing is that you are putting a discord webhook as your Webhook URL @thorny thicket

#

you cant use a discord webhook as your webhook URL

thorny thicket
#

what do I put there?

hidden wave
thorny thicket
#

http://0.0.0.0:5000/dblwebhook

#

like this?

hidden wave
#

yea

thorny thicket
#

ohkk

hidden wave
#

so did it work? @thorny thicket

thorny thicket
#

no
i dont think http://0.0.0.0 will work

hidden wave
#

http://0.0.0.0 is your local host, you gotta replace 0.0.0.0 with your public IP

thorny thicket
#

yes

thorny thicket
#

@hidden wave will it always show http://0.0.0.0 in my console?

#

I entered http://<my IP v4>:5000/dblwebhook in url

#

I tested an online webhook tester and it's sending data to that one.

hidden wave
#

@hidden wave will it always show http://0.0.0.0 in my console?
@thorny thicket it should show http://0.0.0.0:5000/dblwebhook on your console

thorny thicket
#

yes

#

it is

hidden wave
#

Then your webhook should be working

hidden wave
#

@thorny thicket is it working or...

thorny thicket
#

nope @hidden wave

stuck loom
#

then add

        console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
    });
    dbl.webhook.on('vote', vote => {
        if (client.uptime) {
            client.users.fetch(vote.user).then(user => {
                user.send("Thanks for voting!! your vote means so much to us!")
                client.channels.fetch('Channel ID').then(channel => {
                    channel.send(`Thanks for voting!! ${user.tag} your vote means so much to us!`)
                })
            })
        }
    });```

@hidden wave can this be used to add a role to it?

#

like ```js
client.guilds.fetch("guild id").then(role => {
client.guild.roles.find(r => r.name ("role
name").then(client.users.fetch(vote.user), role)
}

#

probally coded that full of errors lmao

thorny thicket
#

is there any way to check id webhook is created successfully?
idk if i am putting URL wrong or there's some problem in my webhook

stuck loom
#

you could make it log the webhook on start

#

like ooh webhook was created sucessfully with id and ect

latent narwhal
#

Hey there

blissful sigil
#

sa

stuck loom
#

@latent narwhal look at the code above the one i quoted

latent narwhal
#

Umm

#

I already have my code

thorny thicket
#

Guys my webhook is not working.. it's not getting data from api

#

do I have to change port number or make any other changes? any suggestions?

subtle wren
#

How can I send a message to a channel when the user has voted? for discord.js

royal rampart
#

Is there currently an error with the discord API, or discord itself or is it just me?

soft salmon
#

Is there currently an error with the discord API, or discord itself or is it just me?
@royal rampart discord was having issues it's fixed now dw

royal rampart
#

just seen it, thx

#

How can I send a message to a channel when the user has voted? for discord.js
@subtle wren get API from the vote page, create an event, in the event get the channel where you want to send it in by id, and send the message

thorny thicket
#

Which port you guys use for webhook?

#

Default one?

jaunty plank
#

I use 6565 i think or 6468 or something. I really haven't paid attention.

#

I just chose a port since I already had 5000 in use for something else

thorny thicket
#

When I use any webhook tester website url it works fine and I get vote JSON on that website
But it's not working when i host website on my PC 😂

jaunty plank
#

Are you port forwarding on your home pc?

thorny thicket
#

URL sould be https://<ip v4>:<port>/<path>?

jaunty plank
#

If you have a firewall are you opening that port.

#

Yeah

#

Http if your not configuring ssl

#

But yeah

thorny thicket
#

I checked and that port is open and listening

jaunty plank
#

And did you port forward.

thorny thicket
#

Nope

jaunty plank
#

Gotta do that

thorny thicket
#

How?

jaunty plank
#

Depends on your router model

#

Each one its diffrent.

thorny thicket
#

I have my bot on vps, do I have to do same thing on vps?

jaunty plank
#

No

#

Only on home networks or non server networks

thorny thicket
#

It's also not working on vps.. what am I missing?

#

I didn't checked if port is open on vps

fast meteor
#

is the python library/api compatible with dpnp?

#

for the webhooks

#

cos the router where my bot is running cant do normal port forwarding

subtle wren
#
dblhook.webhook.on('ready', hook => {
  console.log(`Webhook: http://${hook.hostname}:${hook.port}${hook.path}`);
})
dblhook.webhook.on('vote', vote => {
      client.channels.cache.get('769725160118550558').createWebhook(`deneme`)
    .then(webhook => webhook.edit(`deneme`)
        .then(wb => {
            const hook = new Discord.WebhookClient(dbltoken, wb.id, wb.token);

  hook.send(`\`deneme\` Oy verdi!`);
  hook.delete()
}))
          })``` its true? @royal rampart
jaunty plank
#

What is dpnp? @fast meteor

royal rampart
#
dblhook.webhook.on('ready', hook => {
  console.log(`Webhook: http://${hook.hostname}:${hook.port}${hook.path}`);
})
dblhook.webhook.on('vote', vote => {
      client.channels.cache.get('769725160118550558').createWebhook(`deneme`)
    .then(webhook => webhook.edit(`deneme`)
        .then(wb => {
            const hook = new Discord.WebhookClient(dbltoken, wb.id, wb.token);

  hook.send(`\`deneme\` Oy verdi!`);
  hook.delete()
}))
          })``` its true? @royal rampart

@subtle wren I have not worked with the top.gg API yet, so I can't tell you if that is correct or not. As an alternative way, you could also just make your own bot send the notifications instead of a webhook.

thorny thicket
#

what should I put in Internal IP?

jaunty plank
#

The internal ip of the system the codes running on

thorny thicket
#

it's not accepting my ip 😂

jaunty plank
#

The internal ip?

thorny thicket
#

this should be internal IP.. right?

jaunty plank
#

Yeah

#

Not sure why it wouldnt

thorny thicket
#

maybe cuz i'm connected to secondary router.

jaunty plank
#

Also, port 21 is already registered to ftp officially.
Theres nothing wrong with using 21 if you dont need ftp, but just be aware its technically standard for 21 to be for ftp.

thorny thicket
#

logged in 192.168.0.1 instead of ...0.0
Maybe that's why it's showing : Internal IP and LAN IP must be in the same segment network

earnest apex
#

i have an bot to now

thorny thicket
#

@jaunty plank also, I need to forward only for TCP right? or both UDP & TCP?

jaunty plank
#

Should be TCP

thorny thicket
#

okk

#

are you sure that if I click on test it'll trigger dbl.webhook.on('vote' event? 😂

#

i tried everything.. NO LUCK

#

@jaunty plank I have to enter my "external IP" in webhook url right?

jaunty plank
#

yes

thorny thicket
#

wtf am I doing wrong?

jaunty plank
#

do you have a console.log in your event?

sullen fox
#

How do I run the vote event on the webhook page?

If I just hit this button on the webhook page?

#

I click it... none of this triggers

dbl.webhook.on('vote', vote => {
    console.log('Someone voted.')

    console.log(`${vote.user} just voted!`)

});
trail sigil
#

it's likely not been properly setup

#

have you set the url correctly?

#

are the ports open?

sullen fox
#
const DBL = require("dblapi.js");
const dbl = new DBL("token", {
    webhookPort: 5000,
    webhookAuth: 'AuthCode'
});
#
dbl.webhook.on('ready', hook => {
    console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
trail sigil
#

have u set the url on ur bot's edit webhook page tho?

#

you'll have to do something like http://ip:port/dblwebhook

sullen fox
#

the webhook url?

trail sigil
hoary fjord
trail sigil
#

the ip is the ip of the host that the bot is on ofc

sullen fox
#

k did that

trail sigil
#

and the port is the option you set, which seems to be 5000

sullen fox
#

so my own ip

trail sigil
#

if it is hosted on your own computer, then yes

sullen fox
#

what happens tho when i put it on my hosting service

#

will it break?

trail sigil
#

you'll just need to change the ip in that field

#

everything else should work the same

#

assuming the same port is still available

sullen fox
#

i have no idea what the ip would be (AWS ubuntu)

#

k i put the link in there, still nothin

trail sigil
#

ok u need to ensure ur port is open and forwarding correctly too

#

otherwise the webhook will be blocked by your router and not reach your computer

sullen fox
#

how do i do that

trail sigil
#

but you'll need to forward it first

#

which can vary from router to router

#

you need basically tell your router that any traffic received from the port you specified (5000), should be directed to your computer, so your computer can then do what it needs to do with it

sullen fox
#

yea it says its closed

trail sigil
#

yeah sorry, you need to forward it first

#

then check if it is open

#

as it may be blocked by your computer's firewall

torn tundra
#

How can i get vote update in Discord text channel ?

fast meteor
#

What is dpnp? @fast meteor
dynamic port forwarding

#

i think its dpnp

#

something like that

jaunty plank
#

as long as the url listed on the site is pointing at whatever the right port is it should work

fast meteor
#

yeah

#

im getting a 403 forbidden when i do dblpy.get_upvotes(), might this be because im running it from my beta testing bot?

jaunty plank
#

are you using the correct top.gg token?

fast meteor
#

yeah

#

i only have one bot

jaunty plank
#

well, some people end up putting their discord token where the top.gg token goes

fast meteor
#

no i definitely have the right token

restive otter
#

is there a vote test for the api?

#

so i can make sure when someone votes it works correctly

jaunty plank
#

on your bots edit page, in the webhook section there is a test button.

warped roost
#

anyone know how i can use the webhook to send a message into a channel?

#

like other webhooks

#

actually wait i have an idea

sharp hollow
#

So i don't really get how to authorise, can anyone help?

#
(node:24) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized
    at IncomingMessage.<anonymous> (/home/container/node_modules/dblapi.js/src/index.js:118:25)
    at IncomingMessage.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:1223:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:24) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:24) [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.
restive otter
#

You didn't provide a DBL token correctly

sharp hollow
#
const DBL = require('dblapi.js');
const dbl = new DBL('i put the token on top.gg here', client);

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

Make sure the token you copied is correct or it will give that error

sharp hollow
#

@restive otter ok so i regenerated a token, and i am going to try it

#

just wish the bot was in here so i can test it right here

restive otter
#

🗿

sharp hollow
#

YAY it actually worked, so you were right! I couldn't actually get the token right because of teh compact website

#

@restive otter what is the function so i can track votes.

restive otter
#

<dblapi.js>.getVotes()

sharp hollow
#

@restive otter i meant send the user a message when they vote for the bot

#

it can be message or whatever else.

restive otter
#

You have to setup a webhook to receive on vote events so you can send them a message

sharp hollow
#

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

#

ok

#

i have a webhook

#

so what do you mean by setup a webhook?

restive otter
#

Read top.gg API webhook documentation

sharp hollow
#

ok

restive otter
#

A webhook example:
http://<your main IP>:<your port>/dblwebhook

#

Authorization can be anything you want, just remember it

sharp hollow
#

what do i put in those two parts

#

Alright

#

what do i put in the port?

#

@restive otter can i put a discord webhook URL in the url section

restive otter
#

A wot

sharp hollow
#

i don't really get this FacePalm

#

what do i put in the ip and port section???

#
const DBL = require('dblapi.js');
const dbl = new DBL('token', { webhookPort: 5000, webhookAuth: 'password' });
#

now the posting function doesn't log anything.

#

@restive otter can you still help me?

restive otter
#

Because you didn't provide the client

sharp hollow
#

oh

restive otter
#

new DBL(token, options, client)

sharp hollow
#

so can you still help me getting votes

patent lintel
#

can u pls help with my bot

sharp hollow
#

by webhooks and things

patent lintel
#

Im trying to post my guild count, but it just prints "online" and never says "Server count posted". And when I stop the code, it says:

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x1056b01c0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x1056bb820>, 6.557720309)]']
connector: <aiohttp.connector.TCPConnector object at 0x1056b2a00>```
My Code:
`index.py`:
```py
import discord
from discord.ext import commands
import os

client = commands.Bot(command_prefix="$")

@client.event
async def on_ready():
    print('Online!')
    for filename in os.listdir('./cogs'):
        if filename.endswith('.py'):
            client.load_extension(f'cogs.{filename[:-3]}')
client.run('bot token')```
`cogs/TopGG.py`:
```py
import discord
import dbl
from discord.ext import commands


class TopGG(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.token = 'dbl-token'
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
    async def on_guild_post():
        print("Server count posted successfully")

def setup(bot):
    bot.add_cog(TopGG(bot))``` Why is it giving me that error, and how can I fix it?
sharp hollow
#

@restive otter so in the options part, it doesn't have a part to put the webhook-url

restive otter
#

It doesn't need the webhook url

thorny thicket
sharp hollow
#

so i have setup and auth password , what next? @restive otter

restive otter
#

You provide them in the DBL constructor in the options parameter

patent lintel
#

can you pls help with my problem?

sharp hollow
#

@patent lintel i don't think we are experts in python

patent lintel
#

😦

#

ANYONE EXPERTS IN PYTHON?

sullen nymph
#

It's not an error

#

You're just force-terminating all sessions instead of waiting until they're all closed

sharp hollow
#

@sullen nymph do you have any idea about my issue?

patent lintel
#

You're just force-terminating all sessions instead of waiting until they're all closed
@sullen nymph ok but how long should i wait?

#

i have been waiting

#

and nothing happens

#

so something is stuck

sullen nymph
#

From a few seconds to about a minute

patent lintel
#

i have it open for about 5 mins

#

and nothing

#

so it is prolly stuck

sullen nymph
#

Spam Ctrl-C until it shuts down then ig

patent lintel
#

uh

#

no

sharp hollow
#

how do i setup a webhook

patent lintel
#

hasnt Voltrex Master been explaining that for like 30 mins

sharp hollow
#

Yes but i don't even get it

patent lintel
#

...

sharp hollow
#

about the webhook URL

#

wdym "..."

patent lintel
#

the url is http://ip:PORT

#

replace ip with ur public ip

sharp hollow
#

what ip

#

Ok

patent lintel
#

and port with ur port

sharp hollow
#

my port is 500

#

5000

patent lintel
#

ok

#

so http://public-ip:5000

sharp hollow
#

letssseee

#

ok so that's the url?

patent lintel
#

yeah

#

yeah

sharp hollow
#

so when i paste that in my browser @patent lintel it says refused to connect

patent lintel
#

and are you making a /webhook path?

#

so when i paste that in my browser @patent lintel it says refused to connect
@sharp hollow are you running it?

sharp hollow
#

what do you mean running it.

patent lintel
#

like running the code

sharp hollow
#

oh wait

#

let me run it

patent lintel
#

lol

#

and also

sharp hollow
#

yes?

sullen nymph
#

It's /dblwebhook

patent lintel
#

it should do a post request

sharp hollow
#

where

#

where /dblwebhook @sullen nymph

patent lintel
#

so putting it in ur browser wont exactly like work

sullen nymph
#

also delete that screenshit if you don't want anyone to spam it with requests

#

In the URL

patent lintel
#

lol

sharp hollow
#

done

#

i ran the code

patent lintel
#

so test webhook

#

does it work?

sharp hollow
#

my url there

#

what do i do

#

it says the same thing @patent lintel

patent lintel
#

no dude click test webhook

#

in the

sharp hollow
#

ohh

patent lintel
#

and make sure to save

#

ok

#

did it work?

sharp hollow
patent lintel
#

well im not an expert in node.js 😦

#

but like

#

it should work

#

idk why it isnt

#

but did it work?

sharp hollow
#

@patent lintel

patent lintel
#

yeah

sullen nymph
#

Make sure your port is open and forwarded

#

and that no firewall is blocking requests

sharp hollow
#

now, how do i do that?

#

open ports, im dumb sorry

thorny thicket
restive otter
#

hello, so i have my bot on top.gg i wanna make an upvote trigger in my bot what will i have to do to make it
so that whenever a person upvotes my bot they get the upvoters only command access

#

ping me if someone gets my ans

median badger
#

You can use the api to check if a user has voted or use vote webhooks

#

I suggest you to read the docs

wild horizon
#

reviews still not showing ..

median badger
true talon
#

@meager garnet make sure you entered a valid top.gg api token, then you'll be able to publish stats

meager garnet
#

i entered a valid top.gg api token

dusk cave
#

Hey, hello how can i disable autoposter? or can i?

rapid kettle
#

just don't put client

#

might be different for non js libs

restive otter
#

moderetos

#

please review my bot

sullen nymph
idle otter
#

lol

vast osprey
#

is there any example/tutorial for server count api setup for js ? 😦

vast osprey
#
try {
    var Discord = require("discord.js");
    var client = new Discord.Client();
    var DBL = require("dblapi.js");
    var dbl = new DBL('token', client);
}
#

is this correct ? i used npm install dblapi.js before

trail sigil
fast meteor
#

is top.gg webhooks compatible with dynamic port forwarding? the router my bot runs on can't do standard port forwarding, only dynamic port forwading (DPF)

hot axle
#

Hmm I suppose that as long as you can receive http requests it should work

zinc acorn
#

When sending the webhook URL what IP address are we supposed to use in place of the 0.0.0.0? I tried my IPV4 and IPV6 although none of them worked. Thanks in advanced.

jaunty plank
#

either your public ipv4 or ipv6

zinc acorn
#

Ok, I'll give it another try. Is there a way to find it in nodejs with a command or something?

jaunty plank
#

not sure why you would need to.
if its on a home network, just google "whats my ip"
if its a vps, just use whatever ip you use to access the server.

zinc acorn
#

Thanks, I'll give them a look.

proud walrus
#

How to do java skript when you vote the bot on top.gg it will send a thank you message on discor

zinc acorn
#

I tried my IPv4 address again(seems like websites can't find my ipv6). The link I used was http://0.0.0.0:5000/dblwebhook and I swopped out the 0.0.0.0 with my ipv4 address and it still doesn't seem to work.

jagged garnet
#

Hello
My bot has been accepted, so I try to make sure that when someone votes for my bot, it sends them to a special channel on my discord server. So I looked at the documentation, and I found this:

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!`);
});```

As indicated, I replaced the ``yourDBLTokenHere`' with the key api of my bot, and I restarted the bot. I then went to the webhooks category of my botn I put the webhook link I created, I saved and I then clicked on **Test** but nothing appeared in the salon in question.

Does anyone know why this isn’t working?
jaunty plank
#

The webhook url you are using, what does it look like?

#

is it a discord webhook url? or the one pointing to http://${hook.hostname}:${hook.port}${hook.path}

jagged garnet
#

It's a discord webhook url

jaunty plank
#

top.gg webhooks dont work with discord webhooks

#

you have to use the webhook receiver you made in your code with the library.

jagged garnet
#

How can I do that ?

jaunty plank
#

just
http://ip:port/path

#

if your on a home network, youll need to port forward.
if you have a firewall you need to open the port aswell.

jagged garnet
#

http://ip:port/path
I use a vps. So I have to put the vps ip, but the port, I put what? And the ``path`, is the path to what?

jaunty plank
#

your defining your port in code
webhookPort: 5000

#

if you look at the api docs for this lib, the default path is set to dblwebhook

jagged garnet
#

Where can I change the ip ? In the options ?

jaunty plank
#

the ip is changed by what the url is pointed to.

#

as long as the url you fill in on the site is correct.

#

I'm going to go make lunch. if you need me, tag me please!

jagged garnet
#

@jaunty plank, actually, I don’t understand how I can do...

jaunty plank
#

just put in the url section
http://yourvpsIP:5000/dblwebhook

#

the auth section on the site needs to be the same as what you put here webhookAuth: 'password'

jagged garnet
jaunty plank
#

ah token leak

#

make sure you regen that when you get a chance

jagged garnet
jaunty plank
#

ay

civic beacon
#

@jaunty plank

#

can you help me too

#

...

jaunty plank
lunar helm
#

How i get my vps andress?

jaunty plank
#

contact your vps provider

frail kestrel
#

So I am currently upgrading Discordjs from 11 to 12, but now the DBL stuff is breaking.

Seems to break right off the bat, when I start the DBL service.

const dbl = new DBL('mykey', client);

I am guessing maybe I need to just upgrade that package or something?

#

I was looking over documentation and the top level stuff seems the same still. The require statement and then the dbl declaration

frail kestrel
#

Yea looks like I just needed to force update my package.

Last Q, I don't think I am using shards. If those are null on my client is that fine?

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

This appears to be the same code I have, as in the documentation.

The only thing I have changed thus far is client.guilds.size -> client.guilds.cache.size

patent lintel
#

Im trying to post my guild count, but it just prints "online" and never says "Server count posted". And when I stop the code, it says:

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x1056b01c0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x1056bb820>, 6.557720309)]']
connector: <aiohttp.connector.TCPConnector object at 0x1056b2a00>```
My Code:
`index.py`:
```py
import discord
from discord.ext import commands
import os

client = commands.Bot(command_prefix="$")

@client.event
async def on_ready():
    print('Online!')
    for filename in os.listdir('./cogs'):
        if filename.endswith('.py'):
            client.load_extension(f'cogs.{filename[:-3]}')
client.run('bot token')```
`cogs/TopGG.py`:
```py
import discord
import dbl
from discord.ext import commands


class TopGG(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.token = 'dbl-token'
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
    async def on_guild_post():
        print("Server count posted successfully")

def setup(bot):
    bot.add_cog(TopGG(bot))``` Why is not working, and how can I fix it?
lunar shale
#

I add to my bot dblpy and when I start the bot I have this error. How can I solve?

File "/usr/local/lib/python3.5/dist-packages/dbl/__init__.py", line 18, in <module>
   from .client import DBLClient
 File "/usr/local/lib/python3.5/dist-packages/dbl/client.py", line 74
   _webserver: Optional[TCPSite]
             ^
SyntaxError: invalid syntax```
proper narwhal
#

the intents say that if you want to enable them, your bot has to be verified once it's in 100 servers. Does that mean that there is no longer a 100 server limit on unverified bots if they don't have intents enabled?

vital rain
#

idk maybe

versed storm
#

@proper narwhal not related to top.gg api, but no, the verification is system is not modified by the intents system.

bold badger
#

Quick question for webhook which webhook is it asking discord channel webhook?

rain heart
#

A webhook that you created with your bot. It's not a Discord webhook

foggy kelp
#

This for server webhooking?

silk reef
#

what does automatic server count do?

obsidian drift
#

what does the yourDBLToken here in const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' })

#

what does that mean

rough plover
#

Can someone help me with server count posting

#
fetch(`https://top.gg//bots/747076873359458370/stats`, {
    method: "POST",
    headers: { 
      Authorization: "------------------------------------------",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({"server_count": client.guilds.cache.size })
  }).then(response => response.text())
.then(console.log).catch(console.error);```
#

its not working

earnest apex
#

oh sure

#

do you need that on your states of your bot

#

@rough plover

rough plover
#

states?

earnest apex
#

yea

rough plover
#

idk what you mean

earnest apex
#

like states

#

for like if your live streaming or not

#

ill dm hold n

gaunt root
#

Can someone help me?:|

const dbl = new DBL(process.env.DBTOKEN, { webhookPort: 5000, webhookAuth: 'password' })

dbl.webhook.on('vote', vote => {
  let embed = new Discord.MessageEmbed()
  .setDescription(`Thanks ${vote.user.tag} for voted in me!`)
  .setColor(config.color)
  client.channels.cache.get('775321074975506472').send(`<@${vote.user}>`, embed)
})```
#

Alot of erros

versed storm
#

Errors would definitely be helpful

restive otter
#

hello guys. Can anyone help me how to use webhooks in python?

        self.bot = bot
        self.token = 'xxx'  # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/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 bot on top.gg."""
        print("Received an upvote:", "\n", data, sep="")```

I am trying to write the voting command. I tried, but I didn't get any update in the output. (Didn't print anything)
earnest sapphire
oak estuary
#

Login

#

@restive otter 'xxx' is your bot token