#topgg-api

1 messages · Page 153 of 1

rain heart
#

why are you using 2 different libraries for top.gg

slim hemlock
#

smh i saw from someone else

#

i dont remember from where smh

slim hemlock
#

the dblapi.js

#

i havent used it anywhere

restive otter
#

You leaked your Key

#

I would reset it

slim hemlock
#

its my discord webhook

#

not key

restive otter
#

Oh lol

slim hemlock
#

dont reset

restive otter
#

sry

slim hemlock
#

k

restive otter
#

Someone can help me with that

fading inlet
#
    const express = require('express')
    const { Webhook } = require('@top-gg/sdk')

    const wh = new Webhook(webHookPassword)
    const app = express()

    app.post('/webhook', wh.listener((vote) => {
        console.log(`User with ID ${vote.user} just voted!`);
        //do stuff
    }))

    app.listen(3000)

I am not receiving any votes. I double checked webHookPassword and the WebhookURL.

twilit urchin
#

How to setup a webhooks
Please explain to me like I am 5 years old

floral tapir
#
twilit urchin
#

Can anyone explain what to do here?

night ingot
#

The url is http://<your public ip>:<webhook port>/<webhook path>

#

And the authorization is whatever you want it to be, it's not mandatory

twilit urchin
#

Thank you so much

fading inlet
night ingot
fading inlet
#

yes, I also tried with 5000 and it worked before. But at end of April it suddenly stopped working

#

The same issue with the "old method"

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

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

have you tried port 5000 on the new one?

fading inlet
#

Yes, still nothing

brittle spoke
#

any errors?

fading inlet
#

No, its just like nothing happens when pressing the "Test" button on top.gg

#

my URL: http://xyz.blabla.de:5000/webhook

brittle spoke
fading inlet
#

And I am using the webHookPassword from "Authorization" listed on top.gg (not the Token)

viscid cloud
#

that's right?

brittle spoke
#

I dont think its much different

#

other thanit saying /dblwebhook

brittle spoke
viscid cloud
#

yes
it's not work

#

if I press test what happen?

#

send to console message?

spice helm
#

Are you clicking save then test?

viscid cloud
#

yep

#

i'm sure

spice helm
#

Ok, that is a bit odd

#

A firewall somewhere maybe?

viscid cloud
#

This happened with my friend too @gray yew

spice helm
#

Routers are very strange and strict when it comes to this stuff

fading inlet
fading inlet
#

And I can exclude firewall issues because it worked in April with this Port (I did not adjust anything).
Also I can see it is listening on that port

spice helm
#

Can you scan your own external IP to see if the ports open, and if so can you access it using a browser?

#

@fading inlet (sorry for ping)

fading inlet
#

Doing an external port scan it says the port is closed

#

Do I have to restart my VPS for opened ports to register?

spice helm
#

Idk my VPS doesn't have a router thingy (or at least when ever i open a port i don't have to configure anything)

restive otter
foggy cosmos
#

Hello!

#

I need something.

fading inlet
#

I got it to work by using iptables -A INPUT -p tcp --dport 5000 -j ACCEPT , restarting my VPS and adding an extra firewall rule in my VPS dashboard. I dont know which of these fixed the problem, but it somehow works now. Thanks for your help.

foggy cosmos
#

I'm looking for an api that can give me a Turkish word.

zenith elm
jaunty plank
#

-api

abstract mothBOT
#

This channel is ONLY for the Top.gg API!
This channel is only for: suggestions/help/bugs to do with official API libraries and API docs found at: https://docs.top.gg
Any Off-Topic conversation may get deleted and muted.

If you need help with development about your bot or development in general, feel free to use #development.

restive otter
#

I cant update my stats with the java API and when I set the stats it does nothing and blocks my code :/

#

I set them with discordBotListAPI.setStats(guilds.size());

static basalt
#

-api

foggy cosmos
violet viper
#

Hey, so on my ```js
dbl.on('posted', () => {
console.log('Server count posted!');
});

restive otter
jaunty plank
#

api erroring out i guess 👀 will probably return shortly.

#

504 errors typically means its server side.

zenith elm
zenith elm
proper kestrel
#

What API is used in place of dbl.js for Javascript to post stats on site?

restive otter
#

thanks discord for that ping

#

wtf

#

@jaunty plank

hollow gate
#
    .then(res => res.text())
    .then(body => {
      console.log(body);
});```
When i try to fetch if the user has voted or not, it gives me back "Unauthorized", how can i do?
jaunty plank
hollow gate
#

how can i do using node-fetch?

#

done. Thanks for your help

jaunty plank
#

we dont get a lot of java devs here.
the java lib hasnt been updated in 3 years, not sure if it even works tbh.

restive otter
#

damn .-.

#

Okay thanks :/

jaunty plank
# restive otter damn .-.

discordBotListAPI.setStats(guilds.size());
isnt it supposed to be
api.setStats(serverCount);
with this init line

DiscordBotListAPI api = new DiscordBotListAPI.Builder()
    .token("token")
    .botId("botId")
    .build();
restive otter
#

I made exact this

#

I only gived it a other name

#

guilds.size = serverCount

#

and discordBotListAPI = api

rain heart
#

use debug lines

#

catch the exception if there's any

#

make sure the token is correct

#

you never actually posted the server count I assume

#

use what woo said, api.setStats(ServerCount);

#

catch that

south tangle
#

Ah yes apiThonk

#

I'm trying to code

zenith elm
#

Does anyone know how to set server count on top.gg on our?

south tangle
#

Uhhhh no

restive otter
#

post your stats

zenith elm
#

Uhh

#

What

rain heart
#

-servercount

abstract mothBOT
misty meteor
#

@fresh plover

orchid zodiac
#

hey guys so we have a bot hosted in a centronodes server, and when we try to access the webhook path this shows up

#

alright nevermind we had a small http issue

#

we used https instead of http which it uses so yea

#

it's fixed

#

And autopost also worked

restive otter
rain heart
#

Well, any errors?

restive otter
#

Nope

#

And debuger executes my code but after the method from top.gg it stops

unique harbor
#

hi there, don't know if I post right here. I want to ask if there is a way to retrieve the total guilds my bot is invited so I can display them in my website

loud token
#

there's a function that exists that the gets the guilds your bot is in

#

so just take the length of that list

unique harbor
#

thnx. I am aware of that function, I use it in a command to retrieve the list of guilds, but how do I call that from my website ?

#

can I use top.gg's API to get the total number of guilds ?

loud token
#

oh from the website?

#

you could send a webhook ig, and then when you receive it you send the guild count back

restive otter
#

@rain heart

System.out.println("UPDATING STATS TOP.GG");
            discordBotListAPI.setStats(guilds.size()).whenComplete((unused, throwable) -> {
                if (throwable != null) {
                    throwable.printStackTrace();
                    return;
                }

                System.out.println("DONE UPDATING");
            });
#

"Done updating" does never executed

#

And no error

unique harbor
loud token
unique harbor
#

ok, thnx

restive otter
#

where can i get the top.gg api?

restive otter
#

But I never received a error without new thread..

short roost
#

is there any way to get vote's data without using the top.gg's snpm package ??

wicked storm
#

-docs

