#topgg-api

1 messages · Page 114 of 1

plucky lance
#

Is the webhook running on a VM using a static IP or are trying at home?

boreal gale
#

So, the IP not is static (I think)

plucky lance
#

Well heard that name a few times but actually have no clue what it is.

#

Without a static IP or dns you will have to change the webhook url on top.gg over and over again which makes no sense

boreal gale
plucky lance
#

Well try to imagine...
You have to enter a webhook URL on top.gg
What will you enter which is static and won’t change?

plucky lance
#

Ah ok

#

So you got a domain name from your host I guess

boreal gale
#

Yes

plucky lance
#

But I still dunno if you can open ports on a free host service, you will have to try out

boreal gale
#

The only open door was 80

plucky lance
#

Yeah default webserver port

#

Makes me think you can host your website on Heroku (for free)

restive otter
#

I need a api for NSFW command. Can anyone tell how can I get

plucky lance
#

Well if so try port 80 and bind the webhook to any path you want for example „dblwebhook“

#

And test it

boreal gale
plucky lance
#

How does that change the fact u host it on this mentioned free hoster?

#

Or isn’t your webhook service done yet?

boreal gale
plucky lance
#

Oh

#

Well just follow the docs of top.gg

#

Thought you’re only experiencing issues with the webhook service not receiving any requests

#

Anyway gonna get some sleep

boreal gale
uncut ermine
#

there are

#

many different ways to make an nsfw command

flint olive
#

hey can anyone use th reddit api or does it say numpy error in the win32 runtime

#

@here

#

here is my code

import praw

reddit = praw.Reddit(client_id="UtgfhdgOsI7ww",
client_secret="gsdefgetryhgeritughou8ywwgero8y34",
username = "cmcool_",
password = "ghbfghd",
user_agent = "DiscordBot")

subreddit = reddit.subreddit("memes")

top = subreddit.top(limit=5)

for submission in top:
print(submission.title)

#

