#topgg-api

1 messages · Page 101 of 1

crude wharf
#

oh oops

#

i forgot

restive otter
warped glen
#

The maven API doesn't work for me. I put it all in the pom.xml but I can't use it in a class!

trail sigil
#

-api

abstract mothBOT
#

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

trail sigil
warped glen
#

@trail sigil ja ich meine eure API

warped glen
#

The red one is not recognized.

warped glen
#

Can you also send the guilds from the bot to DiscordBotList with url?

restive otter
#

-api

restive otter
#

huh

warped glen
#

Can I a api in a URL

restive otter
#

Some one help pls

#

i tried add widget

sullen nymph
#

What's the URL you used?

restive otter
#

1 sec

#
      <a href="https://top.gg/bot/589031355829059594" >
  <img src="https://top.gg/api/widget/servers/589031355829059594.svg?noavatar=true" alt="Robot APTKOP" />
</a>
#

@sullen nymph

rapid kettle
#

try png

restive otter
#

tried

#

don't work

#

if i try use iframe

#

it also don't work

#

site blocked

#

in iframe

#

if that mean what i can't use images from website?

#

@rapid kettle

rapid kettle
#

you can probably yes

restive otter
#

but widget don't work

#

how fix that?

#
      <img
        src="https://images-ext-2.discordapp.net/external/l_DF7aVOfYef4f53YedBEpU3TaEMXjvoQvAuVZUxWCs/https/cdn.discordapp.com/avatars/589031355829059594/756b9f1e5fb6ce9d77537bc5cfac134f.png"
      />
      <h1>Robot APTKOP#0955</h1>
      <a href="https://top.gg/bot/589031355829059594" >
  <iframe src="https://top.gg/api/widget/servers/589031355829059594.svg?noavatar=true" alt="Robot APTKOP" /></iframe>
</a>
    </div>```
#

and img don't work

#
<div class="block" align="center">
      <img
        src="https://images-ext-2.discordapp.net/external/l_DF7aVOfYef4f53YedBEpU3TaEMXjvoQvAuVZUxWCs/https/cdn.discordapp.com/avatars/589031355829059594/756b9f1e5fb6ce9d77537bc5cfac134f.png"
      />
      <h1>Robot APTKOP#0955</h1>
      <a href="https://top.gg/bot/589031355829059594" >
  <img src="https://top.gg/api/widget/servers/589031355829059594.svg?noavatar=true" alt="Robot APTKOP" />
</a>
    </div>```
#

@sullen nymph

sullen nymph
#

Try using .png instead

restive otter
#

tried

#

@sullen nymph

#

.png

lyric quartz
#

Do i need to run the webhook code listed in the API docs on a web server or can i run it from within my bot/app?

rapid kettle
#

is that halo dbot

#

it shows offline because it's kicked

#

Do i need to run the webhook code listed in the API docs on a web server or can i run it from within my bot/app?
@lyric quartz you can run it within your bot yes

lyric quartz
#

kicked from this server?

rapid kettle
#

yes

brittle spoke
#

Yes

silk crown
#

are there defined types for typescript available for the dblapi.js library?

lyric quartz
#

hmm, im not sure what this means "Unknown command messages in DM's"

rapid kettle
#

if you do a command that doesnt exist it sends a dm to you

brittle spoke
#

Its like sending it in a channel, but the channel is the users DMs

lyric quartz
#

interesting

#

it does send some of the command response to dm's, because they can get very large

jagged sky
#

was it down for some time. My users didnt get the voting rewards

jaunty plank
#

the webhook stuff can go down sometimes.

restive otter
#

How do i do the member count work

#

I need a help

jaunty plank
rich patio
#

!p

dapper bobcat
#

This might be a bit dumb, but how do I get the server count on the top.gg page? Is it an npm package?

brittle spoke
dapper bobcat
#

ok ty

wheat umbra
#

why did i get blocked from the api?

median badger
#

Error?

wheat umbra
#

too many requests

median badger
#

You made too many requests

#

Cloudflare automatically blocked it

wheat umbra
#

makes no sense

#

why thought

median badger
#

Because you somehow spammed the api

wheat umbra
#

what would randomly spam the api?

#

the package itself?

#

it was spamming the console

#

i had to stop the process

median badger
#

Then you set it up wrong

#

Whats the code snippet?

wheat umbra
#

the bot isn't even mine

restive otter
nocturne hearth
#

So i copy pasted the example for the dblpy library and do I need to call the function?

opaque jetty
#

just add it as a cog

#

maybe ask @sullen nymph for more info, he made the library

sullen nymph
#

Aye

trail creek
#

I need help with setting up webhooks

#

can someone Guide me

unborn canyon
#

just

calm briar
#

just directly ask it

unborn canyon
#

open a port on your PC/VPS and then

#

yeah

trail creek
unborn canyon
#

then you can’t

opaque jetty
#

get a real vps

unborn canyon
#

cause you don’t get a static IP iirc

opaque jetty
#

^, your ip changes every boot

trail creek
#

oki

#

can I do it in glitch?

rapid kettle
#

no

unborn canyon
rapid kettle
#

you dont get a static ip there either

trail creek
#

ok thanks for telling

#

I actually just wanted to know if webhook is actually needed

#

I want to make votelocked commands

#

but can't figure out how

trail sigil
#

there is an endpoint in the api which says if a user has voted for the bot in the past 12 hours

unborn canyon
#

make a trust based system where users promise that they voted and check a box, like the robot checks

[/s]

trail sigil
#

@trail creek javascript?

trail creek
#

yes

#

@trail sigil

trail sigil
#

to see if the user has voted in the past 12 hours

#

you can probably use that to votelock stuff

trail creek
#

uh

sullen nymph
#

cause you don’t get a static IP iirc
@unborn canyon You get a URL on repl.it

trail creek
#

@trail sigil

unborn canyon
#

that’s a jslib

#

@unborn canyon You get a URL on repl.it
thanks for informing me<3

trail sigil
#

(tho it seems you might be able to use webhooks if you really want to)

trail creek
#

dbl.hasVoted(id)?

trail sigil
#

yup

sullen nymph
#

You can host a webhook on repl.it. Your URL will be a repl.co domain with some long subdomain

trail creek
#

oh thanks

sullen nymph
#

Your port will be 8080 but you must not set it in the URL

trail creek
#

I am getting this:
Promise { <pending> }

#

when I did console.log(dbl.hasVoted(id))

trail sigil
#

just await it

sullen nymph
#

Resolve the promise

trail creek
#

oh

#

I have already voted the bot, but it is returning false

#

is it because I voted it before I used API?