rich zodiac
#

How do I make it so that voting for the guild gives you rewards?

barren fog
#

can someone tell how can i put this back to N/A? If thats even possible

rain heart
#

-servercount

abstract mothBOT
restive otter
#

-servercount

jaunty plank
acoustic lark
#

I pass the dbl token like 'DBL TOKEN' right not "DBL TOKEN"

#

Still cannot get the API to work lol

half yew
#

-servercount

acoustic lark
#

mod only command

half yew
#

oh

#

ok

acoustic lark
#

To have your bot's server count displayed on Top.gg, please read the documentation on server/shard posting.

#

Thats wut the command sayd

#

says*

half yew
#

oh

#

thanks

acoustic lark
#

oh I cannot post links

jaunty plank
acoustic lark
#

Is this all I need, not working 4 me dunno why do not think my cogs r loading?

unkempt harness
wet wing
#

helloo what do you put for the url in place of the dbl hook thing and auth?

#

ahh i get it ignore me

rain heart
#

Just be patient than saying "ahh I get it ignore me"

jaunty plank
wet wing
#

? i found the answer in the mean time

jaunty plank
#

mky

wet wing
wet wing
# jaunty plank mky

ohh sorry wasn’t responding to you there 😭😭 on pc my msg came before urs

jaunty plank
#

both showed up at the same time on my end, i knew dw ❤️

wet wing
#

:) ❤️

pseudo sierra
#

Hi, how can i access the API in python so i can keep track of the number of votes of each person and when they can vote again ?

leaden compass
#

hiii people

#

umm so we cant put are serves on here??

stiff mesa
#

Uhm, a Question: How do I use Webhooks?

sullen nymph
#

Trigger is webserver that listens to HTTP requests

stiff mesa
#

I know, but how do I use them with the topgg API?

sullen nymph
#

You run one on your machine, make sure the port it's on is open and no firewall is blocking requests to that port

#

The URL is http://1.2.3.4:5000/path
Where 1.2.3.4 is your IP address
5000 is the port
/path is the route

grizzled cosmos
#

How can I make a poll in discord

stiff mesa
exotic oyster
#

i need assistance in webhooks smh

#

Python!

spice helm
acoustic lark
#

What is the difference between "Manual server count" and "automatic server count"

restive otter
#

one is manual and the other is automatic

#

XD

acoustic lark
#

But do u need to restart ur code every time to update on the "Manual server count"

restive otter
#

Sorry I'm idiot, its joke which is only funny to me

spice helm
acoustic lark
#

oh kk ty

indigo timber
#

@abstract moth

sullen nymph
#

Automatic means an internal function is called every X minutes

balmy hamlet
#

everything is allowed if they don't find out /s

crystal cloak
#

That's not what I asked...

loud token
#

has the most recent version of topggpy been added to pypi?

loud token
median lagoon
#

@loud token i have a question

loud token
#

okay

median lagoon
#

can i use multiple Authorization tokens instead of one?
to count the votes etc

#

like multiple webhooks

loud token
#

why would you want to do that?

median lagoon
#

i have 2 bots

#

that count votes

#

i want set both

loud token
#

Okay, so you want to use the same webhook for the two bots?

#

or are you using 2 different webhooks?

median lagoon
#

i guess each bot given me different token

#

i guess

loud token
#

yeah idrk what the question is because you can set a unique "authorization token" for each bot

median lagoon
#

can i link both?

#

to 1?

loud token
#

it's just a string

#

it's to ensure no one's spoofing votes

median lagoon
#

string?

loud token
#

I'm confused as to what you're asking

median lagoon
#

i have 2 bots

#

i want to set both of them

#

through webhooks

loud token
#

okay

#

and you want to know whether the authorization can be different

#

you personally set the authorization, why couldn't they be the same or different?

median lagoon
#

yea

loud token
#

personally I would make them different

#

just for extra security

#

but I mean you don't have to ig

median lagoon
#

can you add 2 authorization codes?

#

instead of 1?

loud token
#

for 1 bot?

median lagoon
#

2 bots

loud token
#

they're completely separate things

#

bot A's authorization != bot B's authorization

median lagoon
#

so you can't set more than 1 bot to top.gg?

loud token
#

you can

median lagoon
#

but they both give me different tokens bro

loud token
#

tokens are not authorization

median lagoon
#

like the codes are different for setting the webhook

loud token
#

they're different things

#

the token is for the topggpy package or the js equivalent

#

the authorization is something you choose

median lagoon
#

this for example rn a bot that already set to my server

#

i can't add another because it gives me different codes

loud token
#

why would you want to add another

median lagoon
#

that's why i am here xD

#

because it's another bot

loud token
#

there's a different page for your other bot

median lagoon
#

where?

loud token
#

wdym where

median lagoon
#

what these bots does is basically when someone votes they give a member a role

loud token
#

each bot has its own editing and analytics stuff

median lagoon
#

i have one set

#

i want to add the other

#

if i can set the other

#

tell me how

#

to the same server

loud token
#

I'm so confused rn, servers have nothing to do with webhooks

median lagoon
#

i have a server with 2 bots which serve the same purpose

#

each bot has it's own way of setup they are not identical

#

and i can fill only 1 bot here

#

can't fill for 2

loud token
#

Open up the editor, click on this to set the webhook. The two separate bots do not have the same editor, so I don't understand what you're asking

#

this is an example with my bot

median lagoon
#

i don't have it

loud token
#

have you been to the topgg website

median lagoon
#

link?

loud token
#

wut

median lagoon
#

can you send me the link to it @loud token

loud token
median lagoon
#

yea yea

#

it's the saame as the one i am on right

#

but where do you get the panel

#

this also a different example

#

of what people do

#

like you can't add more than 1 option there

loud token
#

bruh

median lagoon
#

so the question is can we add more than 1 auth token?

#

or not

#

and URL ofc

loud token
#

THE TWO BOTS ARE COMPLETELY SEPARATE

median lagoon
#

i know

#

but where do i insert the info of the second bot then?

#

like where do i insert the second auth token and URL?

loud token
#

go there

#

click on one

balmy hamlet
#

isn't that kinda obvious, how can u be asking this

median lagoon
#

@loud token one last thing

#

what does that mean?

turbid monolith
#

pretty sure thats pay outs

night ingot
abstract mothBOT
#

@median lagoon

Auction Credits

What are they?

  • If enough people vote for your bot or server per month, you have the ability to get credits that you can then use for auctions.
  • Don’t know what auctions is? See here for how to apply.
  • These auction credits can be used to pay for any winning bids you may make
  • You CANNOT “withdraw” them for real money

How does the System Work?

  • Each month, bot monthly votes reset
  • If you get 100 votes on your bot in the month, you can redeem $15 worth of voting credits (can’t redeem till you actually get 101 votes)
  • Any vote after 100 will be worth $1 per 1000 votes (or $.001 per 1 vote)