and here is my error code raise RuntimeError(msg.format(file)) from None
RuntimeError: The current Numpy installation ('C:\Users\my name\PycharmProjects\Discord bot\venv\lib\site-packages\numpy\init.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://tinyurl.com/y3dm3h86

soft salmon
#

read the channel desc

restive otter
#

Good night, I'm in development and I want to use the api discord bot list on my bot for rewards for those who vote for my bot, but I can't afford a suitable host, so I use repl.it and api discord bot list not there can you help me?

#

@willow sphinx

#

Help

agile moat
umbral cobalt
#

same ..

quaint rapids
#

Lol

umbral cobalt
#

Test ?

quaint rapids
#

Wtf, I have never seen this replied

umbral cobalt
umbral cobalt
restive otter
#

How To Get Recent Vote And Recent Donation Messages Of My Bot In My Server Channel?

rain heart
#

Recent Vote: Webooks
Recent Donation: Probably through the DonationBot

restive otter
#

But How?

rain heart
#

Read the api docs

#

and donationbot probably also has an api

#

donatebot gives users, who donated, a special role in your server. You could make your bot check on a role add event if the user received that role from donatebot and if that's your particular role

dusky monolith
#

how to get my dpl token

#

is it my bot token?

#

@empty gazelle sorry for ping, but can u help me?

sullen nymph
dusky monolith
#

ty ^-^

#

and the token is too long as well that the self.token is now up

sullen nymph
#

put it on the line above

#

self.token = "your_dbl_token_here"

dusky monolith
#

yes

#

when i paste the token

#

the self.token goes up

sullen nymph
#

well move it up yourself

dusky monolith
#

it will still go up :/

#

wait nvm

#

@sullen nymph sorry for many pings but, 'dbl' has no 'DBLClient' member

sullen nymph
#

Did you name any of your folders/files dbl

dusky monolith
#

@sullen nymph

sullen nymph
#

Rename it

dusky monolith
sullen nymph
#

anything

#

just not dbl

dusky monolith
#

hmm ok

dusky monolith
#

do i do @commands.Cog.listener()

sullen nymph
#

All methods (functions attached to objects) must have some kind of argument that refers to the object

#

usually self

#

and yeah

dusky monolith
#

so self.print

sullen nymph
#

...no

#

method parameters

#

on_guild_post(self)

dusky monolith
#

ah

#

yeah sorry i started coding 3 weeks ago so i don't know much

#

it works now

#

ty

thorn bronze
#

need help with

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

problem not posting

#
const dbl = new DBL(token,{ statsInterval: 900000 },client)
maiden kettle
#

Is your token defined?

thorn bronze
#

yes

#

i have the webhook working but i can't get the posted working

#
const {token,dblToken} = require('./botconfig.json')
const Discord = require('discord.js');
const DBL = require('dblapi.js');
const client = new Discord.Client();

client.login(token)
client.on('ready',()=>{
    console.log("ready!")
    const dbl = new DBL(dblToken,{ statsInterval: 900000 },client)
    dbl.on('posted', () => {
        console.log('Server count posted!');
      });
      dbl.on('error', e => {
        console.log(`Oops! ${e}`);
    })
})
maiden kettle
#

It may be the stats interval option, i believe options go after the client is defined

#

Try removing it or putting it after the client argument

thorn bronze
maiden kettle
#

Hmmm

thorn bronze
#

i followed the doc

maiden kettle
#

Just try removing it to see if that works

thorn bronze
#

sure

maiden kettle
#

Worth a shot

thorn bronze
#

not working

maiden kettle
#

Hmmm

#

Anyone else have any ideas?

thorn bronze
#

wait

#

im dumb

maiden kettle
#

Maybe move it out of client.on ready

#

What is it?

thorn bronze
#

i was using the wrong thing

#

i needed ```js
dbl.postStats()

meager harness
#

Someone of my bot user voted my bot it says that you have voted already vote again after 12 hours but when I am trying to get data from the api it says he didnt voted today.

serene shuttle
#

Is there a way to get how long it will be until a user is able to vote next? or when they last voted?

#

Ping me in reply please

jaunty plank
#

Tracking votes yourself with the webhook would be the easiest way to accomplish that as far as I know.

restive otter
#

how to make Server Webhooks top.gg

#

or that's the same as webhooks in discord

plucky lance
#

Nope

golden adder
plucky lance
#

You have to setup your own webhook service or send requests to the API

restive otter
#

thanks

#

now how do i do that

golden adder
#

What do you want to do? Why do you need to set up server webhooks?

jaunty plank
restive otter
#

Soo it can make a message in my server that someone voted

serene shuttle
#

Tracking votes yourself with the webhook would be the easiest way to accomplish that as far as I know.

You have to set up the webhook to work with a database. There's no timestamp info on the vote event so you'd have to set up the webhook so that when a user votes it adds a timestamp and their ID to your database. That way you can work out when their next vote is available.

Alright thanks guys! Yeah already tracking votes so that's no difficulty, just wondered if there was a way to fetch instead of store it but that's no worries. Cheers for the responses

golden adder
restive otter
#

k

golden adder
#

Use the api link above for help

restive otter
#

oh is it ok if i give money (using Unbelevaboat) to people who vote my server?

plucky lance
#

An easy way is to create an application in Discord (not a bot) and cURL requests to the API to send messages only to channel if that’s enough for u.

restive otter
#

Yeah thats what i want to do

#

thanks

plucky lance
#

Or creating a webhook on your discord server and send requests to it.

#

The Discord API is easy to use and there are enough code snippets out there how to use it in JS, PHP etc.

half ledge
#

Hi, I set everything up and followed the instructions, but the webhook is not working. Am I missing something? I just entered the URL

rain heart
#

test your webhook with something like postman for example

half ledge
#

I confirmed that the webhook is working. I don't know what else it could be

rain heart
#

is the authorization correct etc?

half ledge
#

I'm not 100% sure what to put there

rain heart
#

just put "testauth" in both fields

#

on the "authorization" field on your bot page, and the parameter inside your webhook in your code

dusky monolith
#

@rain heart how can i setup the webhooks

rain heart
#

if you're using js that is

dusky monolith
#

im python

#

anyways it says if im not using tasks extension then i use this

#

is that right?

#

yeah yeah i got it

#

i just need to do an event on_dbl_vote

shrewd crystal
#

When I run

const DBL = require('top.gg');
const dbl = new DBL(topToken, client);
....
setInterval(() => {
dbl.postStats(client.guilds.cache.size);
}, 1800000);

I get Error: 400 Bad Request :/

#

any ideas

jaunty plank
shrewd crystal
#

gotchu

#

I wonder why the top.gg package was made then

jaunty plank
#

someone else made it.

shrewd crystal
#

thanks!

#

that worked lol

dusky monolith
rain heart
#

try self instead of client maybe

dusky monolith
#

;/

#

@rain heart

#

the problem is with TopGG i guess

rain heart
#

That's not because of top.gg, you're just misunderstanding the api probably

#

Did you define client?

dusky monolith
#

wait...

#

they made it bot and not client smh

#

wait bruh

#

still same problem

jaunty plank
#

self will be the dbl client right? not your discord bot client.

dusky monolith
#

ah

#

so dbl.

#

yep

jaunty plank
#

and user wont exist, youll need to fetch the user.

sullen nymph
#

what the fuck

#

I understand newbie and all that

#

but

dusky monolith
sullen nymph
#

Frankly, self refers to your instance of the TopGG cog

#

which doesn't have a method get_channel

#

I assume you have self.client instead

#

Also .send must be awaited

dusky monolith
#

i didn't await sorry ;/

sullen nymph
#

Apply the cog listener decorator to it

#

and make sure you use on_dbl_test to receive test requests properly as well

dusky monolith
#

@sullen nymph instance of TopGG has no 'client' member

sullen nymph
#

What does your __init__ look like for the TopGG class

dusky monolith
#

def __init__(self, bot):

#

@sullen nymph

sullen nymph
#

Use self.bot then

dusky monolith
#

finally

#

now the undefined var 'user'

#

in the api docs

#

it says "user" is the id of the voter

jaunty plank
#

Data.user no?

dusky monolith
#

worked

#

bruh thanks

sullen nymph
#

Been thinking about adding support both in next version

#

derp

dusky monolith
#

but it doesn't send

jaunty plank
#

Yeah read what shiv said.

dusky monolith
sand hazel
#

Is the top-gg/docs repo deployed somewhere?

rain heart
#

if this is what you mean

#

oh wait deployed

sand hazel
#

Doesn't appear to be, missing much of the content

rain heart
#

you might need to ask xetera then

thick fern
#

As suggested yesterday, I opened the port in which I has my webhook listening on for votes, but my bot still does nothing upon a vote

sand hazel
#

repo created 3 years ago, never deployed anywhere think_fish

restive otter
mellow plank
#

Is the server count api related? Or does it auto update once you reach a certain number of servers?

jaunty plank
#

yeah, its api

mellow plank
#

Thanks. Will read em later and check back if I have any questions while implementing

restive otter
#

you have to make a post request where you post your guilds count(required), and the shards count(optional) and the shardid(optional)

rain heart
#

best is to use the dbl library

#

so you don't have to go through the hassle of setting up requests

plucky lance
#

lol "hassle" of setting up requests...
You mean one line code sending a cURL request using POST method? That’s less work then using the DBL lib

rain heart
#

not really

#

you also get the advantage of using the webhooks, dbl api in general (getting vote count etc)

restive otter
#

how do webhooks work to know who has to vote via the server? In a living room

jaunty plank
#

top.gg webhooks are not compatible with discord webhooks

restive otter
#

ah yeah yet I have already seen waiters where they work

jaunty plank
#

you will need to go through an external service/server to make top.gg webhooks go through discord.

#

most cases this is making a discord bot

restive otter
#

ah :/

obtuse maple
#
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
Doesn't seem to work.
jaunty plank
#

whats your dbl constructor look like

obtuse maple
#

I'm using the exact same as the api docs.

jaunty plank
#

including the port and auth?

obtuse maple
#
const DBL = require("dblapi.js");
const client = new Discord.Client( { autoReconnect: true, disableEveryone: true, fetchAllMembers: true });
const fs = require('fs');
const dbl = new DBL('key', client);
dbl.on('posted', () => {
  console.log('Server count posted!');
})
dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running with path ${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
jaunty plank
#

your dbl needs the port and auth in the constructor

#

as shown in the docs

obtuse maple
#

oh wait i see where i went wrong

#

Working now

#

ty for making me see where i went wrong

rain heart
#

That user has to be on your server and has to have dms enabled

thick fern
#

How do I set up an automated message to a channel every time someone votes?

#

I have a basis down following the example on the API docs, but it doesn't work

rain heart
#

Webhooks from dbl are the only way

thick fern
#
const dbl = new DBL('', { webhookPort: 5000, webhookAuth: '' }, bot);

dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  bot.channels.cache.get('778460112313647175').send(`User ${bot.users.cache.get(vote.user).tag} just voted for Tic-Tac-Toe!`);
    
    console.log({channel: bot.channels.cache.get('778460112313647175'), user: user, _user: bot.users.cache.get(vote.user)});
});
rain heart
#

You have to enter something in the webhook Auth

thick fern
#

There is something in there

#

My webhook auth password is in there

rain heart
#

You also have to enter your webhook url inside your bot page

thick fern
#

When I launch the bot it says my webhook is running on http://0.0.0.0:5000/dblwebhook, is that what I should put in there?

jaunty plank
#

replace 0.0.0.0 with the actual ip

thick fern
#

I did that

#

And it didn't work

jaunty plank
#

is this running on a home network?

thick fern
#

It's running on a server

jaunty plank
#

like from a proper host?

rain heart
#

Is the port open?

thick fern
#

an ec2-user AWS instance

#

And the port is open

rain heart
#

Did you attempt to connect through a request client like postman

thick fern
#

?

#

wdym

rain heart
#

Manually try making requests to your webhook

#

Through postman for example

thick fern
#

How do I do that?

rain heart
#

Look up postman and look up a few tutorials on how to do that

thick fern
#

How do I make requests with postman?

#

What would happen if you changed the options.webhookServer in the code?

rain heart
#

WebhookServer is just something with express, scroll a bit further down to see another example on how to do this

thick fern
#

Ahh, ok.

young haven
#

what would that Webhook be? where can i get him

restive otter
#

For my bot I want to configure Top.gg api with my bot so it will show how many servers does my bot is in but i have no idea what is the right code to put it in to my bot. Can someone help me out please ?

willow spindle
restive otter
#

I just dont wich code goes where in that part cuz its little confusing

#

How do I get a webhook that will work with top.gg

#
const dbl = new DBL('Your top.gg token', client);
#

in this code for the "client" what should i write ?

#

Replace your top.gg token with the api token

#

after that if i use this code

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

will this send all the things above to the top.gg or do i have to change some stuff ?

#

It will send

#

I'm pretty sure atleast

#

do U need to define dbl.postStats somewhere ?

#

No

#
dbl.poststats
``` is already defined
#

Once you called the dblapi.js pacalge

#

Package

#

ohh i just have to do npm i dbl

#

i forgot that

naive dove
restive otter
#

You are being rate limited

#

Too many requests in x amount of time

silk tundra
#

I was wondering, I just got my bot approved, and I was wondering how to set up it to show how many servers the bot is in and how to use the token

vapid belfry
plucky lance
restive otter
#

Hi

#

pls help me

#

${client.guilds.cache.size} to v11 ?

restive otter
vivid crater
supple nexus
#

How to use this cool emoji

#

Wow

#

Since i am poor i can do this only 😔

signal hawk
#

please keep this channel on topic, thank you.

mellow aspen
#

Can anyone help me with getting server or member count on my bot page, I'm using nodejs and everything I have tried doesnt work, any videos available or smth?

#

Ping me if anyone had a nodejs template I can use

#

the last one I used didnt work

#

._.

plucky lance
#

Take a look at the docs. Pinned.

mellow aspen
#

I'm trying to post server and member count-

#

unless that uses webhooks

plucky lance
#

The DBL docs explain how to do so.
Posting member count wut?

mellow aspen
#
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);

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