sullen nymph
#

The API can have slight delays

trail creek
#

oh

restive otter
#

Hello, I have a problem with the API on top.gg, and when I want to click on Regenerate Token, nothing happens.

restive otter
#

Hi

#

Yeah-idk how to explain this in an understable way, so I'll just do my best.. how do I get my bots server count on DBL/top.gg?

#

Am I in the right place?

#

Oh, it was already asked.

rapid kettle
#

for the api

#

thats how you post the server count

regal valley
#

lol

harsh pewter
#

mok

trail sigil
#

-api

abstract mothBOT
#

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

velvet pond
#

Incorrect stats being posted in discord.js sharding

async function pushCount(client) {
    console.log('post count');
    const dbl = new DBL(keys.dbl);
    const count = await sharding.serverCount(client);

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

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

    dbl.postStats(count, client.shard.ids[0], client.shard.count).then(console.log)
}

API shows 3k+ (https://top.gg/api/bots/699844962057060393/stats), but the count is not even 2.2k.

#

and yes, count returns the correct thing.

#

oh wait

#

hang on

#

ayee fixed

#

I recommend changing "The server count of your bot." to "The server count of your client." that was my problem.

river bone
#

if more than 1 people vote at the same time vote count fails to get updated in time and gets repeated
any way to fix that?

candid torrent
#

Can someone pls provide me with a list of essential bots needed in a server

restive otter
#

@mighty shuttle -api

calm briar
#

you dont need to send that in every channel

river bone
#

waiting

lean harbor
#

-api

restive otter
#

I have not used your API in my bot yet do I have to do it before approval

vapid cape
#

No

#

You cant use the api before approval anyway

surreal spear
#

anyone able to he;lp me with setting up the API Options part?

#

Not to sure about it

bronze schooner
#

if I have two bots on the same ip, would I use a different webhook auth, or should I use a different port? Just because if someone voted the event went through on both

vapid cape
#

Either different port or simply check vote.bot

#

To see which bot the vote was for

bronze schooner
#

right ok that makes sense

tulip sorrel
#

in js dbl.webhook.on('vote', vote => { console.log(`User with ID ${vote.user} just voted!`); });does vote.user return a user or a guildMember?

rapid kettle
#

It only returns an ID

tulip sorrel
#

oh

#

it returns the id of the user who voted

#

right?

rapid kettle
#

Yes

tulip sorrel
#

ok thanks

silk echo
#

Hello, sorry to be asking you again.
How does the bot send a MESSAGE after a user votes? GWseremePeepoThink

rapid kettle
#

Well

#

Do you have a webhook setup?

silk echo
#

more this time I switched to repl.it

rapid kettle
#

you cant do it with repl iirc

silk echo
#

you cant do it with repl iirc
@rapid kettle hm 😕

#

ok

#

I thought I could GWsetmyxPeepoCry

stiff gust
#

`

#

.

wanton marten
#

how do I change the name of the vote webhook?

royal veldt
#

what is api?

hearty lintel
rapid kettle
#

he just asked what it is berry

hearty lintel
#

it explains what it is 4head

#

This channel is only for SUGGESTIONS/HELP/BUGS to do with OFFICIAL API LIBRARIES and API DOCS found at: https://top.gg/api/docs

rapid kettle
#

tl; dr
the top.gg api allows you to
1 - Get bot info
2 - Post server counts
3 - Get votes via webhooks
4 - Check if people have voted

#

the end.

royal veldt
#

yes @rapid kettle is correct

#

i only asked wut it is

#

i may look at it l8er but what is api?

rapid kettle
#

read the message above

drifting saffron
#

How often can we push the guild count? What's the recommendations by top.gg?

#

Please ^

empty jay
#

is there API to get a webhook for when I edit the bot's top.gg page? like to send a notification to a channel like I do with votes?

#

oh nvm I see the list above me.

rapid kettle
#

How often can we push the guild count? What's the recommendations by top.gg?
@drifting saffron 15 minutes is the minimum (using autopost), 30 minutes is recommended (default in the autoposter)

drifting saffron
#

Cheers 🍻

rapid kettle
#

is there API to get a webhook for when I edit the bot's top.gg page? like to send a notification to a channel like I do with votes?
@empty jay there isn't iirc

#

No problem!

sullen nymph
#

Recommendations are just "as long as it's not a ridiculous period of time"

rapid kettle
#

like 3 seconds

drifting saffron
#

Wasn't dreaming of three seconds hehe

sullen nymph
#

Then yeah, we're all good here 👍

drifting saffron
#

Was thinking every hour or 2 ? Is that good with you guys?

rapid kettle
#

yea thats good

sullen nymph
#

For sure

drifting saffron
#

Cheers 🍻

hearty lintel
#

is there API to get a webhook for when I edit the bot's top.gg page? like to send a notification to a channel like I do with votes?
@empty jay im sure if you really wanted to you could listen to #logs lol

#

but not through the api so ye

empty jay
#

I know it’s in Logs. I’m not stupid. But I want it to automatically post in my server too

hearty lintel
#

twas just sayin

merry zodiac
#

I keep getting this warning

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002B50D99BCC0>

When I try to get the uservote status

    token = ''  # set this to your DBL token
    _dblpy = dbl.DBLClient(bot, token)

    vote = await _dblpy.get_user_vote(int(ctx.author.id))
    await ctx.send(vote)

The code works perfectly fine, it sends you vote status but I just wanna know why I'm getting the warning

sullen nymph
#

You're not closing the bot, well, properly enough

#

It's not a significant issue though. You are essentially closing the bot while it's processing a request

merry zodiac
#

ah i see, thanks!

sullen nymph
tulip sorrel
#

how can i execute some code whenever a user votes using the api

quiet iron
#

hi, what's a good way to detect voting with a sharded bot? (using the npm dblapi.js library)

#

i can't really do it in the main index.js, do i do it in a separate voting_detection.js file or something?

quiet iron
#

nvm my vps is just being stupid

signal hawk
#

-api @restive otter

abstract mothBOT
#

@restive otter

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

astral prawn
#

can someone please help me how to setup webhook to receive votes

#

i am using discordjs

deft thicket
#

Oof

foggy plume
#

@surreal spear helii

restive otter
#

can someone please help me how to setup webhook to receive votes
@astral prawn instead of begging why not read the docs

sullen nymph
#

How about being more helpful instead of telling people to rtfd

astral prawn
#

@astral prawn instead of begging why not read the docs
@restive otter not begging i read the docs but on a sharded bot not sure where to use the code

restive otter
#

pretty sure sharding doesn't make any difference

#

in the case of top.gg api atleast

astral prawn
#

thanks for the info

restive otter
#

do you need help with setting up the webhooks and stuff

restive otter
#

this will send smth when someone vote ?

dbl.webhook.on('vote', vote => {
  const channel = client.channels.get('717763226078543954');
  
  channel.send(`User with ID ${vote.user} just voted!`);
});
rapid kettle
#

yes

#

if you have it setup right

hollow leaf
#

hi today i was trying to test the code to upload server count on top.gg but idk why it showed that the bot is in ~700 servers while its actually in ~1400 servers

#

earlier i was using just the manual server count code on top.gg website but today i was trying manual count with webhooks code which resulted in this problem

rapid kettle
#

Is it sharded?

hollow leaf
#

yes!

sullen nymph
#

Oh dear God help my soul

rapid kettle
#

It takes whatever posted

sullen nymph
#

How are you posting server count

rapid kettle
#

I'd assume it doesn't just calculate it itself

sullen nymph
#

Built-in shards aren't supported, dblpy simply gets client.guilds if you didn't specify anything in post_server_count

hollow leaf
sullen nymph
#

Fucking Christ

hollow leaf
#

did i mess up SadCat

sullen nymph
#

No I just didn't upload 0.4.0 on pypi that actually adds support for manual guild count

#

before that version, all dblpy did is get length of client.guilds

#

I can't think of a proper way to handle sharding before 0.4.0 so you'd either have to post server count manually with aiohttp or update to 0.4.0 by pip install git+https://github.com/top-gg/DBL-Python-Library

#

(The command may fail, so refer to the README in the dblpy repository on GitHub)

hollow leaf
#

okay thanks

sullen nymph
#

The documentation on dblpy.rtfd.io is up-to-date with 0.4.0 so feel free to use it for reference

#

Also you can report this on the github repo so that I could be reminded of this issue tomorrow

azure mural
#

Hello

sick radish
#

so it says I can make 60 requests per minute for the API, does this include checking if a user has voted?

opaque jetty
#

no

#

i make way more than that and i don't get ratelimited @sick radish

#

its only for posting votes/shards iirc

sick radish
#

oh cool
so that means i can iterate through 100's of people that want to get reminded for voting and check if they voted or not without getting ratelimited?

opaque jetty
#

i would just use the votes endpoint instead of checking every single one

sick radish
#

ohh, the one that returns the last 1000 votes

sullen nymph
#

Or just use webhooks instead of abusing the API

astral prawn
#

how to know if user has opt for voting reminder?

signal hawk
#

That isnt a part of the api

unborn canyon
#

@reef shuttle it only has one command which is ping, and this isn’t the channel for it, #general

reef shuttle
#

sry

#

and thx

sick radish
#

when you click on the test button in the edit page, is the webhook supposed to post something in the channel you set it to?

ivory ridge
#

what am I supposed to type in webhookAuth parameter (dblapi.js)?

#

and is the webhookPort required?

gaunt sierra
#

How do i make a code where people who voted will get bot currency?

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

// Optional events
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 at http://${hook.hostname}:${hook.port}${hook.path}`);
  });
  dbl.webhook.on('vote', vote => {
    console.log(`User with ID ${vote.user} just voted!`);
    message.channel.send("", {
        embed: new Discord.MessageEmbed()
        .setDescription(`${vote.user} Thank you for voting, Here's your free $10K :dollar:`)
    })
  });
  dbl.isWeekend().then(weekend => {
    if (weekend){
         console.log("Woo! Multiplier time!")
    let guild = client.guilds.cache.get('735382037090795541')
    client.channels.cache.get('735521714540118136').send(`Multiplier time! You know what that means!! :eyes:
    x2 :dollar: when voting in https://top.gg/bot/688121834494885920/vote`)
    }
});
restive otter
#