How Can I Redeem Them?

  • At the end of the month, you will be eligible to redeem your credits (you redeem them on your bot or server's Votes page on your bot’s dashboard). You will have 30 days to redeem them before they expire.
  • After you redeem them, you have 31 days to use them before they expire (so you can technically stack 2 months worth)

**How can I Use them to Pay? **

  • When you pay for your winning bid, you have the option to use your credits
  • If your winning bid cost is more than the amount of credits you have, make sure to apply the credits first and then pay the rest with the supported payment providers

A more simplified, less detailed version can be found in #580510490074152961 after you get auctions access and any questions can be asked in #auctions-general.

turbid monolith
#

advertise

median lagoon
night ingot
median lagoon
#

so techinically i have $30?

#

to spend

night ingot
#

Voice chat?

#

What do you mean?

median lagoon
night ingot
#

Did you read the message?

median lagoon
night ingot
#

You should ask in #support, this isn't the right channel anyways

restive otter
#

-CREDITS

#

-credits

#

lol nvm#

pseudo sierra
pseudo sierra
#

hi, my bot isn't in Top.gg since it's a custom bot
i want the bot to be able to track down the number of votes of the server and when the member can vote again to the server, can someone help?

rain heart
#

Only way is using a webhook, as servers does not have an api

pseudo sierra
#

hmm so something like this?

import topgg

# This example uses topggpy's webhook system.
# The port must be a number between 1024 and 49151.

dbl_token = 'Top.gg token'  # set this to your bot's Top.gg token
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
bot.topgg_webhook.run(5000)  # this method can be awaited as well

@bot.event
async def on_dbl_vote(data):
    """An event that is called whenever someone votes for the bot on Top.gg."""
    if data["type"] == "test":
        # this is roughly equivalent to
        # return await on_dbl_test(data) in this case
        return bot.dispatch('dbl_test', data)

    print(f"Received a vote:\n{data}")

@bot.event
async def on_dbl_test(data):
    """An event that is called whenever someone tests the webhook system for your bot on Top.gg."""
    print(f"Received a test vote:\n{data}"```
i found it in a GitHup rep
#

@rain heart sorry for the ping but how do i get my dbl token ?

rain heart
#

You can only get it with a bot

pseudo sierra
#

is it the bot's token?

rain heart
#

which you cannot get without a bot

pseudo sierra
#

so i have to put the same bot or another bot?

#

wait but all i need is to get the server's info
like the number of votes the server has
how many this member has voted for this server
and when will that member be able to vote to this server again

#

do i have to put the bot in Top.gg?

rain heart
#

actually, just remove the dbl_token variable

#

as it doesn't seem to be used anywhere anyways

pseudo sierra
#

oh

#

i am still unable to get it lol

night ingot
#

You don't need the dbl token to use webhooks

pseudo sierra
#

hmm then what do i need?
i have searched for any documents/GitHup repos but all the things i found included a dbl token

night ingot
#

You only need the dbl token to access the API, which isn't necessary if all you're looking to do is to listen for votes

pseudo sierra
#

oh

night ingot
#

All you need to do is make sure the port you're using is open on your network, and that your webhook url is correct in the webhook page

crystal cloak
#
import dbl
import discord
from discord.ext import commands

voters = []

class TopGG(commands.Cog):

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

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        user = data['user']
        voters.append(user)


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

I'm trying to add new voters to a list in python. Unfortunately, I get this error:

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x00000188B5A4A580>
pseudo sierra
night ingot
#

So in your case: http://<your public ip>:5000/dblwebhook

leaden ice
#

Does anyone have a real and working Token Gen?
I need it to test out my friends bot.
It's an Anti-Nuke, and we wanna see if some nuke bots can bypass it.

abstract mothBOT
#

@leaden ice

This channel is ONLY for the Top.gg API!
This channel is only for: suggestions/help/bugs to do with official API libraries and API docs found at: https://docs.top.gg
Any Off-Topic conversation may get deleted and muted.

If you need help with development about your bot or development in general, feel free to use #development.

leaden ice
#

I thought it was discord API

#

lol

night ingot
#

I'm also 99% sure that a token gen would be against ToS. so I'd advise against that

vestal fog
#

-api

#

._.

chilly nova
#
const Topgg = require("@top-gg/sdk")
const express = require("express");
const app = express();

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

app.engine("html", require("ejs").renderFile);
app.set("view engine", "html");

const webhook = new Topgg.Webhook("TheSuperDuperSecretAuthKeyForEastsideDiscordsVoteWebhooks69")

app.post("/dblwebhook", webhook.listener(vote => {
  // vote will be your vote object, e.g
  
  let votechannel = client.channels.cache.get("840050870661021716");
  votechannel.send(`<@${vote.user}>, has voted for the server!`);
  
  console.log(vote.user) // 395526710101278721 < user who voted\
  
  // You can also throw an error to the listener callback in order to resend the webhook after a few seconds
}))

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

I use this but it isnt working

pseudo sierra
#

@night ingot sorry to ping you again, but how do i use the webhook?
do i use flask or django?
or do i use requests?
sorry again for the ping

sullen nymph
#

If you want to implement the webhook inside of your bot, it's suggested to use Quart, Sanic, or aiohttp.web

#

Since they're asynchronous

pseudo sierra
#

oooh thx

loud token
#

shivaco, is the most recent version of topggpy on pypi?

pseudo sierra
#

is there a way to get my public IP address?
i think i am messing something cause it's giving me this error

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientConnectorError: Cannot connect to host "idk if i should show my public IP":5000 ssl:default [The semaphore timeout period has expired]```
#
@commands.command()
    async def test(self, ctx):
        url = "http://idk if i should show my public IP:5000/dblwebhook"

        async with aiohttp.ClientSession() as session:
            async with session.get(url) as response:
                print(response)
                ``` code
chilly nova
hollow gorge
#

why is my dblpy autopost for my guild counter stopped working?

#

I have not touched it since I set it up

sullen nymph
#

Will be next week though

loud token
#

okay, thanks

pseudo sierra
#

can u help me too?

pseudo sierra
#

?

loud token
#

you asked how to find your public ip

pseudo sierra
#

oh i thought that link was an image link

#

thx i will try that

#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientConnectorError: Cannot connect to host "My new IP address":5000 ssl:default [The remote computer refused the network connection]```
hollow gorge
#

Is dblpy been recently changed?

wet wing
#

hellooo i thought i figured the webhook url out but i cant get it to work D: the url has my public ip and port 5000, the code im using is

    async def on_dbl_test(self, data):
        print(f"Received a test upvote: {data}")```
nothing happens when i test, what can i do?
jaunty plank
wet wing
#

yep!

jaunty plank
#

whats your hosting provider?
home/vps ?

wet wing
#

just my pc

jaunty plank
#

did you port forward?

wet wing
#

whats that?

jaunty plank
#

on home networks since there are multiple devices per public ip, you need to tell your router which device to send requests on a specific port to
for example
1 ip serves maybe your pc, phone and xbox.
you need to tell your router, port 5000 goes to your pc.

wet wing
#

oh that makes sense, thank you!!

pseudo sierra
#

can someone help me with the webhook thing?
i have no idea how to do it

pseudo sierra
#

amm
i want to track the members who vote for my server using my custom bot
like i can check who voted and store the number of votes in a database
and when can the member vote again and etc

#

@jaunty plank ^

jaunty plank
#

sure, what programming language/lib are you planning on using?

pseudo sierra
#

python

#

i have tried to use aiohttp but couldn't figure it out

jaunty plank
pseudo sierra
#

but i don't have a top.gg token

jaunty plank
#

the token is only used for making requests to the api, not webhooks

pseudo sierra
#

oh so i can remove it from the code?

jaunty plank
#

I think you can just put whatever you want there(dont think its optional?, not sure). as long as you dont attempt to use the api methods, should be fine.

pseudo sierra
#

alr

jaunty plank
#

the docs are kinda all over the place. uh, lets see
looks like thats part of the initialization.
https://github.com/top-gg/python-sdk#using-webhook
^ this has an example kinda showing it.
its using dbl, for the bot list, but it should be the same for dsl.

loud token
#

the token is mainly for server posting, but it's required for initialization

pseudo sierra
#

hmm so what should i change to make it trigger when a member votes the server?

loud token
#

there's a function for that

pseudo sierra
#

hmm?

loud token
#
@bot.event
async def on_dbl_vote(data):
    """An event that is called whenever someone votes for the bot on Top.gg."""
    print(f"Received a vote:\n{data}")
pseudo sierra
#

but i want it for a server and not the bot

loud token
#

oh for server

#

sorry

jaunty plank
#

same exact thing, just dsl

pseudo sierra
#

lol idk where dsl goes

#
@client.event
async def on_dsl_vote(data):
    """An event that is called whenever someone votes for the bot on Top.gg."""
    if data["type"] == "test":
        # this is roughly equivalent to
        # return await on_dbl_test(data) in this case
        return client.dispatch('dbl_test', data)

    print(f"Received a vote:\n{data}")``` like this?
loud token
#

yeah

pseudo sierra
#

oh

loud token
#

I'd look through the github code to get a better understanding of the library

pseudo sierra
loud token
#

yeah, idk what the return thing would do though

#

i don't think you should be returning anything

pseudo sierra
loud token
#

think it handles that

pseudo sierra
#

hmm

#

so it won't return the memberID or something?

#

brb

loud token
#

you should do all the stuff you want to do in the event function

jaunty plank
loud token
#

it comes in the form of a python dictionary so you can get the info using the correct keys

pseudo sierra
#

oh thx alot guys

#

@jaunty plank i don't think it worked

client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "password")
#client.topgg_webhook.run(5000)  # this method can be awaited as well

@client.event
async def on_dsl_vote(data):
    """An event that is called whenever someone votes for the bot on Top.gg."""
    if data["type"] == "test":
        # this is roughly equivalent to
        # return await on_dbl_test(data) in this case
        return client.dispatch('dbl_test', data)

    print(f"Received a vote:\n{data}")```
jaunty plank
#

did you fill in the url and auth on your servers top.gg page?

pseudo sierra
#

hmm nope, i mean where do i fill that?

loud token
#

oh man

pseudo sierra
#

like i said lol it's my first time with webhooks

loud token
jaunty plank
#

👀 servers

loud token
#

agh

jaunty plank
#

your servers page, webhook section

pseudo sierra
#

it gives 404

loud token
#

just replace bot with server

#

and the your-bot-id with your server id

pseudo sierra
#

oh wait

#

not found

loud token
#

well then the roundabout way works too

#

do what Woo said

#

that's the correct link

pseudo sierra
#

ah

loud token
#

lmk if it works

pseudo sierra
#

alr, and thx alot

stray quail
#

is this voted in the past 12h or in the past month?

rain heart
#

Past 12h

wet wing
teal matrix
#

Does anyone here know how to remove someone from being an owner of your top.gg bot page:D

pseudo sierra
#

@loud tokenhi i am back and sorry i was outside and just came back
after i open the server in top.gg what should i do ?

loud token
pseudo sierra
#

yep

#

@loud token ```py
client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("URL", "Authorization")

#
client = commands.Bot(command_prefix=prefix, intents=intents)
client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("URL", "Authorization")
@client.event
async def on_dsl_vote(data):
    """An event that is called whenever someone votes for the bot on Top.gg."""
    if data["type"] == "test":
        # this is roughly equivalent to
        # return await on_dbl_test(data) in this case
        return client.dispatch('dbl_test', data)
loud token
pseudo sierra
#

hmm why?

#

do i change this py client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("URL", "Authorization") to py client.topgg_webhook = topgg.WebhookManager(client).dsl_webhook("URL", "Authorization") ?

#

dbl_webhook --> dsl_webhook

#

@loud token sorry for the ping

pseudo sierra
#

nice

loud token
#

and you don't return anything because why would you

pseudo sierra
#

yeah i removed the return part

loud token
#

okay

pseudo sierra
#
@client.event
async def on_dsl_vote(data):

    print(f"Received a vote:\n{data}")```
#

so with that it will print the voter data?

#

i still have 5 hours to vote again

loud token
#

yeah, it'll print the dictionary tho

#

also you can send test votes

pseudo sierra
#

hmm ?

loud token
#

in the same place where you set the webhook on the topgg website

#

just scroll down a bit

pseudo sierra
#

oh alr

#

test webhook ?

#

@loud token i voted with an alt and nothing came out

loud token
#

maybe the url is wrong

pseudo sierra
#

should i DM it to u?

#

i copied it from the website

loud token
#

if you want to personally haven't used it yet so idk what the issue might be

pseudo sierra
#

hmm alr

#

thx

pseudo sierra
loud token
pseudo sierra
#

oh.....i feel rage.....sorry

loud token
#

lmao it's fine

pseudo sierra
#

wait i have been clicking that and nothing happened
i just received a pop up

loud token
#

it should say something like webhook sent

pseudo sierra
#

hmm yeah but where?

#

also are all URL for all servers the same ?

loud token
#

to whatever url you put

pseudo sierra
#

wait...

#

what url do i put????

loud token
#

oh nooo

#

your public ip

pseudo sierra
#

oh that

#

god i was scared lmao

#

@loud tokennope i used this format and nothing happened http://<your public ip>:5000/dblwebhook

loud token
#

this should be: client.topgg_webhook = topgg.WebhookManager(client).dsl_webhook("/dblwebhook", "Authorization") then

pseudo sierra
#

alr

loud token
#

and authorization should be whatever you put in that box

#

on the website

pseudo sierra
#

yeah

#

nope

#

hmm isn't there a step to connect the bot to the page of the server?

loud token
#
dbl_token = 'Top.gg token'  # set this to your bot's Top.gg token
bot.topggpy = topgg.DBLClient(bot, dbl_token)
#

that's the connection step

pseudo sierra
#

but isn't that for bots that is in top.gg ?

willow spindle
#

there is no DSL api

pseudo sierra
#

yeah so i am trying to use webhooks

#

but it's not responding

loud token
#

ohhh

#

there's a differend function for tests

#
@bot.event
async def on_dbl_test(data):
    """An event that is called whenever someone tests the webhook system for your bot on Top.gg."""
    print(f"Received a test vote:\n{data}")
pseudo sierra
#

i also tried that
but no response

loud token
#
import topgg

# This example uses topggpy's webhook system.
# The port must be a number between 1024 and 49151.

dbl_token = 'Top.gg token'  # set this to your bot's Top.gg token
bot.topgg_webhook = topgg.WebhookManager(bot).dsl_webhook("/dblwebhook", "password")
bot.topgg_webhook.run(5000)  # this method can be awaited as well

@bot.event
async def on_dsl_vote(data):
    """An event that is called whenever someone votes for the bot on Top.gg."""
    if data["type"] == "test":
        # this is roughly equivalent to
        # return await on_dbl_test(data) in this case
        return bot.dispatch('dbl_test', data)

    print(f"Received a vote:\n{data}")

@bot.event
async def on_dsl_test(data):
    """An event that is called whenever someone tests the webhook system for your bot on Top.gg."""
    print(f"Received a test vote:\n{data}")
#

did you copy paste that code

#

except replace dbl with dsl

#

so something like that

pseudo sierra
#

yeah for every dbl i putted dsl

#

bot.topgg_webhook.run(5000) this one gives me errors

loud token
#

you might have to await it

pseudo sierra
#

in an async function?

loud token
#

idk

#

I didn't write the library

pseudo sierra
#

and idk how to await something lol

loud token
#

bruh

#

how did you make the bot in the first place then

pseudo sierra
#

no i mean awaiting it outside a function

loud token
#

just type await in front

pseudo sierra
loud token
#

welp there's the answer then

#

wait why is that method in the github docs then

sullen nymph
#

asyncio.get_event_loop().run_until_complete

#

GitHub docs fuck

loud token
#

lmao

pseudo sierra
#

yeah lol

sullen nymph
#

I'll update that

loud token
#

what docs aren't fucked

sullen nymph
loud token
pseudo sierra
#
asyncio.get_event_loop().run_until_complete(client.topgg_webhook.run(5000))``` ?
#

well not like i got a response from the webhook

#

still why is it not giving a response?

restive otter
loud token
#

I meant the test function

restive otter
#

What about it?

loud token
#

shivaco said it doesn't exist

restive otter
#

Did you see that I manually dispatch it?

loud token
#
@bot.event
async def on_dbl_test(data):
    """An event that is called whenever someone tests the webhook system for your bot on Top.gg."""
    print(f"Received a test vote:\n{data}")

This one?

pseudo sierra
#

?

restive otter
#

This line

loud token
#

I see that you manually dispatch that, but it doesn't change that there exists a on_dbl_test event in the github README docs

restive otter
#

Because the dispatch line also exists, duh

pseudo sierra
#

aaa

loud token
#

so the dispatch line calls the event

#

okay

restive otter
#

Ye, the on_dbl_vote function itself is meaningless and won't be called if there's nothing dispatching it

loud token
#

okay, that makes sense then

pseudo sierra
#

wait so what should i do?

loud token
#

if you have the if data["type"] ... you'll need the event, but if you don't have it I don't see a reason why the webhook wouldn't work without on_dbl_vote

pseudo sierra
#

so like it's essential for the event to work?

loud token
#

for on_dbl_vote to do anything yeah

#

if you never dispatch it, it never runs

pseudo sierra
#

and is there a function called on_dsl_vote ?

restive otter
#

You can also do if else branches if you don't want to have extra events

loud token
#

rn his problem is that the webhook's not doing anything I think

pseudo sierra
#

yeah

loud token
#

also @pseudo sierra just let us see your code

pseudo sierra
#

a server webhook

#

alr

loud token
#

I have no idea what you've written

restive otter
#

Try doing a GET request to it, it should return 405 iirc

pseudo sierra
#

the code

loud token
#

side note: why do you need all intents

restive otter
#

So, you put http://ip:5000/dblwebhook on the site?

pseudo sierra
#

yes

restive otter
#

Btw, you can do client.loop.run_until_complete(...) for a shorter code

pseudo sierra
loud token
#

and your authorization is yamizero31 correct?

pseudo sierra
#

yes

loud token
#

okay

restive otter
#

Do you self-host it?

pseudo sierra
#

yes i am hosting it locally for now

restive otter
#

Have you forwarded the port?

pseudo sierra
restive otter
#

Welp, then this might be the issue. Your webserver isn't reachable if you don't port forward

pseudo sierra
#

hmm what's port forward ?

loud token
#

okay ig, not the best practice tho

#

credit: Woo

pseudo sierra
#

wait so what if i hosted the bot in a hosting site?

#

would i need to get the IP address of it or just put 0.0.0.0 instead?

loud token
#

what site are you thinking of

pseudo sierra
loud token
#

you would need an ip, but you wouldn't have to port forward

pseudo sierra
#

oh

loud token
#

I assume that's a VPS

pseudo sierra
#

i believe so

pseudo sierra
loud token
#

okay maybe you have to port forward in a vps

#

honestly idk

pseudo sierra
#

hmm

loud token
#

but i don't think you would have to

#

b/c there's no router to port forward

#

so ehhhh

pseudo sierra
#

......why is not working then lol

#

then the issue wasn't from the router but something else?

loud token
#

idk man

pseudo sierra
#

same

loud token
#

wait

pseudo sierra
#

?

loud token
#

did you get a new public ip for the vps?

pseudo sierra
#

yeah

loud token
#

oh

#

hmmm

pseudo sierra
#

i used the public ip

loud token
#

I think the VPS has a different public ip than your home computer, so you have to find that one

pseudo sierra
#

it has a different port tho

#

which i don't think it'd change anything

loud token
#

idk if you did that

loud token
#

just making sure

pseudo sierra
#

no worries

#

is the function even been called?

loud token
#

if it's not printing anything, no

#

does it print the ready statement?

pseudo sierra
#

yes

#

and ready statement from the cogs as well

loud token
#

also you can get rid of import dbl btw

pseudo sierra
#

ah sure

#

done

loud token
#

also use a .env file to store your token in the future

#

but that's not important

#

rn

pseudo sierra
#

yeah lol

#

but i will consider it

loud token
#

hmm

#

you could try sending a bot vote, see if that works

#

see if it works with bot votes

pseudo sierra
#

i tried that as well

loud token
#

ah

pseudo sierra
#

i even put 4 events

#

on_dsl_vote
on_dsl_test
on_dbl_vote
on_dbl_test

#

nothing got called

loud token
#

well on_dbl_test won't get called if the dispatch statement isn't there

pseudo sierra
#

hmm

#

nope

restive otter
loud token
#

wut

restive otter
#

srry

#

nvm

loud token
#

idk what the issue is, do you not get any error statements?

pseudo sierra
#

no

loud token
#

welp, you can try running it on heroku or smthn that gives a url

pseudo sierra
#

what url?

loud token
#

heroku creates a webhook url

#

but heroku kinda dum sometimes

pseudo sierra
#

i have a question tho, how does the bot get info of the voting ?

loud token
#

I'm just suggesting as a test

pseudo sierra
#

like all i specified was the url and the auth_pass

loud token
#

yep

#

that's all you need

#

look up how RESTful APIs work if you want the details

pseudo sierra
#

but their might be others who has the same auth_pass and url?

loud token
#

your public url should be unique

#

also the auth_pass is there to prevent spoofing

pseudo sierra
#

oh i kinda forgot what we put in url

#

i have been awake for 16 hours

loud token
#

lmao

pseudo sierra
loud token
#

you should go to sleep then, it's not like this needs to get done today

#

unless it does

pseudo sierra
#

yeah it's just a bad habit of mine

loud token
#

but I'm reaching the end of my day as well so I'm gonna log off in a bit anyway

pseudo sierra
#

i won't sleep until i give up or solve it

#

it's 9 am here lol

loud token
#

bruh

pseudo sierra
#

i probably should go sleep

loud token
#

yeah, if you can't think, then you're just wasting time

sullen nymph
#

If nothing is called, make sure the port you specified is open

pale girder
#

Hello. I need help.

#

I got object Lock can't be used in 'await' expression I want to check if a specific user has voted. Then if they did, reward them. But i got the said error.

class Currency(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.dblpy = dbl.DBLClient(self.bot, os.getenv("DBL_TOKEN"))

    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        user = data['user']
        embed = discord.Embed(
            title=f"Reward for <@{user}>",
            description="xxxxxx",
            color=discord.Color.purple(),
        )
        channel = self.bot.get_channel(user)

        await channel.send(embed=embed)

    @commands.command(name="vote", help="Vote for rewards.")
    async def vote(self, ctx):
        if await self.dblpy.get_user_vote(ctx.author.id):
            print("You've voted!")

sullen nymph
#

see topggpy

pale girder
slim hemlock
#

hi

#

idk why since i used topgg api, my bot has stopped working

#
const Topgg = require("@top-gg/sdk");
const AutoPoster = require('topgg-autoposter');
const ap = AutoPoster(config.DBL_TOKEN, client) ;

ap.on('posted', () => { // ran when succesfully posted
  console.log('Posted stats to top.gg')
})

const dbl = new Topgg.Webhook(config.DBL_TOKEN);

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

    const eco = ecoschema.findOne({userID: vote.user.id})
    const webhook = new Discord.WebhookClient('839215460624891915', 'OZ7wMQqK-wlzBlA33Lh0bwFYJvSAeXCQE_V_tcxBx1GRQEck5kRmxxZl_7hy--Fmx5Bb');
    const voteembed = new Discord.MessageEmbed()
    .setAuthor(`Thanks for Voting!`, client.displayAvatarURL())
    .setDescription(`Thanks **${vote.user.tag}** for voting for Cyte Bot! \n You can vote again in 12 hours!\n [Click here to vote again!](https://top.gg/bot/754765403489828946/vote)`)
    .setFooter("I have provided you your vote rewards successfully!")
    .setColor("#0afa08")
    webhook.send(vote.user, voteembed)
    eco.money += Number(2000000)
    eco.save()
    vote.user.send(new Discord.MessageEmbed().setAuthor("Thanks for voting for me!", vote.user.displayAvatarURL({dynamic: true}))
    .setDescription("I have successfully provided you `2,000,000` coins as your vote rewards!")
    .addField("Please consider voting for me in the next 12 hours again!", `[Click here to vote again in the next 12 hours!](https://top.gg/bot/754765403489828946/vote)`)
    .setColor("RANDOM")
    )
})
#