dbl.on('error', e => {
 console.log(`Oops! ${e}`);
})```
So I just wallop this in my index then replace top.gg token with the token on my bot page?
#

Last time I did that nothing happened

mellow aspen
plucky lance
#

There’s a member count on top.gg?

mellow aspen
#

ExcuseMeWHAT yes

plucky lance
#

Server count yes, but member count?

mellow aspen
#

yes

#

...

plucky lance
#

Gimme a link

grizzled gate
#

There is no such thing as a member count on bot pages

plucky lance
#

The code you posted doesn’t send the guild cache size to DBL

mellow aspen
plucky lance
#

Nope that’s how to receive events using the top.gg API

mellow aspen
#

Then wheres the doc to post member / server count on bot page lol

plucky lance
#

Once again there’s no member count, you can just post the server count

mellow aspen
#

Ok

#

But how do post server count

#

No ones helping me here 0_0

mellow aspen
#

That link aaa

plucky lance
#

Great URL

#

Take a look at the methods you can use

mellow aspen
#
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);

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

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

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

So would this post shard count shard id and server count?

#

@plucky lance

plucky lance
#

Did you integrate the code into your bot?

mellow aspen
#

yes

#

I used this exactly

const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);

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

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

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

And replaced

#

The token

#

With my bots token

plucky lance
#

So you didn’t integrate the code into your bot I guess.

#

Djs doesn’t magically know your bot and it’s token. That’s why you have to use .login(token) as described on djs docs

#

That code is an example how to integrate the dbl lib not a copy and paste version.

mellow aspen
#

I literally put

const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);

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

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

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

In my index

#

And replace the token part with my generated token

plucky lance
#

Did you even login the client?
client.login('token');

mellow aspen
mellow aspen
#

Where do i put that

#

Do I replace token with bot token too

plucky lance
#

Dude integrating djs and creating a client still requires to login using your Discord bot token.

mellow aspen
#

Yes but where

#

oh my

plucky lance
#

Like how you did in your bot

mellow aspen
#

Index or package

#

And do I replace

#

Token

#

With the token

plucky lance
#

How can I know how your build looks like?

#
mellow aspen
#

Index is main bot file

#

Package

#

Is where u install

#

Everything / dependencies

wind flame
#

is the api broken

#

its not posting

wanton saffron
#

Hey I have a question, how would I get the webhooks working if my bot is running on java?
I probably have to host a webserver, right?

restive otter
#

Whats your djs version

wind flame
#

uhm wait

#

lemme check

restive otter
#

12 is the best because it’s the least

wind flame
#

12.3.1

restive otter
#

Oh

#

@restive otter are you a simp

#

Then it should be clients.guilds.cache.size

#

no bruh

wind flame
#

yeah but

#

leave that

#

i used with

restive otter
#

Lol but your name says that

wind flame
#

the prebuild

#

func

#

db.pst

restive otter
#

Spim is near to simp

#

sigh

wind flame
#

db.on('post')

#

it didnt worked

restive otter
#

Put the P at last and it will be simp

#

@restive otter ok bye!

#

this aint general but ok ig

wind flame
#

this aint working

#

@restive otter

crude elm
#

Did you give dbl a value ?

#

@wind flame

wind flame
#

yeah

crude elm
#

Installed the dbl api ?

wind flame
#

hmm

#

ya

crude elm
#

Pasted dbl token ?

wind flame
#

ya

crude elm
#

I think process.env is doing something

#

Try this

#

Hey

wind flame
#

i tried

#

normally

#

same

#

no result

crude elm
#

dbl.on('error', e => {
console.log(error ${e})
})

#

Aaa it is `