@topaz wyvern

#

important add me

errant pine
#

Hi guys. ```cs
await ApiClient.HasVoted(userId);

always returns false. Any ideas why? / userId is correct, and user with this id voted in the last 12 hours. And the ApiClient is properly setup instance of `AuthDiscordBotListApi`.
merry zodiac
#

How can I make a webhook send a message in a channel in my support server if someone votes for my bot?

merry zodiac
#

sorry i dont know much about webhooks in general but what does this mean and how can i fix it

radiant pollen
#

Heya, I know there is an API for when users vote for bots. Is there an equal one for when a user votes for a server?

signal hawk
#

@radiant pollen not yet

gaunt sierra
#

I cannot find a way to use the api to reward users when they vite im on JS please help.

rapid kettle
#

use a dbl webhook

gaunt sierra
#

Yes, I've been in there but I still can't get it to log once a user votes @rapid kettle

rapid kettle
#

What's your code

gaunt sierra
#

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

// Optional events
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 at http://${hook.hostname}:${hook.port}${hook.path}`);
  });
  dbl.webhook.on('vote', vote => {
    console.log(`User with ID ${vote.user} just voted!`);
    message.channel.send("", {
        embed: new Discord.MessageEmbed()
        .setDescription(`${vote.user} Thank you for voting, Here's your free $10K :dollar:`)
    })
  });
  dbl.isWeekend().then(weekend => {
    if (weekend){
         console.log("Woo! Multiplier time!")
    let guild = client.guilds.cache.get('735382037090795541')
    client.channels.cache.get('735521714540118136').send(`Multiplier time! You know what that means!! :eyes:
    x2 :dollar: when voting in https://top.gg/bot/688121834494885920/vote`)
    }
});