this is my code

#

someone pls help

brittle spoke
#

any error?

pale girder
#

Is it necessary to use webhook to check and give rewards to voters?

sullen nymph
#

The API is unreliable if you want to make everything instant

pale girder
#

so that means webhook should always be used for that purpose?

sullen nymph
#

As of right now, it's the most optimal option

night ingot
#

You could set up some constant check towards the API. But it wouldn't be optimal at all

pale girder
#

Very well. Thanks guys.

slim hemlock
#

2021-05-08T12:38:02.000000+00:00 app[api]: Build started by user herokuhost91@gmail.com
2021-05-08T12:38:46.084314+00:00 app[api]: Release v4 created by user herokuhost91@gmail.com
2021-05-08T12:38:46.084314+00:00 app[api]: Deploy ed7c31fc by user herokuhost91@gmail.com
2021-05-08T12:38:46.307905+00:00 heroku[Worker.1]: Restarting
2021-05-08T12:38:46.311161+00:00 heroku[Worker.1]: State changed from up to starting
2021-05-08T12:38:47.749202+00:00 heroku[Worker.1]: Stopping all processes with SIGTERM
2021-05-08T12:38:47.911272+00:00 heroku[Worker.1]: Process exited with status 143
2021-05-08T12:38:53.947688+00:00 heroku[Worker.1]: Starting process with command `node index.js`
2021-05-08T12:38:54.692693+00:00 heroku[Worker.1]: State changed from starting to up
2021-05-08T12:38:55.000000+00:00 app[api]: Build succeeded```
#

gets stuck here

#

@brittle spoke

pseudo sierra
sullen nymph
#

Firewall settings

pseudo sierra
#

oh

sullen nymph
#

If on a local network, also make sure that the port is forwarded to the correct device

pseudo sierra
#

i will try to contact the support service for that

sullen nymph
#

Good luck

pseudo sierra
#

thx

#

@sullen nymphhttps://support.video.ibm.com/hc/en-us/articles/207852137-How-to-open-ports-in-your-firewall#:~:text=For%20PC,rules%20in%20the%20left%20side. i found this, is it what we want?

sullen nymph
#

The general idea, yes

pseudo sierra
#

@sullen nymphsorry for pinging again but i managed to login in my router
i found out that port forward is in a section called Applications from the same site but i don't know what to do after that
it's fine if you don't know i can contact the support center later and ask them

sullen nymph
#

Try to search for Port Mapping Configuration or anything similar

pseudo sierra
#

alr

#

nope

night ingot
#

Is there a tab called "Port Forwarding"?

#

Like, under Network

pseudo sierra
#

no, i think it's port pinding

#

binding*

night ingot
#

What's your router model?

pseudo sierra
#

like the name of the company ?

#

oh i found a model in the status

night ingot
#

You should be able to google "how to port forward <router model>" then

pseudo sierra
#

oh alr

#

it seems something is messing in my part, i will contact the support center and ask them why i can't see the "post forward" tab

jaunty plank
pure vigil
#
import discord
from discord.ext import commands, tasks
import requests
import aiohttp
from aiohttp import web
import logging
import dbl
import math
from config.config import la_couleur, lien_vote


class TopGG(commands.Cog):
    """Handles interactions with the top.gg API"""
    def __init__(self, bot):
        self.bot = bot
        self.token = "token"

        self.dblpy = dbl.DBLClient(self.bot,
                                   self.token,
                                   autopost=True,
                                   webhook_path="/dblwebhook",
                                   webhook_auth='password',
                                   webhook_port=20209,
                                   post_shard_count=True)
    async def webserver(self):
        async def handler(request):
            return web.Response(text="Hello, world")
        async def handler2(request):
            return web.Response(text="Heyy")

        app = web.Application()
        app.router.add_get('/dblwebhook', handler)
        app.router.add_get('/', handler2)
        runner = web.AppRunner(app)
        await runner.setup()
        self.site = web.TCPSite(runner, '0.0.0.0', 20209)
        await self.bot.wait_until_ready()
        await self.site.start()

   @commands.Cog.listener()
   async def on_dbl_vote(self, data):
        vote_data = data
        voter = await self.bot.fetch_user(vote_data['user'])
        channel = self.bot.get_channel(824737862779273230)
        em = discord.Embed(title=f"[Nouveaux vote]({lien_vote})", colour=la_couleur, description=f"{voter} vient juste de voter !")
        em.set_footer(text="Vous pouvez voter toutes 12 heures")
        await channel.send(embed=em)
        logger.info("Received an upvote")
        print(data)

def setup(bot):
    global logger
    logger = logging.getLogger("bot")
    bot.add_cog(TopGG(bot))
    top = TopGG(bot)
    bot.loop.create_task(top.webserver())```