wind flame
#

so

#

??

#

whats the issue

crude elm
#

It logs the error

#

@wind flame

wind flame
#

nope

#

wait

#

i think i knw

wanton saffron
#

How can I read from the top.gg voting API webhook?
Im using java for my bot

wind flame
#

i think its unsupported platform

#

it gave me this

crude elm
#

oh

wind flame
#

so i cant use

#

-_-

crude elm
#

wait umm

#

is ur env being dumb ?? try pasting the api key in the area and try again

wind flame
#

i did like that too

latent narwhal
#

Ok so @wind flame

#

If u make a webhook

wind flame
#

hmm

latent narwhal
#

then

#

it automatically

#

posts the server

#

count!

wind flame
#

yeah cuz u r using dbl.on

#

so that is posting

latent narwhal
#

yes

wind flame
#

and dbl isnt working for me

crude elm
#

u use it too

crude elm
latent narwhal
wind flame
#

how?

latent narwhal
#

Try it

#

Everything will work

wind flame
#

code

latent narwhal
#

Make sure to enter your webhook URL

#

Then to webhook

#

then this should be your webhook url - http://IP_ADRESS:PORT/dblwebhook

crude elm
#

const DBL = require("dblapi.js");
const dbl = new DBL('TOKEN', client);

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

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

restive otter
#

Is there a issue with votes atm ? Tag me for photos.

latent narwhal
#

@restive otter send

#

photos

#

send

restive otter
#

Bot says 325

latent narwhal
#

oh

restive otter
#

Then the analytics says 280

latent narwhal
#

Must be a bug

#

Always trust bigger number

#

so it must be 329

crude elm
#

hey

latent narwhal
#

hi

crude elm
#

it asks webhook passwords

latent narwhal
#

Yes

crude elm
#

help me abt that

latent narwhal
#

Keep it anything you want

crude elm
#

im new to webhooks

restive otter
#

I would love for a admin to confirm it tho

crude elm
latent narwhal
restive otter
#

Lol

crude elm
#

oof

restive otter
#

Was told to come here

latent narwhal
crude elm
#

tell me that

latent narwhal
crude elm
#

thx

restive otter
latent narwhal
#

anytime

restive otter
latent narwhal
#

No they were talking about rahul

#

your question is not about api

#

your is about bug

#

Ask there

restive otter
#

Already did

crude elm
#

@latent narwhal now what ?? i made webhook codes to my bot

#

now how to votelock

restive otter
#

They didn’t even reply to me sadMJ

latent narwhal
crude elm
#

sadd

#

@latent narwhal now what ?? i made webhook codes to my bot now how to votelock

latent narwhal
#

It's database related

crude elm
crude elm
fast agate
#

is this right?

Client = discord.Client()
@client.event
async def on_ready():
  dblpy = dbl.DBLClient(Client, (top.gg token), autopost=True)
#

?

#

python*

wanton saffron
#

How can I read from the top.gg voting API webhook?
Im using java for my bot

restive otter
#

Use the Java

plucky lance
#

Read the docs.
There’s an unofficial github repo linked.

wanton saffron
#

can u send the link? I couldnt find it

plucky lance
#

Pinned in this channel

soft hatch
#

Hey, anyone know why in discord.py

When I do like bot.guild.members, I only have the bot that's in ?

fast agate
#

guild.members

#

or members on context guild?

rich stag
#

How to use webhook to get voting information

wind flame
#

@gloomy fractal will this link work to post status https://top.gg/api/auth/stats/679029815185113091

soft hatch
#

I want a guild context members

median river
#

Hi, i was wondering how i could give users a role in my support server if they voted for my bot?

fast agate
#

ctx.guild.member_count

wanton saffron
plucky lance
#

How about using the menu on the left side clicking on JAVA LIBRARY ?

sullen nymph
#

Google "webserver java"

wind flame
#

also js api not working

#

for my bot

#

someone help

#

What are the api endpoints of top.gg

plucky lance
#

As written in the docs: https://top.gg/api