client.on('ready', async() => { 
//rest of my index.js code```
rapid kettle
#

ok so

#

message.channel doesn't exist

gaunt sierra
#

Not jsut that

#

It just doesn't log

#
console.log(`User with ID ${vote.user} just voted!`);```
#

^^ doesn't log

rapid kettle
#

dbl.isWeekend isn't a thing iirc

#

its only vote.weekend

#

So, what are you putting into the top.gg page?

gaunt sierra
#

Nothing rly, Just want to get logs once a user votes

#

And from there im off myself.

rapid kettle
#

you need to put stuff there

#

where do you host?

gaunt sierra
#

Local computer.

rapid kettle
#

Ah.

#

Do you have a port forward

gaunt sierra
#

What is that?

rapid kettle
#

You need it for traffic to get to your PC

gaunt sierra
#

Ow

#

Isn't that the one that opens up everything

rapid kettle
#

No.

gaunt sierra
#

Which lets people to ddox me or sum

rapid kettle
#

no people can ddos you anyways

gaunt sierra
#

Oh ight

#

Mind telling me how to "Port forward"?

#

I can screen share.

rapid kettle
#

It's in the router settings

gaunt sierra
#

he um

#

the um

rapid kettle
#

192.196.1.1 is commonly the router's IP

gaunt sierra
#

is it that

rapid kettle
#

yes

gaunt sierra
#

only see ipv4 adress

#

mac

#

upnp mode enabled

#

in router section

#

"LAN SETTINGS"

rapid kettle
#

then your router probably doesn't support it

gaunt sierra
#

..oof

#

does that mean i can't do that?

rapid kettle
#

yes

#

you can use a seperate claim command tho

#

and use dbl.hasVoted

gaunt sierra
#

This?

rapid kettle
#

yes

gaunt sierra
#

What's the id after dbl.hasvoted

#

?

rapid kettle
#

thats the user ID

gaunt sierra
#

Oh

#

Is it only for selected people

rapid kettle
#

no

gaunt sierra
#

Or can i do like js message.author.id

rapid kettle
#

you can yes

gaunt sierra
#

Ayee

#

Thank you bruvvv

#

absolute legend.

#

1 more question

#

@rapid kettle Do i put this in the index.js file

#
dbl.hasVoted(message.author.id).then(voted => {
    if (voted) console.log(`${message.author.tag} has voted!!!`)
});```
rapid kettle
#

no

#

you can put it in the message event

gaunt sierra
#

ight

ivory ridge
#

is it possible to use the dbl webhooks in heroku?

rapid kettle
#

no

ivory ridge
rapid kettle
#

yes

ivory ridge
#

where should I send the request?

#

and what does the hasVoted mean?

#

I mean, does it count a vote made a year ago?

rapid kettle
#

no

ivory ridge
#

and which votes does it count?

rapid kettle
#

the ones within the last 12 hours

ivory ridge
#

so the last one

#

well, thank you

gaunt sierra
#

@rapid kettle js dbl.hasVoted(message.author.id).then(voted => { if (voted) { console.log(`${message.author.tag} has voted!!!`) client.channels.cache.get('748224161519894600').send(`${message.author.tag} has voted for the bot.`).catch((er) => {}) } });

#

It just logs saying "author has voted" everytime someone sends a messasge

rapid kettle
#

no idea

ivory ridge
#

because voted will be there always

gaunt sierra
#

What can i do to fix it?

ivory ridge
#

even if no voted

rapid kettle
#

try turning it to a boolean?

ivory ridge
#

idk I'm using request to check it not dblapi.js

gaunt sierra
#

and whats a boolean

#

💀

ivory ridge
#

true or false

rapid kettle
#

bruh

gaunt sierra
rapid kettle
#

you dont know a boolean?

#

@gaunt sierra that is port forwarding create a new rule

#

although you dont need it for a .hasVoted

gaunt sierra
#

meh

#

i'll need it

#

for the first one

#

yk

rapid kettle
#

no?

#

what

gaunt sierra
#

.

#

Wait

rapid kettle
#

thats only for webhook

gaunt sierra
#

im just confused

#

how can my code

#

not work

#
 dbl.hasVoted(message.author.id).then(voted => {
    if (voted) {
         console.log(`${message.author.tag} has voted!!!`)
         client.channels.cache.get('748224161519894600').send(`${message.author.tag} has voted for the bot.`).catch((er) => {})
 }
});```
#

it's all right

rapid kettle
#

Boolean(voted)

#

try that

ivory ridge
#

what does voted is?

#

is a boolean or object?

rapid kettle
#

wait it could be an object

ivory ridge
#

add return console.log(voted)

#

to see what it is

gaunt sierra
#
 dbl.hasVoted(message.author.id).then(voted => {
    if (voted) {
         console.log(`${message.author.tag} has voted!!!`)
         console.log(voted)
         client.channels.cache.get('748224161519894600').send(`${message.author.tag} has voted for the bot.`).catch((er) => { /* handle promise rejectin gracefully */ })
 }
});```
#

?

ivory ridge
#

yup

#

execute it and see the console

gaunt sierra
#

Whenever someone sends a message

#

"true"

#

It's in the "message" section

rapid kettle
#

it may be that you have voted

ivory ridge
#

then it is a boolean

gaunt sierra
#

client.on('message') thing

#

it may be that you have voted
@rapid kettle hol up then

rapid kettle
#

wAIT

#

SHOULD IT BE AWAITED?

#

it returns a promise?

gaunt sierra
#

i think it should be awaited lmao

rapid kettle
#

try it

gaunt sierra
#
 dbl.hasVoted(message.author.id).then(voted => {
await voted
    if (voted) {
         console.log(`${message.author.tag} has voted!!!`)
         console.log(voted)
         client.channels.cache.get('748224161519894600').send(`${message.author.tag} has voted for the bot.`).catch((er) => { /* handle promise rejectin gracefully */ })
 }
});```
#

?

rapid kettle
#

await dbl.hasVoted

ivory ridge
#

no

#

if it has .then wait is not needed

#

but it would be easier

#
let vote = await dbl.hasVoted(message.author.id)
if(vote) {
console.log(message.author.tag + ' has voted!')
}```
rapid kettle
#

thank

restive otter
#

Oofers

gaunt sierra
#

Someone finally help me smh

#

This is giving me cancer

#

I want it to only log when a user has voted

#

Not 24/7

restive otter
#

You should set up the webhook

gaunt sierra
#

Webhook?

restive otter
#

No not it

gaunt sierra
#

How do i do it?

restive otter
#

@gaunt sierra Where do you host before anything

gaunt sierra
#

Local pc

#

In a VPS in the future

restive otter
#

You can go to your bot's page on top.gg, click on edit, go to bottom, there's the input where you can put a webhook and a password

#

A webhook example
https://localhost:3000/dblwebhook

restive otter
#

Password can be anything

restive otter
#

First one is the webhook, second, a password

gaunt sierra
#

So, anything?

restive otter
#

Password can be anything

gaunt sierra
#

URL ?

restive otter
#

Just something that you can remember and keep your webhook secret

#

That url is the webhook

#

Go a bit above

#

I showed how to do a webhook

gaunt sierra
#

So i just paste this in yeah?

restive otter
#

Yes that can work

gaunt sierra
#

Ight bet

rapid kettle
#

no

#

no it wont

restive otter
#

Why not

rapid kettle
#

it has to be your IP address

#

the public one

#

not just localhost

restive otter
#

Oh yea

#

I forgot

#

@gaunt sierra replace localhost with your public ip

#

Don't show us your ip tho

gaunt sierra
#

ion know my public ip

#

;-;

#

?

restive otter
#

Just google it?

restive otter
#

"What is my ip"

gaunt sierra
#

This thing

restive otter
#

Yes

gaunt sierra
#

Okay

#

Saved it, Now what?

restive otter
#

After you put that in, save and click on test

gaunt sierra
#

"webhook tested! this may take a few minutes"

rapid kettle
#

If you have a portforward setup it'll work

#

if not it won't

gaunt sierra
#

Not sure if I have that^^

restive otter
#

Now in your code

let dbl = new DBL(<Your dbl token>, { webhookPort: 3000, webhookAuth: "Your password" }, <client>);```
restive otter
#

Now to receive the voted user

#
dbl.webhook.on("vote", async votedUserID => {
let getVotedUserObj = await <client>.users.fetch(votedUserID);
console.log(`User ${getVotedUserObj.tag} has voted!`);
});```
gaunt sierra
#

imagine if this works

#

Now i just need someone to vote

restive otter
#

Give link i'll vote

gaunt sierra
#

Okay

restive otter
#

Did it work

gaunt sierra
#

nope...😭

#

it says 0.0.0.0

#

not my ip

#

hm

restive otter
#

Hmm you can make a request to your webhook on https://reqbin.com to make sure it's working

#

Or .net i forgot

gaunt sierra
#

Operation timeout.

If you use a firewall, you need to add an exception for ReqBin servers (US: 206.189.180.4, DE: 139.59.147.204) or use ReqBin Google Chrome Extension.

Error code: 10028

restive otter
#

Huh

#

@gaunt sierra When did that happen?

gaunt sierra
#

wdym

restive otter
#

Trying to enter the website?

#

When that happened?

gaunt sierra
#

No

#

When i pasted in the link

#

and token as the password

#

and clicked on send

restive otter
#

Show an screenshot

#

Don't show the webhook

rapid kettle
#

aH

#

i know

#

they haven't port forwarded

restive otter
#

Wot does that even mean

gaunt sierra
restive otter
#

Post request not get

gaunt sierra
#

post?

#

still

restive otter
#

O wait

#

Omg

#

it has to be http not https

#

@gaunt sierra Try changing the one and dbl from https to http and try with changing from https to http on request bin too

gaunt sierra
#

lol

#

still

#

the same thing

#

I think we really need port forward

#

But idk how to do it, Do you?

rapid kettle
#

you do need to

#

thats what i've literally been saying it

restive otter
#

We don't even need that, i don't do

rapid kettle
#

@restive otter you do

#

you do need that LUL

gaunt sierra
restive otter
#

How tf am i not using one then

restive otter
#

@gaunt sierra It shows the same for me

#

But works

rapid kettle
gaunt sierra
#

weird

restive otter
#

It shows all of them as 0 to protect it

rapid kettle
#

you need to port forward voltrex

#

you have to

restive otter
#

I mean... How am i not using one and it works

#

Confused

gaunt sierra
#

my life is advanced

#

so imma try doing a port forward thing

#

@restive otter Wanna join the support server and help me there later on?

#

@rapid kettle How'd I do port-forwarding?

rapid kettle
#

@restive otter where do you host

restive otter
#

Vps witherhosting

gaunt sierra
#

vps

#

and im on local pc

rapid kettle
#

vps has all ports forwarded

#

automatically

restive otter
#

ExcusemeWtf K then

gaunt sierra
#

@rapid kettle

rapid kettle
#

Ok nice.

#

So local IP is your private ip right?

gaunt sierra
#

ig

rapid kettle
#

so start and end ports are 3000

gaunt sierra
#

local ip

#

do i change it

#

it asks me to put in something in the very end

#

i have .1.1

#

and it's .1.[]

#

Protocol TCP?

rapid kettle
#

yes

#

local ip is the private ip of your pc

#

you can get it by running ipconfig in cmd

gaunt sierra
#

I have diffrent ip on my pc

#

lol

#

starts on 188

#

on phone 192

rapid kettle
#

on phone 192
@gaunt sierra thats private ip

#

not public

gaunt sierra
#

ooohh

rapid kettle
#

thats my private ip

gaunt sierra
#

So i don't change the end?

rapid kettle
#

so if i wanted to port forward this laptop i'd put 192.168.1.254

rapid kettle
#

ok so go to the pc

#

and open cmd

gaunt sierra
#

mhm?

rapid kettle
#

type ipconfig

#

and it'll say IPv4 Address somewhere

#

that is the ip you wanna put in that box

gaunt sierra
#

f i gtg

#

mind adding me

hearty lintel
#

@willow sphinx any updates on the lib?

willow sphinx
#

the PR looked ok to me but I'm going to have to check in with Veld first. Tonkku was pretty strict on stuff so I want to make sure Im reviewing things a similar way idktbhprollyanod

hearty lintel
#

so do you plan on taking over operations of the lib?

#

or are you gonna find sum1 else?

median badger
#

@small crow need any help?

restive otter
#

how to i get a token for using API ?

median badger
#

Your bot needs to be approved

restive otter
#

ooo

#

ok

compact gust
#

how to setup webhook for vote?

fluid marsh
#

wow

crude wharf
#

oof

ruby kiln
#

Can anyone help me with the API reference, I got the error 403

azure drift
#

what's a api link? I've seen them before but have no idea what they are, also how do I make one? I'm very new with that kinda stuff

ruby kiln
#

same problem as you

restive otter
#

Hmmmm

short edge
#

How long does it take for votes to update

austere swallow
#

they should update almost instantly, are you using webhooks or no webhooks?

vapid sapphire
#

So I'm trying to setup the webhook for votes I followed the docs and set everything up but it does not work and I don't know whats wrong. If someone is willing to help me troubleshoot I would really appreciate it.

restive otter
#

Can someone help me with the Voting API please and thank you

light lark
#

hey i was wondering does anybody know about a auto dicord counter

#

like 1 to infinity

#

dm me if you find one!

restive otter
#

Where do I put the authorize token

#

after /votes?

#

or

rapid kettle
#

no you use it as the authentication header

restive otter
#

what

#

where

#

bruh I'm so confused

rapid kettle
#

ok @restive otter what fetch do you use

restive otter
#

wym

rapid kettle
#

to fetch the votes

restive otter
#

the link?

rapid kettle
#

no?

#

the module you use

restive otter
#

Ohhhhhhhhh

#

aiohttp

#

am I dumb? lmao

rapid kettle
#

that is it

restive otter
#

what

rapid kettle
#

aiohttp is it

restive otter
#

ok

rapid kettle
#
url = 'https://top.gg/api/bots/430858553952174090/votes'
headers = {'Authorization': 'top.gg api token'}
``` should work
#

i've never used python so just an assumption

#

also, have you looked at the dblpy wrapper?

restive otter
#

I don't use session.post what is that?

#

await

#

why am I posting

#

i'm confuised

rapid kettle
#

ok so am i

#

just add that as params

restive otter
#

uh

#

where lol

#
            async with session.get("https://top.gg/api/bots/430858553952174090/votes") as search:
                result1 = await search.json()```
#

somewhere there?

#

ik you don't use python

#

err

#

Idk

#

lmao

rapid kettle
#

im gonna ask again

#

have you looked at the dblpy api wrapper?

restive otter
#

uh

#

prolly but could you link me?

#

oh

#

wait

#

You mean do I have the DBL api wrapper or

rapid kettle
fresh bough
restive otter
#

That doesn't really help me

#

maybe I need something like await self.dblpy.get_user_vote()

polar vigil
#

what we can do with discord bot list api's

sullen nymph
#

get_bot_votes from dblpy is the non-rate-limited equivalent of

async with aiohttp.ClientSession() as session:
    async with session.get("https://top.gg/api/bots/430858553952174090/votes") as response:
        return await response.json()``` @restive otter
#

It's easier to just call a method instead of writing all that crap

restive otter
#

Yeah

#

I noticed

#

and

#

alot easier

jagged thicket
#

^^

delicate bay
#

so im trying to use dbl.hasVoted(user) but im getting this error

#

seems like its coming from the module?

#

i just checked the file and i see _request defined so im very confused

restive otter
#

Lol

topaz verge
#

i try to make bot when someone vote for bot tells me in the console log

const dbl = new DBL("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY1MjE1NjQ5MDgxOTQzNjU0NCIsImJvdCI6dHJ1ZSwiaWF0IjoxNTk2MjY2NTE0fQ.B6in9IIpMMX6VhgjEhgJ8jBb-QcUAcfIFKjfTnpzjV8", { webhookPort: 5000, webhookAuth: 'aluahuhdaj@!$@12' });


client.on("ready", () => {
    setInterval(() => {
        dbl.postStats(client.guilds.cache.size);
    }, 1800000);
});
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 at http://${hook.hostname}:${hook.port}${hook.path}`);
  });
  dbl.webhook.on('vote', vote => {
    console.log(`User with ID ${vote.user} just voted!`);
  });