#

it's not working

#
future: <Task finished coro=<TopGG.webserver() done, defined at /home/aurore/bot discord/star bot python/cogs/dbl.py:25> exception=OSError(98, "error while attempting to bind on address ('0.0.0.0', 20209): address already in use")>
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/base_events.py", line 1062, in create_server
    sock.bind(sa)
OSError: [Errno 98] Address already in use

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/aurore/bot discord/star bot python/cogs/dbl.py", line 38, in webserver
    await self.site.start()
  File "/usr/local/lib/python3.6/dist-packages/aiohttp/web_runner.py", line 104, in start
    reuse_port=self._reuse_port)
  File "/usr/lib/python3.6/asyncio/base_events.py", line 1066, in create_server
    % (sa, err.strerror.lower()))
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 20209): address already in use
restive otter
#

dose anyone know free 24/7 hosting?

rain heart
#

-api

abstract mothBOT
#

This channel is ONLY for the Top.gg API!
This channel is only for: suggestions/help/bugs to do with official API libraries and API docs found at: https://docs.top.gg
Any Off-Topic conversation may get deleted and muted.

If you need help with development about your bot or development in general, feel free to use #development.

restive otter
#

oh sorry

sullen nymph
#
        self.dblpy = dbl.DBLClient(self.bot,
                                   self.token,
                                   autopost=True,
                                   webhook_path="/dblwebhook",
                                   webhook_auth='password',
                                   webhook_port=20209,
                                   post_shard_count=True)
        self.site = web.TCPSite(runner, '0.0.0.0', 20209)
        await self.bot.wait_until_ready()
        await self.site.start()