latent narwhal
#
const DBL = require("dblapi.js");
const dbl = new DBL(
  "OOIFBOSVFUPASB",
  { webhookPort: 6969 , webhookAuth: "sfugqaufvqsaf" },
  client
);

dbl.on("error", e => {
  console.log(`Oops! ${e}`);
});
dbl.webhook.on("ready", hook => {
  console.log(
    `Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`
  );
});```
#

I use this and My bot server count is hella a lot behind

rich stag
#

I can't use webhook, who can help me

restive otter
#

@latent narwhal

#
filename : guildCreate.js
module.exports = async (bot, guild) => {
  await bot.dbl.postStats(bot.guilds.cache.size);
}

#
filename : guildDelete.js
module.exports = async (bot, guild) => {
  await bot.dbl.postStats(bot.guilds.cache.size);
}
rich stag
#

I have error?

plucky lance
#

As the description above the URL says, you have to set up your OWN webhook service.

#

What you’re trying to do doesn’t make any sense.

rich stag
#

How

#

sorry I don't know

restive otter
#

@rich stag http://IP_ADRESS:PORT/dblwebhook

rich stag
#

IP_ADRESS:PORT is my Bot id or webhook ?

restive otter
#

ip is where the code os been hosted

#

and the port you make when you set up the webhook in your code

plucky lance
#

As said you need to run your own webhook service as explained in the docs (pinned in this channel)

rich stag
#

this?

plucky lance
#

You need to define a port you have make sure is being publically accessible and use the public IP of the device the webhook is running on

#

Imma sorry don’t speak your language which seems to make it impossible to explain you what you actually need to do

rich stag
#

i don't understand, so I give up🤣

soft hatch
median river
#

Hi, I was wondering how I could give a user a role for voting for my bot? Could anyone help?

blissful belfry
#

hey

#

how to detect a new vote with python ?

#

they are a event ?

still ruin
#

Hola?

plucky lance
wheat copper
#

how do i test vote webhook?? do it and wait until someone votes?

plucky lance
#

Did you try the TEST button?

wheat copper
#

where is that, lol

jaunty plank
#

webhook section of your bot/server

wheat copper
#

my head hurts lol... do i use webhook URL from a discord webhook?

rugged patio
#

Hi. How to i find dbl token

wheat copper
#

ok right, this is as clear as mud, what webhook link do i put in there then? the link that is logged in my console after it runs the webhook.on?

jaunty plank
#

the docs expect you to understand what webhooks are and how they work which is probably why its unclear.

#

the url thats logged is mostly correct, except 0.0.0.0
0.0.0.0 in the web world just means any public ip

#

or more specifically the public ip the code can use.

#

all a webhook receiver is is an http server receiving post requests.

wheat copper
restive otter
#

@jaunty plank has the votes been fixed on the analytics page sorry for ping.

#

how can i post server count on Bot page 🤔

jaunty plank
#

0.0.0.0 is not your public ip @wheat copper

#

I have no idea, i dont keep track of fixes. @restive otter if there was an issue submitted on the github, it would be announced there.

#

np on the ping

restive otter
#

Well on my bot page it says I have more votes than my analysis

#

Just abit strange

#

kk

jaunty plank
#

I dont think ive heard of that issue.

restive otter
#

@jaunty plank do you want me to send you photos in dm ?

jaunty plank
#

the github would be best, its what the dev team looks at

wheat copper
jaunty plank
#

yes

restive otter
#

@wheat copper am sure that’s ment to be the IP of where the code is been hosted ?

jaunty plank
#

^^

wheat copper
#

yeah well im testing on a local bot atm so will be my ip? yes?

jaunty plank
#

if your testing locally youll need to portforward aswell.

plucky lance
#

@restive otter Take a look at the votes diagram. The value may be different because it shows the last 7 days only, if I assume right

restive otter
#

@plucky lance it’s all over

#

It’s fine hopefully it gets fixed soon

restive yacht
#

I am trying to make top.gg show how many servers my bot is in, I looked at https://top.gg/api/docs#bots but it dose not tell you how to add it into your bot. Do I add the code into my bots main file?

rain heart
#

i assume discordjs?

restive yacht
#

Yeah

rain heart
#

just especially explain for discordjs

#

it should be inside your main file, you can also add it to another file if you wish

restive yacht
#

Ok, thanks for your help.

restive otter
#

is there like no api?

#

for go

#

as in api wrapper

rain heart
restive otter
rain heart
#

but you will have to get your bot approved first in order to be able to use the top.gg api

#

oh that library is dead

restive otter
#

ahh okie

restive otter
#

how do i write somebody's username but not mention them: for example, "Hello, user, how are you" without doing @User#6237

#

like that

#

Ohh

#

nvm

#

feiuafh

#

wait

#

nvm

#

that didnt work

#

how do i write somebody's username but not mention them: for example, "Hello, user, how are you" without doing @User#6237

#

or something

plucky lance
#

Hello PM

thick ingot
#

Hey help me😔

restive otter
#

hi @plucky lance

thick ingot
#

Actually I just create a new bot but i can't add this in top gg😔😔😔😔😔😔

restive otter
#

how to do this ?

#

write someones username but not @ mention them

plucky lance
restive otter
#

o ok

dusky monolith
#
import dbl
import discord
from discord.ext import commands, tasks

import asyncio
import logging


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

    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)

    # The decorator below will work only on discord.py 1.1.0+
    # In case your discord.py version is below that, you can use self.bot.loop.create_task(self.update_stats())

    @tasks.loop(minutes=30.0)
    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""
        logger.info('Attempting to post server count')
        try:
            await self.dblpy.post_guild_count()
            logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
        except Exception as e:
            logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))

        # if you are not using the tasks extension, put the line below

        await asyncio.sleep(1800)

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

def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(TopGG(bot))

i copied and pasted this code exactly but when someone votes for the bot it doesn't print anything in the terminal

#

except dbl_token switched with my token

hot apex
#

How can i make a bot that tracks my servers votes?

young haven
#

is it just me why i already get the updates of the votes?

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

Webhook running at http://0.0.0.0:5000/dblwebhook

#

User with ID 290683144900706304 just voted!
I made it, thanks

plush oar
#

hello im having an issue with pushing the server count

#
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('API-TOKEN', client);

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

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

this is what im using the example script

#

but nothing ends up happening

dusky monolith
#
import dbl
import discord
from discord.ext import commands, tasks

import asyncio
import logging


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

    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)

    # The decorator below will work only on discord.py 1.1.0+
    # In case your discord.py version is below that, you can use self.bot.loop.create_task(self.update_stats())

    @tasks.loop(minutes=30.0)
    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""
        logger.info('Attempting to post server count')
        try:
            await self.dblpy.post_guild_count()
            logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
        except Exception as e:
            logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))

        # if you are not using the tasks extension, put the line below

        await asyncio.sleep(1800)

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

def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(TopGG(bot))

i copied and pasted the same exact code and it still doesn't log when someone votes

obsidian tide
#

if anyone every needs to get the text "hello" and/or "world" from the top.gg api, here it is: (code snippet)

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

getWorld();

async function getWorld() {
  let req = await fetch(
    "https://top.gg/api",
    {
      method: "get"
    }
  );
  console.log(JSON.parse(await req.text()).hello);
};
sullen nymph
#

@dusky monolith make sure no firewall is blocking requests (and that your port is forwarded if you are hosting locally)

#

And for Christ's sake mind using on_dbl_test with the Test Webhook to save your own time and effort

#

I'm seriously starting to consider merging them both into one at this point

upper moon
#

Is anything wrong with my code?

#

@commands.Cog.listener() async def on_dbl_vote(self, data): print('User with id {} has voted for the bot!'.format(data.user))

sullen nymph
#

data["user"]

#

that's first

#

Second, are you actually getting votes sent to your webhook

blissful belfry
#
import dbl
import discord
from discord.ext import commands, tasks

import asyncio
import logging


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, webhook_path='/dblwebhook', webhook_auth='MDP', webhook_port=5000)
        print(self.dblpy._webhook)
        print(self.dblpy._is_closed)
        print(self.dblpy._webserver)

    

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

def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(TopGG(bot))```
#