#

i reset the token

topaz verge
#

no one will help me :<

topaz verge
vapid cape
#

did you configure your webhook in your bot's edit page in top.gg?

#

where is your bot hosted?

restive otter
#

luffy :0

sharp vigil
#

quick question what would i recieve if i clikc on webhook test?

#

like how would i know the test worked O_o

rapid kettle
#

It does a thing in the code if it’s working

sharp vigil
#

O_o

#

what Thing

rapid kettle
#

dbl.webhook.on("vote"

devout jungle
#

Hi guys. I want to be Bot Developer role. What I can?

#

I made it

brave veldt
#

I made it
@devout jungle submit it on top.gg then wait for them to approve

devout jungle
#

Okey i did it but it's not approve. How long does it take to be approved

unborn canyon
#

read pins in support

topaz verge
#

did you configure your webhook in your bot's edit page in top.gg?
@vapid cape yes
where is your bot hosted?
@vapid cape in my pc for testing

vapid cape
#

if you're testing on your pc, you will likely need to port forward your router because it blocks ports by default

#

its easier to test in a server

sage fog
#

Does top.gg API count in how much server is my bot ?

trail sigil
#

no, you need to tell top.gg how many servers your bot is in

#

there is no way for us to automatically tell otherwise

sage fog
#

Thanks , did you know how i can see in how much server is my bot ?

trail sigil
deft oak
#

Hi

restive otter
tribal pine
#

guys

exotic coral
#

good

tranquil fox
#

Hello ! I want to add a feature to my bot that requires the user to vote. Example, he executes the help command, the bot returns "you must vote for the bot on top.gg to use the bot!" If the user has not voted. Is this considered api abuse or not?

trail sigil
#

those are the rules for voting

#

ensure you keep within ratelimits too

tranquil fox
#

Thx

#

So

#

It's api abuse

willow spindle
#

no?

restive otter
#

hii

#

i want nitro

#

what i do

willow spindle
trim lily
#

hi what is the name of the game @restive otter

#

@everyone

turbid stone
#

@trim lily rocket league

trim lily
#

thanks a lot ❤️

turbid stone
#

upd ^^

signal hawk
#

-api

abstract mothBOT
#

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

trail sigil
#

-notr @restive otter

abstract mothBOT
#

@restive otter

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

restive otter
#

-api

#

;-;

willow spindle
#

@jaunty depot ^ eyesLeft

jaunty depot
#

done

#

👍🏻

restive otter
#

hey how do i get the webhook port and auth?

#

never used api webhooks before ^

#

actually nvm i got it

opaque jetty
#

but the docs define it as async def post_guild_count(self, guild_count: int = None, shard_count: int = None, shard_no: int = None):

#

so how would it work without defining it via a karg

#

@sullen nymph

unborn canyon
#

@restive otter

sullen nymph
#

@opaque jetty you still need help?

opaque jetty
#

yes

#

i was just mostly concerned on how what the docs suggested could possibly worked

#

i already use dblpy to submit my server count

#

and all i want to do is submit my shard count as well

#

i've read the docs

sullen nymph
#

All of the args are positional and optional

opaque jetty
#

is there anyway to do shards with autopost?

#

without doing it manually

sullen nymph
#

Mmm. No, I highly doubt that's supported

opaque jetty
#

so then how would i do shards as there isn't any docs on them

#

i see they are in the source code though so it seems like they are supported

sullen nymph
#

Manually?

#

d.py has built-in sharding I never worked with

opaque jetty
#

no im talking about sending shard number to the api

#

i know how to shard lol

sullen nymph
#

oh

opaque jetty
#

as in, i have a variable with the number of shards, i just want to send it to top.gg using dblpy

sullen nymph
#

shard_no is a shard to post server count for
shard_count is self-explanatory
guild_count is either globally or per-shard if in a list

#

Fuck, I need to add support for List[int] in guild_count

opaque jetty
#

and this can't go through autopost, it has to be manually

#

ok that makes sense

sullen nymph
#

Yeah. I'm not sure if I can just rely on a property like .shards :p

opaque jetty
#

also idk if you have access to it, but the dblpy docs at top.gg/api/docs don't include most stuff, which confused me for a while until i found the repo's readme

#

maybe have them sync/make a iframe in the page to the readme?

#

but its probably more of a web admins question

sullen nymph
#

Yeah, they're planned to be updated once I'm done rewriting the README on GitHub

opaque jetty
#

wait and just to be clear, i should be using await self.dblpy.post_guild_count(server_count, shard_count=shard_amount)

sullen nymph
#

Hmm. Not sure if that'll work as expectedz but you can give it a try

opaque jetty
#

wait is thats not the proper way to do it what is

#

isn't this a pretty common use case?

sullen nymph
#

Most common use is to either use a list wirh server count per-shard or send multiple request where shard_no is an incremented value (a for loop, basically)

#

But since I'm not sure if dblpy properly supports lists, it'll take me a bit more time to roll out an update

#

Because shard_no is a shard to post the server count to

opaque jetty
#

so your saying i can do await self.dblpy.post_guild_count([1k,1k,1k]) etc etc

#

that actually seems pretty useful

sullen nymph
#

Not tested but feel free to give it a try

opaque jetty
#

quick question:

#

what is tested

#

cause i want to make sure it works in prod cause i don't have a testing env

sullen nymph
#

You might want to wait until 0.4.0 where I'll probably add it as a definitely working feature

#

Oh, yeah. Also, since 0.4.0, you'll be able to post server count to a listed bot under the specified top.gg API token

#

So, consider that some sort of upcoming "testing environment" :^)