#

Can you explain to me what you think these snippets mean

#

You can use topggpy also

pure vigil
sullen nymph
#

Twice

restive otter
#

-api

sullen nymph
#

You tried

#

You may wanna just read the channel topic instead

#

Cuz, you know

#

It says exactly what that tag would

minor pine
#

autoposter works for repl?

hasty mica
#

Hey is there anyone that can help me out with tracking votes with on_dbl_vote i have no idea what im doing and cant seem to get it to work

hybrid loom
#

Anyone know where I can look for discord.py for the wrapper?

upper valley
#

UnhandledPromiseRejectionWarning: Top.GG API Error: 502 Bad Gateway

#

?

#

what does this mean ?

rain heart
#

what exactly are you trying to do

wet wing
#

helo, ive moved my bot to a server but im getting the error ValueError: path should be started with / or be empty when i send a test vote D:

night ingot
#

well, does your path start with a / ?

wet wing
#

no , but all the things here start them with a http:// , and when i added a / i got another error 😔

night ingot
#

Show your code

#

Your webhook path isn't supposed to start with http://

upper valley
wet wing
#
import discord
from discord.ext import commands


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

    def __init__(self, bot):
        self.bot = bot
        self.token = 'token' # set this to your DBL token
        self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True, webhook_path="http://ip:5000/dblwebhook",webhook_port=5000) # Autopost will post your guild count every 30 minutes

    @commands.Cog.listener()
    async def on_guild_post(self):
        print("Server count posted successfully")


    @commands.Cog.listener()
    async def on_dbl_test(self, data):
        print(f"Received a test upvote: {data}")