no vote is captured

#

why ?

#

console:

#
<bound method DBLClient._webhook of <dbl.client.DBLClient object at 0xb4029130>>
False
None```
sullen nymph
#

lmfao how did you even get to printing those

#

and why

#

anyway

#

are you voting or pressing the Test Webhook button?

blissful belfry
#

yes

#

but the webhook does not work

sullen nymph
#

that wasn't a yes/no question

blissful belfry
sullen nymph
blissful belfry
#

sorry but i am french😅

sullen nymph
#

oh dear god

blissful belfry
#

why ?

#

lol

sullen nymph
#

Discord webhooks aren't what top.gg means by "webhooks"

#

It means a literal webserver hosted on a physical machine

blissful belfry
#

ahhh

#

ookayy lol

sullen nymph
#

Get your VPS' IP address and use http://ip:5000/dblwebhook as the URL

#

where ip is your VPS' IP

blissful belfry
#

thank^^

sullen nymph
#

Also

#

If you press Test in the webhooks section

#

Use on_dbl_test

zenith elm
#

so, i have to put like a specific code to get the servercount to my bot?

blissful belfry
#

@zenith elm yes

rain heart
#

Read channel topic

zenith elm
#

is the code for the servercount the same for all bots? if so, could someone please paste it here

blissful belfry
#

with port 5000

#

but does not work

#

and the code is launched

#

print(self.dblpy._webserver) is none

zenith elm
#

um

#

i didnt understand anything, but mkay

#

eh i have no idea how to do the servercount thing

#

lmao

blissful belfry
#
import discord
from discord.ext import commands, tasks

import asyncio
import logging


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

    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)

    # The decorator below will work only on discord.py 1.1.0+
    # In case your discord.py version is below that, you can use self.bot.loop.create_task(self.update_stats())

    @tasks.loop(minutes=30.0)
    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""
        logger.info('Attempting to post server count')
        try:
            await self.dblpy.post_guild_count()
            logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
        except Exception as e:
            logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))

        # if you are not using the tasks extension, put the line below

        await asyncio.sleep(1800)

def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(TopGG(bot))```@zenith elm
#

i don't understand your problem

zenith elm
#

so do i just paste it in my code and i get the servercount to my bot's top.gg page?

blissful belfry
#

@zenith elm your bot is in python ?

sullen nymph
#

jour, why are you printing those in the first place

blissful belfry
#

copy your token

#

and paste in self.token = 'dbl_token'

sullen nymph
#

Like, I get printing _webserver but why the rest

blissful belfry
#

arf

blissful belfry
zenith elm
sullen nymph
#

No, not your bot's Discord token

#

and use it to communicate with top.gg API

blissful belfry
zenith elm
#

ok, so i copied the token, now what do i do?

blissful belfry
#

and ```const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your top.gg token', client);

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

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

sullen nymph
#

You enter it in the example

blissful belfry
#

const dbl = new DBL('Your top.gg token'paste your token in

sullen nymph
#

Specifically, the DBL constructor

zenith elm
blissful belfry
#

install the dbl api

zenith elm
#

how do i install it?

blissful belfry
#

npm install dblapi.js

restive otter
#

Japierdole

blissful belfry
#
import dbl
import discord
from discord.ext import commands, tasks

import asyncio
import logging


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, webhook_path='/dblwebhook', webhook_auth='mdp', webhook_port=5000)
        print(self.dblpy._webserver)
        

    

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

def setup(bot):
    global logger
    logger = logging.getLogger('bot')
    bot.add_cog(TopGG(bot))```
#

doest work 😭

sullen nymph
#

ffs

#

Are you pressing Test or voting

blissful belfry
#

yes

#

but not voting

sullen nymph
#

I'm literally asking you a question that requires specifying which of the listed actions you are doing

#

and you're just giving me "yes"

#

please

blissful belfry
#

but I have to wait 12 hours

#

euh

sullen nymph
#