opaque jetty
#

time to ditch dblpy then

#

and just use requests

#

who cares about async

sullen nymph
#

At least use aiohttp you disgrace

opaque jetty
signal pendant
#

requests will block other important requests to the Discord API

#

aiohttp is asynchronous which makes it ideal for discord.py

#

if you're going to use requests for discord.py you might as well do time.sleep(5) in your code

north trellis
#

hey, how can a make a system like: when you use the command you have to vote to use it again

unique ore
#

I can't seem to track the votes. Someone can help me pls ?

restive otter
#

hey, how can a make a system like: when you use the command you have to vote to use it again
@north trellis track the user's votes and unlock them until they use it then lock em again

unique ore
#

@restive otter, can you help me pls ? 🙂

restive otter
#

don't ping me randomly lol

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

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

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

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

sorry

#

I use that code

restive otter
#

I'm not very experienced with the API

#

so

#

ask @vapid cape he loves pings

vapid cape
#

lmao

#

did you configure your webhook in your bot's top.gg edit page?

sullen nymph
#

-api

abstract mothBOT
#

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

idle mantle
#

ow sorry

north trellis
#

how can i use custom html?

willow spindle
#

long description supports html

#

just add your code

plush swallow
#
    client.channels.cache.get('749648839073464352').send(`Thanks alot, <@!${vote.user}>, for voting!`);
});```
Does something seem wrong with that? No errors or anything, but there's also no message in the channel I provided ![thonk](https://cdn.discordapp.com/emojis/684488556844154905.webp?size=128 "thonk") 

dbl api is active, cause I can see `Server count posted` after starting my bot
restive otter
#

dbl is just going nuts

sullen nymph
#

While reworking how dblpy's post_guild_count function works, I've thought of possibly making the bot object be an optional argument for DBLClient.

In that case, most functions would have to return exceptions if ID wasn't passed in the function, same applying for client object in DBLClient.

My question here is, how unnecessary of a change would you consider this to be?

plush swallow
#

dbl is just going nuts
@restive otter well yes, it seems to be going nuts. After a reload:

rapid kettle
#

@plush swallow wouldn't it be dbl.webhook.on?

restive otter
#

^

plush swallow
#

👀 damn where did I get that example from - Looks like that's the problem here

rapid kettle
#

aye no problem

sullen nymph
#

Oh, the example for JS library is fixed

plush swallow
#

Was it fixed just now or did I simply overread the dbl.webhook ?

sullen nymph
#

Seems that you overread it :p

rapid kettle
#

yea ^

plush swallow
#

dang, ok thx 😄

rapid kettle
#

it was there when i first implemented webhook

sullen nymph
#

I remember addressing this issue before but never checked in on it so I can't say when it was fixed

plush swallow
#

So this little Test button only worked after clicking it a couple of times (with delay inbetween, no spamming) - But it seems to work now 👌

mild wren
#

How do I integrate a webhook into my bot?

restive otter
#

when is the api (voters) reset?

brisk vigil
#

hi i was wondering if this would work

dbl.webhook.on('vote', vote => {
  vote.user.send('Thank you for voting!')
});```
vapid cape
#