def setup(bot):
    bot.add_cog(TopGG(bot))```
night ingot
#

your webhook_path is supposed to be only /dblwebhook

wet wing
#

wait what aaa

#

i may be un smart

pseudo sierra
#

ahh if someone remembers me the issue was that my router is a bit old and doesn't support port forword

wet wing
#

is the error ERROR:asyncio:Unclosed client session releveant here

night ingot
#

That's more of a warning, but you should probably find a way to close the connection

wet wing
#

ok, how can i do that? im not getting the print even though ive changed to /dblwebhook D:

night ingot
#

Is port 5000 open on your server's network?

wet wing
#

how can i check?

night ingot
wet wing
#

says its open!

night ingot
#

And you entered the correct url on your webhook page?

#

http://<your server's ip>:5000/dblwebhook ?

wet wing
#

http://ip:5000/dblwebhook

#

yep

night ingot
#

And you hit "save" after you changed the url, yes?

wet wing
#

yep!

night ingot
wet wing
#

ill have a look at it, ty!

#

hmm, i just keep getting client closed warnings but no prints

#

how can i close the session?

grand lichen
#

THERE'S vote like rewards for vote like :
if(vote) give him coins & send a message in direct for hin
I can make it

cold root
#

ya..

#

then do it when your bot is on top.gg..

sullen nymph
#

@wet wing I'm curious

#

Are you aware of topggpy

dull glacier
#

Hi

native root
#

Any idea @livid orchid bot in my server offline

dull glacier
#

I am new here

dire cairn
dire cairn
minor pine
#

i installl npm i topgg-autoposter

#

i use this ```const AutoPoster = require('topgg-autoposter')

const ap = AutoPoster('TOKEN', bot)
ap.on('posted', () => {
console.log('Posted stats to top.gg')
})```

#

for repl its show Error

sullen nymph
#

What's the error

dire cairn
#

show your index.js

#
const ap = AutoPoster('TOKEN', bot)
ap.on('posted', () => {
    console.log('Posted stats to top.gg')
})
``` your this code will be after you defined bot
sullen nymph
#

Good job leaking your token

dire cairn
#
const bot = new Discord.Client()
//rest of te code
sullen nymph
#

Oh seriously

minor pine
#

okey

dire cairn
sullen nymph
#

No I mean

#

It's such a basic mistake

dire cairn
#

Yeah maybe he is a newbie who knows

#

uhhh

#

did you seriously copied my comment also

sullen nymph
#

Eugh

grave ridge
#

can i obtain username from user id without intents?

sullen nymph
#

@minor pine do you realize what you're doing

dire cairn
#

What a nice answer.

sullen nymph
#

Good job, you're trying to blindly copy shit and cram it into a file until it works

#

Instead of trying to actually figure out what's going on

dire cairn
minor pine
#

i use this for autoposter

sullen nymph
#

What you NEED to do is understand that you need your OWN Client object and pass it to topgg autoposter

minor pine
#

why i'm asking From Noobs they don't even know what i'm asking

#

but its Error

sullen nymph
#

Yes good job that's literally a copy paste

#

It won't magically work because there's no bot variable that fits your use case

dire cairn
#

You already have your own client with A... something with name

#

the ss is deleted

minor pine
#

i change Client to Bot

#

in code

dire cairn
#

but they are still the same

#

you just changed the name

#

nothing else

minor pine
#

ok wait

dire cairn
#

Maybe you should learn and practice more

sullen nymph
#

Get a grasp of basic JS PLEASE

#

For the love of God and all living things in this world

#