Use on_dbl_test and press Test in your bot's Webhooks section

blissful belfry
#

could you repeat the question? please

sullen nymph
#

Ignore it

#

see my last message

blissful belfry
#

okay

#

i add @commands.Cog.listener()
async def on_dbl_test(self, data):
print("ok")

#

but doesnt work

sullen nymph
#

What did you enter in the webhook URL?

blissful belfry
sullen nymph
#

..........

blissful belfry
#

and the code: self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path='/dblwebhook', webhook_auth='MDP, webhook_port=5000)

#

I entered the wrong ip?

#

ah

#

https is not http

#

i test with the protocole http but doesnt work

meager saddle
#

How can I make the bot detect when it is voted on the page like some bots do?

blissful belfry
#

this is what i try to do

#

@meager saddle

meager saddle
#

ah

blissful belfry
#

why ?

sullen nymph
#

192.168.x.x isn't a public IP

pine heart
#

const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
the "yourDBLTokenHere" is the token that is created on the "my Bots" page I guess... but what is the 'password'?

pure jolt
#

Hi

sullen nymph
#

whatever you set in the Authorization field on the website, Webhooks section in your bot's settings

pure jolt
#

How I can publish my bot?

sullen nymph
pure jolt
#

Nonono

#

What time its publish my bot?

sullen nymph
pure jolt
#

Ok

pine heart
sullen nymph
#

Mhm

pine heart
#

uh okay

sullen nymph
#

That's what webhookAuth is. It's a password you create and use for confirming that requests are coming from top.gg

pine heart
#

okay thank you

meager saddle
#

How can I get the bot to privately thank a user when voting for the bot?

rain heart
#

have your user be in your server

#

use the webhook

#

then dm the user when they voted

pine heart
#

like can it be anything?

#

and what happens if I leave it blank?

rain heart
#

That's where you enter your webhook url

pine heart
#

ah so I do have to create one on discord

#

pretty obvious haha

#

thx

rain heart
#

No not discord

#

You should get it through your bot

pine heart
#

ah

rain heart
#

Read the documentation closely

pine heart
#

that's what I did for the last hour

#

but okay I will

#

I'm feeling so dumb rn, here it tells me that I have to set up the url, but what url?? like... "the url you want the webhooks to be sent to", where do I want them? I have no idea... :/

rain heart
#

Not the webhook section, check out the section for your bot library

pine heart
#

uh

#

I dont get it.

#

it tells me nowhere how to get that webhook url

rain heart
#

What language is your bot coded in?

pine heart
#

javascript

#

I'm using discord.js

rain heart
#

On the Java Script section on the documentation, scroll down

pine heart
#

hmm k

rain heart
#

You should see something that says webhooks

pine heart
#

webhook events?

plucky lance
pine heart
#

oh lol

plucky lance
#

DBL sends POST requests to YOUR created endpoint.

pine heart
#

why is it so complicated

rain heart
#

If you think it is complicated, then i suggest getting to it once you have more experience in that field

pine heart
#

hmm yes yes I'll see

#

anyways

#

thx

#

for taking your time

restive otter
#

yardım

#

türk yok mu yardım edicek ?

#

😦

#

@left egret yardımcı olabilir misin ?

maiden kettle
#

is there a way to remove server count from your bot's page using the dbl api? (im using js)

#

i'd imagine it's with the .postStats method but i'm not entirely sure

steady steeple
#

Why would you want to remove it

maiden kettle
#

reasons

#

so is there a way to remove it?

steady steeple
#

👀

wheat copper
#

Just don't send the server count?

#

That would work?

maiden kettle
#

ive tried that, it just keeps the old server count

white wyvern
#
const DBL = require("dblapi.js")
    const dbl = new DBL('the top.gg token, I KNOW', bot)

    dbl.on('posted', () => {
        console.log('Top.gg, successfully posted your server count.')
    })

    dbl.on('error', e => {
        console.log(`Oops! ${e}`);
    })
``` doesnt seem to work.
#

Does it take time to post?

blissful notch
#

It should send a POST as soon as your client (bot) becomes ready.

#

After that, 15 minutes.

plucky lance
maiden kettle
#

yeah thats what i thought

#

thanks for the help tho

#

would be nice if they added something to do so in the api, or have an option when you edit your bot's page to turn off server count, shard count, etc

plucky lance
#

Well shard counts are optional but reporting the server count if so is the minimum.

maiden kettle
#

true

gaunt quail
#

how can i test my voting code

plucky lance
#

There's a webhook TEST button

tropic halo
#

Hey guys, is there an event i can use when someone votes for my bot on top.gg? where i can get the users and give them rewards

jaunty plank
#

webhooks.

#

you would fetch the users using your discord bot client, and give rewards with whatever system you make.
the top.gg api just gives you the event for vote.

tropic halo
#

thank you!

restive otter
#

Is the DBL-dotnet-library still being worked on? I want to contribute but there really hasn't been much activity on the repo so I don't know if it's worth it. If anyone from the team is able to answer that would be great 😄

bleak sonnet
#

How do I authorize the api thingy?

jaunty plank
#

^ can get token from there

fringe zephyr
#

why is my server count stuck at 25 servers please help me

#

looked at the pinned message

#

no solutions found

rain heart
#

Post your servercount then

sullen nymph
#

@restive otter I suggest DMing Veld for that question

jaunty plank
restive otter
sullen nymph
#

👍

viral tinsel
#
dbl.on('vote', vote  => {
  client.channels.cache.get("780097750254485524").send(
  new EBBdc.MessageEmbed()
    .setTitle("Codey DBL Service")
    .setDescription(`<@${vote.user.id}> Oy Verdi ! `)
    .setTimestamp()
  )
  client.guilds.cache.get("743584269821149225").members.cache.get(vote.user.id).roles.add("775442552949309512")

  
})

Pls Help Whats Here The Problem

restive lintel
#

Should I use POST and GET requests, or should I use the python API.

naive kestrel
#

@restive lintel what are you trying to achieve?

restive lintel
#

I'm thinking ahead, maybe we can make a stats command which would get the status of the bot on the list, maybe I could make voting rewards.

naive kestrel
#

If you want to get data from an API you have to use a GET request

restive lintel
#

Alright.

rapid kettle
#

its dbl.webhook.on @viral tinsel

reef axle
#

method "on_guild_post" has no argument

#

could you help ?

#

(problem on visual studio code) not in console

#

also getting n/a in top gg

#

python

naive kestrel
#

Please share your code

rain heart
#

read the api documentation

reef axle
#

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

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, autopost=True) # Autopost will post your guild count every 30 minutes

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

`