no

#

vote.user is an ID, not a discord.js User object

brisk vigil
#

oh

true talon
#

erm

sullen nymph
true talon
novel moth
#

does the api cover voting for servers?

trail sigil
#

@novel moth not yet

novel moth
#

ok

trail sigil
#

it is a planned feature tho

#

@ripe cliff keep this channel api related please

frozen jolt
#

So we can do stuff when someone votes your bot, similarly is it possible to do stuff when they vote your server?

#

Oh never mind

#

Kek the answer right above me smiles

brisk vigil
#

Hi how do i send a message to the user that voted for my bot

#

?

jaunty depot
#

webhooks on

brisk vigil
#

ik but what is like the variable

jaunty depot
#

vote.user

sweet tusk
#

You can get user by id in discord.js api

jaunty depot
#

(at the example)

brisk vigil
#

tim said that would not work..

jaunty depot
#

you can fetch the user with the id

#

if you need to do something to them

brisk vigil
#

how tho

jaunty depot
#

read the docs™️

sweet tusk
#

Check in discord.js docs

brisk vigil
#

i am

jaunty depot
#

https://discord.js.org -> search bar -> fetch

brisk vigil
#

fetch the user id?

jaunty depot
#

mhm

brisk vigil
#

oops

#

so

#

MUser#fetch()

#

?

#

.fetch(voted.user)

#

?

ebon basin
#

Hello, sorry for the dumb question but how do I do the webhook thing so it'll show all the servers my bot has?

trail sigil
#

webhooks are simply for top.gg to communicate with your bot

ebon basin
#

ohhh

trail sigil
#

the server count must be posted by you (from your bot), to top.gg

ebon basin
#

ah I see

trail sigil
#

what language are you using?

ebon basin
#

discord.js

trail sigil
polar hawk
#

Hi, I'm new to discord and I'm just learning, so sorry for the silly question, but they told me that because of nekotina they can marry more people and I don't know how and whether that's possible.

ebon basin
#

Thank you for the help, am on phone so will do it later

#

Appreciate it a lot!

trail sigil
#

no problem

#

-wrongserver @polar hawk

abstract mothBOT
#