Save yourself the hassle of blindly copying shit

dire cairn
#

Love of God? really

sullen nymph
#

Putting that aside, what does your code look like in your other file that involves a discord.js client? @minor pine

minor pine
#

its call aoi.js

dire cairn
#

He already has a client he just needs to switch the lines for that autoposter to work as simple as that

sullen nymph
#

Seemed to me as if he copied it in a separate file

#

And only created a bot var because you told him to

dire cairn
#

I didn't really told him to create

#

I meant

#

it will go below his bot vairable

sullen nymph
#

Simply copied it and crammed it into a file with the autoposter

dire cairn
#

Maybe I'm worse at explaining

sullen nymph
#

You need to break it down to people like these

restive otter
#

api bana para ver

sullen nymph
#

You can't expect them to use coding knowledge because clearly they've fucking neglected the fact that coding needs learning

dire cairn
#

Do you handle this daily?

sullen nymph
#

Not nowadays, but I'm definitely used to it

#

Oh of course it's aoi.js...

dire cairn
#

Maybe he left.... after your sweet messages. Idk just a guess

sullen nymph
#

I'm not the kindest person here as you can see as I prefer to be strict with people when it comes to learning

#

@minor pine you need to put the example you copied in your file where you already work with tour aio.js client object

#

What you did was create a completely isolated file where you don't have access to your aoi.js client that you use for working with events and commands and so forth and so on

dire cairn
#

You are not wrong. You only face this here but I get dms that "fix my code", "Setup this and that bot in my server" and you can't even say no, because at the end of the day you might need their help

sullen nymph
#

When in fact you want to have access to the client because you will use it to identify the bot's ID

dire cairn
#

you see })

sullen nymph
dire cairn
#

after that line your autoposter will go

dire cairn
#

Because I get really tired of this

sullen nymph
#

"I'm busy" KEKW

wet wing
dire cairn
sullen nymph
#

dblpy is outdated and deprecated

#

There's a new package, topggpy

wet wing
#

mhm, i have both packages

sullen nymph
#

Suggest you use either not both tbh 😛

dire cairn
#

Maybe you can directly make a post request and send the data

sullen nymph
#

Preferably the newer one

wet wing
#

ya i mean i have them both download ed

dire cairn
#

installled*

sullen nymph
#

A

dire cairn
#

I'll still suggest make a post request with the topgg api direclty rather than using a package for that simple work

wet wing
#

well when i make a post req with topgg nothing happens 😔

sullen nymph
#

Me in the meantime trying to avoid packages whenever possible

cough while True: instead of python-crontab

sullen nymph
wet wing
#

through another website ya

sullen nymph
#

Made sure the port is open I assume?

wet wing
#

all open

sullen nymph
#

Interesting

#

Can you DM me the URL you use on top.gg?

dire cairn
#

What are you trying to recieve votes?

wet wing
#

i’m kind of an ip newbie are public ips ok to share lol

sullen nymph
#

Not suggested to do it publicly, hence why I suggested DMs

wet wing
#

yea sorry in general

#

when i get on my pc i’ll send 👍

sullen nymph
#

Aye, no worries

dire cairn
#

Hmm

dire cairn
sullen nymph
#

It's a trust thing really

dire cairn
#

Yeah.

nocturne quarry
#

Is there are a way to get user vote cooldown?

dire cairn
#

it's 12 hours

nocturne quarry
#

Yes I mean time left

dire cairn
#

When a user votes just store it in some db

nocturne quarry
#

okay thanks

dire cairn
#

the timestamp

#

and check it with the current one

nocturne quarry
#

ok

winter tusk
#

What is this error

#

520: unknown error on webserver

sullen nymph
#

Means server error

restive otter
#

f

winter tusk
sullen nymph
winter tusk
#

report where?

sullen nymph
#

5xx codes are server-side issues, most of the time not being related to your input or whatever

#

@pastel raptor see above

winter tusk
sullen nymph
#

Is this a known issue currently?

#

You can try suppressing those errors tbf

pastel raptor
#

huh

#

hi

#

@sullen nymph whats up

sullen nymph
sullen nymph
pastel raptor
#

oh

#

got it

#

thanks

dire cairn
#
(async () => await someFunction().catch(() => null))();
#

Something like that

sullen nymph
#

Ehhh

#

I'd rely more on the fact that the response isn't in a JSON format

#

Silencing all errors isn't feasible and/or advised

dire cairn
#

Then? What will be the advised way?

sullen nymph
#

Parse response in JSON and if that fails, oop oop silence

#

Not sure what's used here and definitely not sure if you can get the response code directly in topggjs

dire cairn
#

Hmm

#

Oh! He was making a http request. I didn't read the messages properly I thought it was something else

sullen nymph
#

kekw

dire cairn
#

Need to add many things in my bot and one of the things is keeping a cache of the votes

winter tusk
dire cairn
#

Then maybe go with my solution

#

Because you are not directly making http request

#

For now it's not a permanent fix

#

Or maybe do something Sh#t like

#

Store your error in a set

#

And check if it is already there or not

#

If not log it and set it to the set

#

Or if it is there return

#

Never tried and don't know it is a good practice or bad

#

Because I'm really thinking to try something like that

steady gulch
#

hi this is my code:

const Topgg = require('@top-gg/sdk')
const Discord = require("discord.js")
const db = require("quick.db")
const bot = new Discord.Client()
const express = require("express")
const app = express()
const webhook = new Topgg.Webhook('somepassword') 
app.post("/topggwebhook", webhook.listener(vote => {
    res.send({status: 200})
    bot.users.fetch(vote.user).then(async someuser => {
        console.log(someuser)
        if (someuser) {
            someuser.send("Thanks for voting! You have recieved 200:Qp:")
              db.add(`wallet_${someuser.id}`, 200)
        }
    })
}))

when i test the webhook, nothing happens

steady gulch
jaunty plank
#

only approved bots can use webhooks.

steady gulch
#

it is approved

#

Mysterious Bot Alter

#

i am helping the dev coding

jaunty plank
#

it might be easier if they ask for help then, playing a game of telephone while helping a dev is a lot harder.

steady gulch
#

i am a dev actually, but i don use that account anymore, I can come back on that acc if that's okay?

jaunty plank
#

ah, then your the one developing it?

#

wheres it being hosted then?

#

home/vps/hosting site

#

if its at a home, youll need to port forward

#

youll also need to add the url and auth to the bots page(to the webhook)

river verge
#

me

river verge
jaunty plank
#

did you fill in the url and auth on the bots edit page?

river verge
#

yup

#

even when i tried voting, i was given no response

#

for other bot sites, it works

jaunty plank
#

do you have the app.listen(portnumberhere) line?

#

dont see it in the code given

river verge
#

yup

jaunty plank
#

http://VPSIP:PORTHERE/topggwebhook
^ url looks something like that? filling in vpsip and porthere(note http, not https, unless you have a valid SSL cert)

'somepassword'
auth should be ^

river verge
#

OH

#

i think it's https

#

dat migjt be the problem

#

lemme change and see

jaunty plank
#

next thing to check would be if you have any firewalls blocking the specified port.

desert fractal
#

hello

#

how to make webhook thing for upvote?