rain heart
#

Did you replace dbl_token with your dblapi token?

reef axle
#

oh

#

there i will try that

#

sorry

#

also, my bot object is client do i have to change bot for client?

rain heart
#

Best is to read the documentation

reef axle
#

it doesnt say much

rain heart
#

It does mention everything that is important when using the dbl API

naive kestrel
#

If your bot instance is called client, you should rename it to bot, it's a standard

reef axle
#

ok thanks

pulsar palm
#

Hi, where do I start with using the dbl api?

rain heart
#

Read topic of this channel

jaunty plank
wanton saffron
#

I want to get the webhook working with the voting for my bot ( I am using java )
Is there someone who wouldnt mind helping me?

#

I am not sure if I need a webserver for that etc. and I couldnt find a good Webhook listener for java to recieve the vote

rain heart
#

You should be able to use Httpserver for that

wanton saffron
#

so no extra webserver I need to buy?

wanton saffron
#

thats some good news
Do you got any links going a bit further into the webhook thing? It's the first time working with webhook for me

#

😦

dusky monolith
#

it says that it's in 38 servers while it's in 45. I copied the api code from python library in the top.gg api page and replaced "dbl_token" with my dbl token, but still its not working

#

@rain heart could u help?

naive kestrel
#

First of all, I don't think it's a good idea ping people randomly. Btw I think that it should post the server count every 30 minutes, you just need to wait

dusky monolith
#

and its still stuck on 38

#

also yeah im sorry for pinging, but i just saw them chat an hour ago

naive kestrel
#

Can you please share the code? Since you have already posted your server count I thought that it was working correctly but you was impatience to see it change

dusky monolith
#

yes one sec

#

@naive kestrel

naive kestrel
#

Everything seems correct to me, I don't why it doesn't updates your servers count

#

Btw remove "import discord" since you're not using it

dusky monolith
#

k

#

@naive kestrel if you wonder, its not locally hosted

wanton saffron
dusky monolith
#

your channel webhook url

#

go to your channel

#

webhooks

#

create a webhook

wanton saffron
#

huh and I can recieve that then? lol?

#

No thats wrong.

#

or is it wait im confused.

rain heart
#

this is not related to discord channel webhooks

dusky monolith
#

ow

rain heart
#

This is the url for your webhook you presumably made with httpserver now

dusky monolith
wanton saffron
#

I am so clueless

package de.coaster;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class Webhook {

    private static HttpURLConnection con;

    public static void main(String[] args) throws IOException {

        String url = "http://webcode.me";

        try {

            URL myurl = new URL(url);
            con = (HttpURLConnection) myurl.openConnection();

            con.setRequestMethod("GET");

            StringBuilder content;

            try (BufferedReader in = new BufferedReader(
                    new InputStreamReader(con.getInputStream()))) {

                String line;
                content = new StringBuilder();

                while ((line = in.readLine()) != null) {

                    content.append(line);
                    content.append(System.lineSeparator());
                }
            }

            System.out.println(content.toString());

        } finally {

            con.disconnect();
        }
    }
}

I got this class now but I have 0 idea if it would work.

naive kestrel
dusky monolith
#

ah k

rain heart
#

to be able to get the information from the webhooks

wanton saffron
#

ye I'll
thanks.

dusky monolith
#

btw what is more recommended automatic server count or manual

naive kestrel
#

I use manual

rain heart
#

depends on how fast your bot grows, best is to just post it on start

dusky monolith
#

so manual?

rain heart
#

yes

naive kestrel
#

yes

wanton saffron
#

it looks like I need a server in that stackoverflow page 🤔

rain heart
#

Well you need a server to host your bot of course

wanton saffron
#

yeah of course

rain heart
#

You can implement the httpserver inside your bot

dusky monolith
#

alright i updated the code and now we wait 30 mins

wanton saffron
#

like what do I do with that webhook URL
How do I recieve the Data when someone votes

rain heart
#

so for example, on your main(), you could use the following code to start your httpserver that should receive the code:

        HttpServer server = HttpServer.create(new InetSocketAddress(8000), 0); // create a Httpserver listening on port 8000
        server.createContext("/dblwebhook", new MyHandler());  // creates a handler for when a requests comes into https://yourserverip.com/dblwebhook
        server.setExecutor(null); // creates a default executor
        server.start(); // Starts your httpserver
#

your Handler class could then look something like this: lets just let it return "hello world" when a request comes in

public class MyHandler implements HttpHandler {
        @Override
        public void handle(HttpExchange t) throws IOException {
            String response = "Hello World"; // the response
            t.sendResponseHeaders(200, response.length()); // response.length being the length of response, needed in the header 
            OutputStream os = t.getResponseBody(); // get the response outputstream
            os.write(response.getBytes()); // write and
            os.close(); // close
        }
}

wanton saffron
rain heart
#

yes

wanton saffron
#

Alright I've added both classes

#

How could I test it?

rain heart
#

try using postman for example, or make a simple wget through your machine

wanton saffron
#

eh never worked with any of that
can I not use the Test button on the top.gg page?

rain heart
#

it's not going to work yet, this is just to verify that requests are actually able to go through

#

you can also just access http://yourserverip.com:8000/dblwebhook through your browser

#

and it should say Hello World

wanton saffron
#

lemme try.

#

Ah I think the webserver isnt starting.
Somehow it's not going in the main()

rain heart
#

show me your current code