@polar hawk

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(

dense nest
#

Api site for Bscript

opaque jetty
#

@jolly hornet can you do -api

jolly hornet
#

yes

#

-api

abstract mothBOT
#

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

crystal helm
river bone
#

if more than 1 people vote at the same time or close to each other vote count fails to get updated in time and gets repeated
any way to fix that?

restive otter
#

.

floral widget
#

-wrongserver

restive otter
#

Can I have some help. I want my server count on the top.gg website

sullen nymph
#

Which part are you confused on?

somber wadi
#

^

restive otter
#

close the connection if it throws any warning

lament abyss
tight brook
flint ivy
#

there is no event when somebody voted?

rapid kettle
#

yes there is, if you have a webhook setup.

restive otter
#

I think I did the server count but when I try load. my bot takes forever to start

flint ivy
#

i need help with setting up a webhook in my bot

jaunty plank
#

what lib?

restive otter
#

Is there a IP i can whitelist for webhooks? currently home-hosting my bot

rapid kettle
#

you need to open it for the entire internet

restive otter
#

so there isn't a dedicated ip that sends top.gg webhook requests

rapid kettle
#

there probably is

#

but you have to open it to the entire internet

restive otter
#

yes but i can whitelist a ip to only accept requests from

rapid kettle
#

i dont think anyone's ever logged it lol

plush swallow
#

Lemme see if I can log an IP for that

#

Sent him a DM 🙂

smoky vector
#

Why Is votes.find(vote => vote.id == message.author.id) Undefined?

willow spindle
#

use hasVoted instead (btw it is .user not .id)

keen ermine
#

why is the vote count on the website different from the count in the api and which is the real one?

#

i have 39 votes on the website, but the api returns 26 "vote user objects"

restive otter
#

im getting a backend fetch error when trying to post the servercount?

#
const dbl = new DBL(key, client);

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

dbl.on('error', err => {
 console.log(err);
})
#

im just using the api example

#

resolved

compact inlet
#

E

golden adder
#

I just started sharding my bot and I'm getting this error on launch for every shard other than shard 0

 events.js:183
       throw er; // Unhandled 'error' event
       ^
 
 Error: listen EADDRINUSE :::5000
     at Object._errnoException (util.js:1022:11)
     at _exceptionWithHostPort (util.js:1044:20)
     at Server.setupListenHandle [as _listen2] (net.js:1367:14)
     at listenInCluster (net.js:1408:12)
     at Server.listen (net.js:1492:7)
     at DBLWebhook._startWebhook (/root/pixxiebot/node_modules/dblapi.js/src/webhook.js:45:18)
     at new DBLWebhook (/root/pixxiebot/node_modules/dblapi.js/src/webhook.js:27:12)
     at new DBLAPI (/root/pixxiebot/node_modules/dblapi.js/src/index.js:69:22)
     at Client.client.on (/root/pixxiebot/bot.js:97:17)
     at emitNone (events.js:111:20)```
dapper copper
#

Yes

#

are you using internal sharding?

#

or sharding manager?

#

It wont work with sharding manager because it spawns a new process for every shard

#

whereas internal sharding using child processes

#

so you'll get ERRADDRINUSE (basically saying the port 5000) is already in use

#

because it's already been opened on port 5000

#

assuming you're using a vote webhook

#

I recommend you make a separate process for it and store the votes in a database

#

@golden adder ^^

golden adder
#

Yep I'm using sharding manager. Totally new to this sharding thing. Anywhere with some useful resources to help?

#

And yes I'm using a vote webhook

dapper copper
#

Right

#

Just move your voting webhook handler to a new Process

#

you literally wont need to change any code if you're using a database to store votes

#

@golden adder Do you use a file / database to log votes rn or not?

golden adder
#

All the webhook event does is just add +1 to the user's voting streak in the db and credit them some currency.

#

It also sends them a confirmation DM

dapper copper
#

Oh

#

Hmm

#

You can always use internal sharding

golden adder
#

How do I do that?

dapper copper
#

thats all

golden adder
#

Ok I'll give that a try

dapper copper
#

Lemme know how it goes!

golden adder
#

That doesn't seem to be working for me. I haven't upgraded to V12 yet 😂

#

Probably because of tht

#

I tried shardCount: 'auto' but that only launches 1 shard of 500 guilds

dapper copper
#

Why havent you upgraded to v12 yet

#

out of curiosity

golden adder
#

The sharding manager launches half the servers

#

Just lack of time

#

D:

dapper copper
#

with sharding manager?

golden adder
#

No

dapper copper
#

Oh

#

Hmm

golden adder
#

I removed the sharding manager to test it

dapper copper
#

ah cool cool

#

Then ye, if you wanna use sharding manager and then make a separate process for your vote webhook thats probably your best bet

golden adder
#

Yep

#

I'll have to try and work out how to send a DM confirmation though

dapper copper
#

You should be able to use the api

#

since the bot will identify and you can then just post to the specific URL as if your were using an api

#

lemme do a test real quick and I'll get back to you

golden adder
#

Ok! Appreciate it 😉

dapper copper
#

Do you use node-fetch?

#

i'll whip up a script that might work with comments explaining everything

golden adder
#

Yeah sure that would be awesome

dapper copper
#

So, This is the output https://img.ichigo.uk/tU6wlPIvy9Je.png

Here is the code:

const fetch = require('node-fetch')
const token = ''

async function sendUserDM (userId) {
  // Stringify the body for the DM Creation so discord doesn't throw an error
  const body = JSON.stringify({
    recipient_id: userId
  })
  // Create the DM
  fetch('https://discord.com/api/v6/users/@me/channels', {
    method: 'POST',
    headers: {
      Authorization: `Bot ${token}`,
      'Content-Type': 'application/json'
    },
    body: body
  }).then(async out => {
    // Convert the buffer to JSON
    out = await out.json()
    // Create the message JSON object
    const message = JSON.stringify({
      content: 'Vote Confirmation',
      embed: {
        title: 'Thanks for voting!',
        description: 'Thanks!'
      }
    })
    // Send the message
    fetch(`https://discord.com/api/v6/channels/${out.id}/messages`, {
      method: 'POST',
      headers: {
        Authorization: `Bot ${token}`,
        'Content-Type': 'application/json'
      },
      body: message
    }).then(async out2 => {
      // Output (This is here in case of errors)
      out2 = await out2.json()
      console.log(out2)
    })
  })
}

sendUserDM('USER ID HERE')

This won't work if the bot has been down for 24 hours as discord requires your bot to have identified within the last 24 hours (or since identify reset).

#

@golden adder

golden adder
#

That's awesome. Thank you so much!