#topgg-api

1 messages · Page 162 of 1

earnest roost
#

Does nothing

#

No errors no nothing

sullen nymph
#

Have you tried opening http://ip.address.of.machine/dblwebhook when running the webhook

earnest roost
#

im using replit

sullen nymph
#

Using the repl.co URL without setting the port in the URL?

earnest roost
#

Ig

#

Im basically shit at websites
Ik almost nothing

sullen nymph
#

Your URL will be something like https://yadayada.xxx.repl.co/dblwebhook

earnest roost
#

Ye ik that

#

It says cannot GET /dblwebhook

sullen nymph
#

What the hell is "that /dbl thing" in your code

earnest roost
#

this /dblwebhook

#

Am i supposed to put Something like this

#

?

sullen nymph
#

No

#

What do you get when you remove the dblwebhook from the URL and visit it

restive otter
sullen nymph
earnest roost
#

That's what it says

#

So?

sullen nymph
#

wtf else are you running

earnest roost
#

the server

#

I mean

sullen nymph
#

Apart from the webhook on your repl

#

and your bot

#

are you running a keepalive script

earnest roost
#

Ye

#

Shouldn't i?

sullen nymph
#

Now here's the thing right

#

repl technically works with just one webserver running at the time

#

(unless you do some weird ass magic trickery with forwarding the requests yourself)

#

so guess what

#

you're running 2 webservers

#

Repl is only reacting to the first one that's running

earnest roost
#

So I can't have both?

sullen nymph
#

You can, but you must combine them into one webserver

earnest roost
#

Oh

#

Lemme try

sullen nymph
#

It can be a webserver running within your bot as you can see from the webhook example

#

since it relies on express

earnest roost
#

Wait but one has listen 3000 and one 80

sullen nymph
#

Same logic still applies

#

Try adding a route to your keepalive that responds with whatever text and see what happens when you visit your repl.co URL with that route

earnest roost
#

So the problem is from replit?

#

The rest of the code should work fine?

sullen nymph
#

The problem is, like I said, you hosting 2 fucking webservers on one repl

#

Combine them into one

earnest roost
#

How to make this work

sullen nymph
#

what...

#

Have your express server handle the keepalive requests...

earnest roost
#

how?

sullen nymph
#

Create a GET/POST/(whatever method) handler on a specific route you will have your pinging service send requests to

earnest roost
#

man im not smart

sullen nymph
#

Look up express examples/tutorials

earnest roost
sullen nymph
#

If it's accessible through the internet, sure

earnest roost
#

So i don't need anything else?

#

Like a channel webhook or anything

sullen nymph
#

If you need it then you need it

#

If you don't want to use it then you don't need it

earnest roost
#

Uhm kk

#

Thank you

#

@sullen nymph one more quick question, if ik the ip of the host, how do i add it on top.gg

#

The webhook

sullen nymph
#

http://ip.address.yada.yada:port/route

earnest roost
#

ahh icic

#

Thanks

shell crest
#

How to make a get request to get how many people have voted?

#

I looked at the documentation, and it seems that it is only acessable using express

warm pelican
#

I'm trying to use the topgg api for python and im trying to get the vote event to work but it's not working

bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
bot.topgg_webhook.run(5000) 

@bot.event
async def on_dbl_vote(data):
    print(f"Received a vote:\n{data}")


@bot.event
async def on_dbl_test(data):
    print(f"Received a test vote:\n{data}")
arctic musk
wet arrow
#

what is the DBL_API_KEY and where do I find it?

arctic musk
#

in the webhook section of bot edit page @wet arrow

restive otter
#

This is redundant because nothing's dispatching the event.

warm pelican
#

I think I know what causing it

arctic musk
#

are you using a vps or?

#

for me i have a vps and i just direct the webhook to my vps ip like

warm pelican
#

ok thanks I will keep that noted when I get that ready

arctic musk
#

make sure you open a port ehen u do also

#

like i use port 8080

#

all depends on what type of vps u get

warm pelican
#

ok

arctic musk
#

why is that out putting 1

#

they have voted more then once

#

this month

jaunty plank
#

It only outputs 0 or 1

#

0 means hasn't voted, 1 has voted

willow spindle
#

why 0/1 instead of boolean

small wraith
#

Can i see how many votes it have?

#

With the api

jaunty plank
#

nope, youll need to track that yourself.

arctic musk
balmy hamlet
#

I mean 0 and 1 are booleans as well, but still

vale snow
#

UHM, I've looked around for a hot while(1 month) and I can't find a single thing which allows you to send a message to your discord channel telling when someone votes.

worthy jay
#

im trying to set up a webhook but i get an error:

Task exception was never retrieved
future: <Task finished name='Task-1' coro=<WebhookManager._run() done, defined at /opt/virtualenvs/python3/lib/python3.8/site-packages/topgg/webhook.py:142> exception=ValueError('path should be started with / or be empty')>
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/topgg/webhook.py", line 144, in _run
    self.__app.router.add_post(webhook["route"], webhook["func"])
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/aiohttp/web_urldispatcher.py", line 1167, in add_post
    return self.add_route(hdrs.METH_POST, path, handler, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/aiohttp/web_urldispatcher.py", line 1094, in add_route
    resource = self.add_resource(path, name=name)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/aiohttp/web_urldispatcher.py", line 1071, in add_resource
    raise ValueError("path should be started with / or be empty")
ValueError: path should be started with / or be empty

Here is my code:

#in my code i replaced myip with my ip
client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("http://myip:5000/dblwebhook", dbl_token)
client.topgg_webhook.run(5000)

@client.event
async def on_dbl_vote(data):
  if data["type"] == "test":
    return client.dispatch('dbl_test', data)

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

The route passed to dbl_webhook is the /dblwebhook part

#

aka the route

#

The rest is your URL, aka something that only ENDS WITH the route

vale snow
sullen nymph
vale snow
#

bro

#

like

#

i suck at topgg api

sullen nymph
#

You can admit that you don't have experience with working with HTTP APIs generally

#

Give me a sec

sullen nymph
#
URL

A Uniform Resource Locator (URL), colloquially termed a web address, is a reference to a web resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifier (URI), although many people use the two terms interchangeably. URLs occur most commonly to reference web...

vale snow
#

I don't know a single thing about API's

sullen nymph
#

path = route

#

So, the path/route you handle on your machine and the port you run on

#

You don't set those in the route

#

Usually you would specify either localhost or 0.0.0.0 as the IP (placeholder for "all available IPs" when running the webserver manually via some other framework DIRECTLY (since topggpy uses aiohttp.web under the hood, you don't need to set the IP. topggpy will do it for you, but you MUST provide a port to run on, which, by default, is set to 5000 in the example(s))

vale snow
#

Oook

sullen nymph
#

You run a webserver on your machine either as localhost or all available IPs on a port. The webserver itself handles whatever routes you add handlers for. topggpy (as you can see) provides helper methods for that via dbl_webhook and dsl_webhook methods on WebhookManager.

glad merlin
#

._.

forest trench
#
OSError: [Errno 10048] error while attempting to bind on address ('0.0.0.0', 5000): only one usage of each socket address (protocol/network address/port) is normally permitted

im getting that error for this

client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "password")
client.topgg_webhook.run(5000)
tidal peak
#

Try a new port

forest trench
#

ok

forest trench
tidal peak
#

Its better if it is > 1024

forest trench
#

same error

tidal peak
#

Wait what

still flume
#

Hi, I have a question how to make a message when someone votes?

tidal peak
forest trench
#

i tried 5040, but ill try that

forest trench
tidal peak
#

Weird

#

The script is probably running twice

forest trench
#

twice?

#

nope

restive otter
#

i'm getting error

#

Failed to post server count
Unauthorized: Unauthorized (status code: 401)

#
import os
os.system('pip3 install -r requirements.txt')

import discord
import datetime
import keep_alive
from discord.utils import get
from discord_slash import SlashCommand
import json
from giphy_client.rest import ApiException
import giphy_client
from discord.ext import commands, tasks
import asyncio
import random
from prsaw import RandomStuffV2
import DiscordUtils
import aiosqlite
from discord_components import DiscordComponents, Button, ButtonStyle, InteractionType
import youtube_dl
from async_timeout import timeout
import functools
import itertools
import math
import topgg

intents = discord.Intents.default()
intents.members = True
intents.presences = True
client = commands.Bot(command_prefix=',', intents=intents, case_insensitve=True)
client.remove_command('help')
slash = SlashCommand(client, sync_commands=True)
rs = RandomStuffV2(async_mode=True)

dbl_token = "sercret"
client.topggpy = topgg.DBLClient(client, dbl_token)


@tasks.loop(minutes=30)
async def update_stats():
    try:
        await client.topggpy.post_guild_count()
        print(f"Posted server count ({client.topggpy.guild_count})")
    except Exception as e:
        print("--------------------")
        print(f"Failed to post server count\n{e.__class__.__name__}: {e}")
        print("--------------------")


update_stats.start()
forest trench
still flume
#

Hi, I have a question how to make a message when someone votes?

#

Sry but i don't understand the modules

forest trench
#

Is there something different for the webhook if you'r hosting from your pc?

hallow herald
#

guys, why this doesn't work?

//------------Top.gg------------
const Topgg = require('@top-gg/sdk')
const express = require('express');

const app = express();

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

app.post('/dblwebhook', webhook.listener(vote => {

    bot.channels.cache.get("860843237022498856").send(`${vote.user}`)

}))
``` Made in js
still flume
#

Try but i think no

hallow herald
#

I know

#

But why

still flume
#

Try idk x)

hallow herald
#

IT DOESN'T WORK

#

Sorry for the caps

still flume
#

Error ?

hallow herald
#

nope

forest trench
hallow herald
forest trench
#

no idea

#

then

still flume
hallow herald
#

I did

#

doesn't work

still flume
#

You use a webhook

hallow herald
#

Like in the website?

#

this?

fallen nymph
#

TOKEN , is not a legal HTTP header value

#

error

hallow herald
#

idk

fallen nymph
#
const { AutoPoster } = require('topgg-autoposter')

const ap = AutoPoster(process.env.topgg, client)

ap.on('posted', () => {
  console.log('[+] Stats Posted on Top.gg')
});
#

My Code

hallow herald
still flume
#

I'm trying to help you, I think we have to do a webhook server

hallow herald
#

Why can't they make a simple API?

still flume
still flume
hallow herald
#

And i didnt understand a thing

still flume
fallen nymph
# still flume https://docs.top.gg/resources/webhooks/
const { AutoPoster } = require('topgg-autoposter')

const ap = AutoPoster(process.env.topgg, client)

ap.on('posted', () => {
  console.log('[+] Stats Posted on Top.gg')
});

Error : {Token} is not a legal HTTP header value

still flume
#

Well I think we're all lost x)

restive otter
#

How can i track votes made to my server with my own bot?
I've looked at the API docs, but it is not simple to understand and only explains how to track bot votes and not server votes

still flume
tulip umbra
#

why top.gg's webhook after sending test POST by Test button sending a empty POST?

#

👀

still flume
#

GrappyEnSueur Idk

tulip umbra
#

pardon, i just seeking $_POST but i was needed read php://input

#

i excepted like POST with parameters

#

but that's POST with json

#

so it was my mistake :_)

still flume
#

Oh ok

#

Who can explain to me how without using a webhook I can send a message when someone votes?

coarse rune
#

U cant

plucky lance
#

That doesn’t require webhooks but continues HTTP requests to the API.

dire cairn
#
this.client.snek.get(`https://top.gg/api/bots/${this.client.user.id}/check`, {
      params: { userId: msg.author.id },
      headers: { 'Authorization' : this.client.config.dbl }
    }).then(i => i)
``` hey anyone knows why this is returning me 403?
#

oh wait

#

nvm

#

I used wrong client id

plucky lance
#

The client ID has to be your bot id

sinful pond
#

Why its doesn't sending notification

tender breach
#

What URL do I really have to put in the Webhook URL box? Is it the Discord webhook URL?

restive otter
#

no

tender breach
#

Oh ok

restive otter
#

you need to setup a webhook server

tender breach
#

Ik this might make me sound like a noob, but how to do it?

restive otter
#

what do you use(coding lang) and where do you host your bot

tender breach
#

Js

#

I use something.host

restive otter
#

can you host a webserver on it because i never used it so ¯\_(ツ)_/¯

tender breach
#

Hmm idk. It has lots of hosting services, but i use discord bot one

#

I dont really have a VPS myself

restive otter
#

so you need @top-gg/sdk to do webhook server

#

check pins for an example

tender breach
#

In pins

#

Wait a min. Can i use my hosting server's ip address?

#

Will it work?

#

@shut flume should it look like this?

restive otter
#

What's best for hosting discord bot

#

24/7

tender breach
#

I cant really answer that

#

There are no "the best hosting"

restive otter
#

Not the best

tender breach
#

U just gotta test them to see if they suit u

restive otter
#

But just a good hosting

#

Rn im hosting local to get bot working

#

But almost completed

tender breach
#

Hmm. I would find the one that uses Pterodactyl servers

restive otter
#

Alr

tender breach
#

Cuz it's easy to manage (for me)

restive otter
#

Alright

#

Is it easy to transfer a ton of files there?

#

Or can I get just git clone?

tender breach
tender breach
tender breach
#

Idk why, but i spent 6 hours working on the vote webhook. But nothing works

#

I put the correct port

#

I put the correct webhook auth

#

But when i try it out, nothing happens.

#

No console, message, nothing.

#

What am i doing wrong?

#

Ping me if anyone can help

rain heart
#

http, not https

#

And I really suggest you to use a different port

coarse rune
#

can some one help me with my ip

#

like idk what to put in the top.gg dashboard

#

so can someone help me

#

i use js

tender breach
tender breach
rain heart
#

You're using 23 in your url

#

And use http because HTTPS makes no sense when you have a port added

tender breach
#

Oh that one. I didnt realize the 2000 one

#

The 23 one was for sftp

#

Actually, that whole url is for sftp (except the /dblwebhook and http:// part)

rain heart
#

Doesn't make any sense when you use 23

#

Sftp is for sftp, not webservers

tender breach
#

Ik

#

But i didnt know what to put, so i just try it

rain heart
#

No wonder it wouldn't work

#

Use the port you have on your code

tender breach
#

The current one im using is http://0.0.0.0:2000/dblwebhook

#

Cuz it says so in my server

#

Idk

rain heart
#

Not 0.0.0.0, replace it with your server ip

#

0.0.0.0 is a way to say "can connect from anywhere, localhost, internal, external"

tender breach
#

That's all it says

#

Do i put the https:// one?

rain heart
#

Use the URL they give you

#

Yes

#

If that doesn't work, you're better off asking your hosting provider tbh

tender breach
#

Hmm ok

tender breach
rain heart
#

Use the URL they gave you

tender breach
#

Or no /dblwebhook

rain heart
#

Yes, that should work

tender breach
#

Oh ok

#

Hmm i really hope so

rain heart
#

As long as you're also using the port 2000 in your code

tender breach
#

app.listen(2000)?

#

Im still confused, which one is better to use. dblapi.js or the original @top-gg/sdk

tulip umbra
#

i just coded on php own webhook mini handler

#

because i have own www host

restive otter
#

isnt https more secure website then http?

#

idk i heard that somewhere might be confused tho

tulip umbra
#

http(s) is more secured than just http

restive otter
#

i see

#

i own just a http

#

bc at first i didnt really want to do anything with the website

meager pebble
#

sry wrong channel

#

I was reading something here and accidentally ctrl v + enter the command

#

pls don't mute me, the channel description is quite scary...

sullen nymph
#

Accidents happen

delicate saffron
#

any1 recommend any hosting websites to host my bot 24/7

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.

shut remnant
#

Vote Credits what does it means?

deft bluff
#

Top.GG API Error: 401 Unauthorized (You need a token for this endpoint)
why am i getting this error?

deft bluff
#

is it because i am testing it on my test bot and not on the main bot?

restive otter
#

yes you need to test on the main bot

deft bluff
restive otter
#

yw 🙂

hushed reef
#

@gaunt steeple hey, going to DM you abt. smth.

#

(totally not pinging you because i didn't forget your username 💀)

vital rain
#

Why does my api token keeps on getting reset after a few users check there vote stats?

rain heart
#

it doesn't get reset

vital rain
#

everytime i reload the page and press "show token" its a different token each time

#

breaking my code

rain heart
#

what's the url you're reloading on

vital rain
#

also i randomly get this error in code

#

and i have to change token to fix it

rain heart
#

that's a known issue, but refreshing does not reset your token

#

kinda works the same like discord does

vital rain
rain heart
#

again it's a known issue iirc, no eta on a fix

vital rain
#

oh okay, so i'll just have to reset token when it appears and pray it works lol

deft hollow
#

I want setup webhook guys

#

@trail sigil

#

@jaunty plank

jaunty plank
#

sure, what library?

deft hollow
jaunty plank
deft hollow
jaunty plank
#

auth is a password, you make it.

deft hollow
#

Oh

#

Thank you

#

But I have a question

#

app.listen(80) this is port?

jaunty plank
#

yeah, youll probably not want to use 80.

#

80 is just the example

deft hollow
#

I use heroku

#

I used this port 3000

sullen nymph
#

Rely on the environment variable PORT

fallen nymph
#

Vote Credits what does it means?

proven kiln
#

@restive otter

solemn vessel
torpid coral
#

if you are using python:

#
import requests,json
headers = {
        "Authorization": "token"
    }
page = requests.get("https://top.gg/api/bots//check?userId=", headers = headers).json()
print(page['voted'])```
#

@solemn vessel

solemn vessel
#

I use js

solemn vessel
sullen nymph
old kernel
#
const express = require('express')
const Topgg = require('@top-gg/sdk')

const app = express() // Your express app

const webhook = new Topgg.Webhook('topggauth123') // add your Top.gg webhook authorization (not bot token)

app.post('/dblwebhook', webhook.listener(vote => {
  // vote is your vote object
  console.log(vote.user) // 221221226561929217
})) // attach the middleware

app.listen(3000) // your port

how to create a webhook for a dbl

#

like if i need topgg vote count for a user and user dm after vote and bot alert send in here support server if some one vote

#

i know i need to make webhook but how anyone can explain

jaunty plank
jaunty plank
#

thats the code above to make a webhook

old kernel
jaunty plank
#
const express = require('express')
const Topgg = require('@top-gg/sdk')

const app = express() // Your express app

const webhook = new Topgg.Webhook('topggauth123') // add your Top.gg webhook authorization (not bot token)

app.post('/dblwebhook', webhook.listener(vote => {
  // vote is your vote object
  console.log(vote.user) // 221221226561929217
})) // attach the middleware

app.listen(3000) // your port
#

👀

jaunty plank
#

maybe rephrase the question, because I'm really not sure what your asking for? thats the code to make a webhook

old kernel
#

no

#

am asking for

#

this

#

how can i make

jaunty plank
#

oh, the url is just the url to the webhook.

old kernel
#

https://discord.com/api/webhooks/854908126814011392/1EpSbAURRbEGuqeDlJEvRZ1u_DzaENWdmgztz9gztE0rSnJUWTpO2DROkZyui0yLmFL4

#

be like this

jaunty plank
#

looks something like http://IPHERE:3000/dblwebhook

#

no

#

top.gg webhooks are not discord webhooks

old kernel
#

this is my question

jaunty plank
#

you just fill in the relevant information.

old kernel
#

like?

jaunty plank
#

http://IPHERE:3000/dblwebhook

#

just fill in IPHERE

old kernel
#

oh

#

how can i get ip

jaunty plank
#

its the ip to your server

#

or fill in the project url if you dont have an ip

old kernel
#

uff!

tepid stump
#

Hi

toxic sorrel
#

Hey

buoyant wave
#

Hello I am new to discord.js bot coding and I would like to know how to announce that a person has voted for the bot on top.gg if you can mp me

toxic sorrel
#

Ugh. 3 channells... SPAM!!!!

pallid cedar
#
import topgg

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

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}")

So how do I customise this code to send webhooks for my bot?

restive otter
pallid cedar
#

like what do I put in the password?

toxic sorrel
#

Frog

#

Oh yeah. Today Thursday...

sullen nymph
wise grove
#

To receive the test data, do you need to put the webhook as "http://0.0.0.0:port here" or would it have to be "http://myip:port here" ?

rain heart
#

myip

white wyvern
#

Not sure what this is.

#

.. but good luck.. heading to sleep.

rain heart
#

site issues rn

restive otter
#

Hi, i see that some bots can manage/track server voting, but i only see things for bots on the docs. How am i able to track my own server votes with my own bot?

rain heart
#

servers doesn't have an api

#

they do it through webhooks

restive otter
rain heart
#

read above

restive otter
# rain heart read above

This?

const express = require("express")

const app = express()

const webhook = new Topgg.Webhook("your webhook auth")

app.post("/dblwebhook", webhook.listener(vote => {
  // vote will be your vote object, e.g
  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
}))

app.listen(80)```
restive otter
#

how can i configure the webhook?

solemn vessel
soft vault
#

One message removed from a suspended account.

young rapids
#

hi

visual relic
#

docs only shows how to get info on bot or user how do i get info on server

shut remnant
#

How has the bot in 165 servers yet not been verified?

restive otter
#

api

toxic sorrel
#

NITRO SCAM!!!

eternal lynx
#

its always not shwoing servers number if the bot is new or need change settings ?

rain heart
#

-servercount

abstract mothBOT
honest iris
#

HEllo?

vast umbra
#

how do i get all votes this month?

jolly widget
#

Afaik you can get the last 1000 votes but after that you need to use the web hooks

fluid violet
#

Why do i have here 6 votes:
https://top.gg/bot/855372526875574273
But as an api response i only get 3:
Im using

https://top.gg/api/bots/855372526875574273/votes
fathom bronze
restive otter
#

hello

#

please help me guys

#

i cant figure out why the api is not working

#
const Topgg = require(`@top-gg/sdk`)


module.exports = {
  name:"check",
  async run(client,message){
  const api = new Topgg.Api('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjgwMDYyOTM1Mjc1MjM0OTE5woooooooooooooooooooooooooooiaWF0IjoxNjI3MDU1NzM0fQ.8WgdoovRk2_q5m8MPCFpsiz0rNaIz0f2vGHOrAMF1xE');
  await api.hasVoted(message.author.id)
  }
}```
#

its giving me authorization error 401

#

and saying that this end point needs token

#

however i have provided the token

#

please ping me if someone is responding

#

🙏

sullen nymph
restive otter
sullen nymph
#

Because you posted it here

restive otter
#

but do u k a solution?

sullen nymph
restive otter
#

its not

sullen nymph
#

whatever

restive otter
sullen nymph
#

Make sure to create only one Api object and reusing it instead

restive otter
#

made sure

sullen nymph
#

But putting that aside, just try resetting your token multiple times until it works

#

make sure you copy it fully and without extra characters

#

This is pretty much a known issue I believe and you're not the first person to experience this

restive otter
#

lemme try couple of more times

restive otter
sullen nymph
restive otter
#

wait

#

can u tell me one thing

#

i have to use the token from the webhook page right?

sullen nymph
#

Yup

#

The /webhooks route

restive otter
#

but aint working

sullen nymph
restive otter
#
node:563) UnhandledPromiseRejectionWarning: Error: 401 Unauthorized (You need a token for this endpoint)```
#

this is the error

jolly widget
#

you need to use your token

restive otter
#

i m using my token

brisk sage
jolly widget
#

top gg

#

you shouldn't give your bot token to anything other than the discord api

brisk sage
restive otter
#

i redeemed 5 times or 6 ig

brisk sage
restive otter
#

lmao

brisk sage
restive otter
#

idk what you mean

next pendant
#
 res.statusCode = 200;
        return res.end(JSON.stringify({ message: "Successful" }));
``` responding with 200 and closing connection still periodically getting multiple requests
#

any ideas>

#

I tested the route and the requests do respond with 200

dusky monolith
#

You forgot an "s"

next pendant
#

?

#

no it's end lol

dusky monolith
#

Oh

#

I'm sorry I'm not very experienced with express, I thought it's send 😅

faint ledge
#

When i run a test i get invalid HTTP method

faint ledge
#

I fixed it i used https instead of http

light spade
#

when i try to fetch stuff it says

sullen nymph
#

Yes

dapper flower
#

What am I able to add to my bot with the top.gg api?

copper vale
#

any one top up diamond

restive otter
#

How to set webhooks

#

Can anyone tell me

#

Ok

dapper flower
#

What can you all do with the api?

restive otter
dapper flower
restive otter
#

yeah

restive otter
deep thunder
#

can i know where to find my top.gg api key?

#

ok thx i get it xD

toxic sorrel
#

Xdddd

deep thunder
#

just now i check the pins XD

restive otter
#

steel shale
#

when I go to the edit page of my bot, it shows me this error

rain heart
#

Known issue, not related to api tho

steel shale
#

ok

delicate saffron
#

const Topgg = require("@top-gg/sdk")
const express = require("express")

const app = express()

const webhook = new Topgg.Webhook("your webhook auth")

app.post("/dblwebhook", webhook.listener(vote => {
// vote will be your vote object, e.g
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
}))

app.listen(80)

#

So let’s say I put this in my index file how do I lock a command to voters only

golden adder
jaunty plank
#

its okay at small scales, but your very likely to get issues after a certain point.
best to do it right from the beginning.

sullen ore
#

lolo

toxic sorrel
#

?

remote rune
#
    bot.topggpy = topgg.DBLClient(bot, constants.TOP_GG_TOKEN)
    bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook(f"http://{EXTERNAL_IP}:3000/dblwebhook", "topggvote")
    bot.topgg_webhook.run(3000)

Should something like this work? Or do I need to create a server with Flask or something? (to listen for post requests)

restive otter
#

You should only pass the path there, i.e., /dblwebhook

remote rune
#

? Like this

bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook(f"/dblwebhook", "topggvote")
sullen nymph
#

Yup

remote rune
#

o alright

#

thx

remote rune
#

Anytime I test the vote nothing happens

#

does not enter the on_vote method

#

Are there any reasons this could be happening?

restive otter
#

Is there a known issue with an incorrect number of votes in the /votes endpoint

#

My API is telling me top.gg is sending back this many votes

#

Which is disproportionate when I have 88 votes and that's 13

upper badger
#

How to detect if somebody vote? Python

rain heart
real yew
#

Hi I want to know that can i claim my votes rewards next month also or it will expire before 31st ?

upper badger
daring yew
#

I get this after clicking save & send test , how do i fix it ?

final wren
#

it happens anytime :/

#

i cant even test it

daring yew
upper badger
#

@shut flume and then?

#

@shut flume do you know somebody who uses top.gg with python? because it doesnt work for me

sullen nymph
upper badger
sullen nymph
#

How do you use WebhookManager?

upper badger
sullen nymph
#

What URL and Authorization key did you enter on top.gg?

sullen nymph
#

What happens when you send a manual request to that URL?

upper badger
sullen nymph
#

I meant, what does the server respond with when you try sending a manual request to that URL yourself?

upper badger
sullen nymph
#

Use reqbin

#

Send a request to that URL yourself

#

POST method, whatever JSON you feel like throwing at it

upper badger
#

sent

#

and then?

#

@sullen nymph

restive otter
#

IMO you should only use either integromat or your own webserver in which case you can use topggpy to set it up, not both.

restive otter
#

Using the former, you can catch the webhook message and parse it, but tbh it's rather hacky.

restive otter
sullen nymph
#

Oh hold on

#

Christ, I missed the key part

restive otter
#

I believe it's from some random YouTube video, shiv bloblul

upper badger
sullen nymph
#

I remember someone here suggesting Integromat

#

You know what

#

Apparently people don't know how to get this shit working without tutorials

#

Guess I'm making a separate section in the docs just for this

restive otter
#

That'd be useful for starters.

upper badger
#

So what do i need to use?

sullen nymph
#

Either Integromat or topggpy. If you use Integromat to send a request to a Discord webhook, then you don't need topggpy. Pointless to use both at the same time

upper badger
#

And how i will use topggpy?

sullen nymph
#

@restive otter just got an idea of Integromat -> Replit -> Heroku -> Glitch -> VPS -> local webserver

sullen nymph
restive otter
#

The vote data travels the internet KEKW

sullen nymph
#

Even vote data sometimes needs a vacation

pure quarry
#

does the python client have post users or is that not a topgg thing

lyric smelt
#

my bot is clustered and the server count is always incorrect in top.gg

sullen nymph
lyric smelt
#

hmm can anyone help me

atomic nebula
#

how can i set it up?

pure quarry
pure quarry
atomic nebula
pure quarry
atomic nebula
pure quarry
#

no, you probably have a db anyway for your bot so

atomic nebula
pure quarry
#

json is not meant for databases lol

#

you should change that

#

if u use python, asqlite/aiosqlite is not hard to use anyway and just learn sql

atomic nebula
pure quarry
#

sql is just as easy and more readable if you open it in a viewer lol

jaunty plank
#

its the auth to the webhook, its what you fill in on the site.

your the one who decides it

swift kiln
#

hi

#

can anyone tell me how to send a message when a user votes

jaunty plank
swift kiln
#

ok

#

thx

swift kiln
#

;-;

jaunty plank
#

what do you not understand?

restive otter
#

What do I put here?

jaunty plank
#

thats the URL to your webhook receiver that you make in code.
will probably look something like this
http://IPHERE:PORTHERE/PATHHERE
port and path are defined in your code, ip is the ip to the server.

If your using a host which doesnt provide an IP youll want to use the projects web url, with the path.

jaunty plank
#

you need to use the ip of the server, or network your hosting your bot from

restive otter
#

I already have my token, now what do I do?

jaunty plank
#

you dont really need a valid token for webhooks.

#

the token is for the api, not webhooks

restive otter
#

what I want to achieve is that some commands are not allowed to be used without first voting

jaunty plank
#

so, you'll need a database for that with webhooks, or check the hasvoted endpoint(generally less recommended for any kind of scale).

restive otter
#

It is somewhat complicated to do this, and more if I do not speak English hahaha

restive otter
#

i did this but the stats are not getting posted ("Yes i added my api key")

#

is their someone who can help pls?

upper badger
#

Somebody can help me to make webhook using heroku? Python

restive otter
restive otter
#

make sure the webserver is running

rain heart
#

remove the :80

#

as 80 is the default for http

#

and depending on if you have something on there already, use a different port

#

like 2000 or 12345 etc

viscid turtle
#

Good evening, I would like to make a code that allows you to see who voted for my bot

Could help me please

viscid turtle
#
const client = new Discord.Client() // Your discord.js or eris client (or djs ShardingManager)
const { AutoPoster } = require('topgg-autoposter')

const ap = AutoPoster('Your Top.gg Token', client)

ap.on('posted', () => {
  console.log('Posted stats to Top.gg!')
})

const Topgg = require("@top-gg/sdk")
const express = require("express")

const app = express()

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

app.post("/dblwebhook", webhook.listener(vote => {
  // vote will be your vote object, e.g
  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
}))

app.listen(80)``` how i find the top.gg token
jaunty plank
#

-pins

abstract mothBOT
#

Your question is likely answered by one of pinned messages. Please take time to read the pinned messages by clicking on this icon.

grizzled pebble
#

somehow the webhook for the server doesnt work and gives error when trying to test it

jaunty plank
#

@woeful prairie hey, whats your code look like for your web-hook receiver?

woeful prairie
#

I will share the code

jaunty plank
#

did you fill in the webhook url and auth on the site?
whats your hosting location

woeful prairie
#

Can I share GitHub code link?

jaunty plank
#

does railway app give you an ip or project url? do you know what ports they allow?

#

sure, just make sure the github doesnt have tokens visible

woeful prairie
woeful prairie
#

It is hosted in the same place of dashboard, btw dashboard isn't fully ready.

jaunty plank
#

then your webhook url will look something like this.
http://IPHERE:PORTHERE/dblwebhook correct?

woeful prairie
#

Hmm, wait

#

I didn't specify any port, because railway anyway only allows 1 port

#

Should I specify port @jaunty plank

jaunty plank
#

if your using a port other than 80 youll need to.

grizzled pebble
#

webhooks for servers dont work properly.
@jaunty plank ohh i see

#

im getting frustrated

woeful prairie
woeful prairie
#

Okay, I will specify port

#

I changed

#

1 second, I will test

#

Hmm, no. Nothing came in the vote-log channel

#

@jaunty plank I forgot to say, they don't give me an ip, it is domain. It is in the format of <PROJECT NAME>-<ENV>.up.railway.app
If project name is already used, some random number will be added I think

#

<ENV> is environment, I use production for environment

#

If I specify the port, I can't get the 404 page in my browser itself. Maybe railway redirects requests to the port on which my app is running

#

Hmm, wait

jaunty plank
#

maybe it was a miscommunication, because i explicitly asked about these things.

woeful prairie
#

Why shouldn't you ask?

jaunty plank
#

yeah, you will need to use the projects web url, with the path at the end.
typically these typed of providers have a preferred port for websites to use, which you should refer to their documentation to find.

woeful prairie
jaunty plank
#

yep thats the normal way of doing a preferred port.

so your url will look like <PROJECT NAME>-<ENV>.up.railway.app/dblwebhook
unless you added other routes to the path

note youll also want to include http, or https to the url depending on what they allow.

woeful prairie
#

It could be problem with router or top-gg/sdk package

jaunty plank
#

the most basic way to debug that part is with postman(a program for sending https requests) or with more logging.

woeful prairie
jaunty plank
#

this is a post endpoint. visiting the url will never give a valid response.

#

visiting the url = get.

woeful prairie
woeful prairie
#

I will see this afterwards

real yew
#

Can we claim vote rewards next month also or it will expire this month only ?

grizzled pebble
#

@real yew how the rewards count? /vote?

#

any workaround for the server webhook?

real yew
#

$15

#

after 100votes

#

can we redeem it next month or will it expire before the start of next month ?

grizzled pebble
#

thx for the info

fringe edge
#

how would you get ur "top.gg webhook password"?

smoky marten
restive otter
#

and while creating the webhook in code u need to provide the password to authenticate with the top gg webhook

rain heart
void obsidian
restive otter
#

use cmd

void obsidian
#

ok

#

for god sake i am not able to install the top-gg/sdk npm ;-;

worn flicker
#

@void obsidian yoooooo

void obsidian
#

elo

rain heart
void obsidian
#

i dont think so i do npm i and it works..

#

but i got it

#

no i dont

#

it says connect to github but it dosent ;-;

autumn tangle
#

How to get that button for the bot that contains bot logo and server count

#

?

void obsidian
viscid turtle
#

/*-------------------------------------------VOTE-TOP.GG-----------------------------------------*/

const { Topgg } = require("topgg-votes")

bot.topgg = new Topgg({
    token: "I was on top.gg/webhooks/token I copy the long token that I have pasted", // Your top.gg token
    
    auth: "I put the entire webhooks" // Webhook password
})

bot.topgg.postWebhook(bot);

bot.on("newVote", (user, bot, isWeekend, query) => {
    if (query == "bot") {
        let embed = new Discord.MessageEmbed()
            .setTitle(`New bot vote!!`)
            .addField("User", `<@!${user}>`, true)
            .addField("Bot", `<@!${bot}>`, true)
            .addField("Weekend", isWeekend, true)
        bot.channels.cache.get("866691364245602364").send(embed);
        // Enter the ID of the logs channel at ID
    }
    else if (query == "server") {
        let embed = new Discord.MessageEmbed()
            .setTitle(`New server vote!!`)
            .addField("User", `<@!${user}>`, true)
            .addField("Server", `${bot}`, true)
        bot.channels.cache.get("866691364245602364").send(embed);
        // Enter the ID of the logs channel at IDun temp 
    }
})```A kind person could help me please I'm lost
restive otter
sullen nymph
#

See pinned messages

smoky marten
hollow cradle
#

sending test to webhook seems broken, and webhook doesn't really seem to send anything to the webhook url and info i have added.

upper badger
#

Why events require webhook? Why doesnt it work with token?

plush ore
#

because you have to process the events yourself

upper badger
#

for what this then

radiant peak
#

why does the API randomly return 504 errors?

jaunty plank
radiant peak
jaunty plank
radiant peak
#

Okay

fringe edge
#
const express = require('express');
const { Webhook } = require('@top-gg/sdk');

const initialize = () => {
    const wh = new Webhook(process.env.TOPGGWEBHOOKAUTH);

    const app = express();

    app.post('/dbl', wh.listener((vote) => {
        // dblwebhook

        console.log(vote.user);
    }));

    app.listen(process.env.TOPGGAPPPORT, () => console.log('[Express] The server is running.'));
};

module.exports.initialize = initialize;

i tried using this code to track votes, but when i voted it didnt register in my console, are there any issues in my code?

woeful prairie
# fringe edge ```js const express = require('express'); const { Webhook } = require('@top-gg/s...

As per me there aren't any issues, but it is some problem from top gg library or top gg webhook I believe
I have the same problem.
My code for reference: https://github.com/Welcome-Bot/welcome-bot/blob/feat/dashboard/dashboard/routes/dblwebhook.js

GitHub

A cool multi-purpose discord bot that solves all your problems. I have features such as Moderation, ModLog, Welcome & Goodbye logs, Fun, Music - welcome-bot/dblwebhook.js at feat/dashboard ...

mellow flame
#

um the vote webhook keeps returning a 405

#

is there a way to fix that

thorn hearth
#

What's code for bot title vote

thorn hearth
jaunty plank
#

what do you mean bot title vote?

remote rune
#

should this just work?

#

or do I need to set something else up too

thorn hearth
jaunty plank
#

I don't know what totle is either, so I won't be much help with that.

calm reef
#

like vote.user gives the id
how do i get the monthly vote count?
and does vote.isweekend display if its 2x rewards

normal finch
golden adder
jaunty plank
#

It's the ip you use to connect with ssh, or it'll be provided by your hosting company somewhere

restive otter
#

hello
I'm using the api's webhook
How do I know who voted for the bot?
this information arrives through the
request.post()
or
request.headers

balmy hamlet
# remote rune

why is that an f string if you're not interpolating anything

restive otter
eternal bobcat
#

how to make vote rewards or voted dm message in javascript?

eternal bobcat
#

alright

frigid gorge
#

my bot will soon use "wa2000" which is a great bookstore for a bot that takes RATELIMIT monthly, weekly or to lower the ping

but I'm not sure why I use "topgg-autoposter" to post my bot info on the site, but the new bookstore I'm going to use doesn't have most of the shards' functions

Is it ok to use the "topgg_autoposter" in the event that says if the bot is online?

spare wing
#

Topgg.Webhook('i have to put my token here right?')

#

Togg whebhook token I mean

untold ferry
spare wing
#

how can make webhook url?

elder blade
#

I voted for the bot, but no information came to the console, does anyone know where I made a mistake? By the way, I don't know about this voting thing, please don't be angry.

spare wing
#

Uhh how can I get that dblwebhook url

#

How to make it

#

Someone telll meeeeee

woeful prairie
#

@jaunty plank I fixed my Webhook
Well, how to know if the Webhook I received is a my bot guild or my bot?

woeful prairie
spare wing
#

What about me ?@woeful prairie

woeful prairie
#

The app is the code

spare wing
#

What to put here
Topgg.Webhook('?????')

#

Btw me indian too

woeful prairie
spare wing
#

You can tell me in hindi for easy understanding

spare wing
#

That whebhook url

#

What to do there

woeful prairie
spare wing
#

Url kaha se lau ;-;

woeful prairie
spare wing
#

I host in replit

#

Can't I use that?

woeful prairie
#

I don't know if replit is online always

spare wing
#

Okay let's have a try

#

Thank you for helping

woeful prairie
#

Okay

woeful prairie
spare wing
#

Bohot bohot sukriya

#

xD

woeful prairie
#

Can you help?

jaunty plank
woeful prairie
jaunty plank
#

yep, that sdk works with both guilds and bots.

woeful prairie
jaunty plank
#

yes, look at the parameters they return

woeful prairie
#

Or should I create another route

jaunty plank
woeful prairie
jaunty plank
#

you can make a separate route yes.

#

yep

#

either way works.

#

if you want them both on one route, look at the returned vote.
if you want two routes, then that works too

woeful prairie
#

Oh, I can check if vote.bot is defined

woeful prairie
#

Okay, I will see

spare wing
#

Not working idk why

elder blade
#

Are we going to write top.gg's token here?

sullen nymph
#

No

#

Any password string you want

#

It will have to be the same as your Authorization field on your bot's Edit page in Webhooks section

elder blade
#

what are we going to enter here

bleak night
#

How can i add this into top.gg bot page?

elder blade
#

Are we going to write what we wrote here?

sullen nymph
#

Yes

sullen nymph
mellow flame
#

um is the password mentioned here
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
the authorisation thing or the top.gg token?

restive otter
#

Not top.gg token, it's fully up to you. But it needs to match the one you put on the site.

mellow flame
restive otter
#

Yep

#

Even the example doesn't make use of cogs mmLol

mellow flame
#

thanks

oak vine
#

hey, how to detect if someone voted my bot? and how to get the token?

long storm
oak vine
smoky marten
# oak vine hey, how to detect if someone voted my bot? and how to get the token?

To get vote

const express = require('express')
const Topgg = require('@top-gg/sdk')

const app = express() // Your express app

const webhook = new Topgg.Webhook('topggauth123') // add your Top.gg webhook authorization (not bot token)

app.post('/dblwebhook', webhook.listener(vote => {
  // vote is your vote object
  console.log(vote.user) // 221221226561929217
})) // attach the middleware

app.listen(3000)
smoky marten
#

deprecated I guess

smoky marten
#

np

restive otter
#

i want to make a voter only command which is accessible to voters only but i am new to these all so can anyone help me?? in discord.py library

lament widget
#

l

restive otter
#

how do you get your server stats to work on the bot to go to top.gg

feral nest
#

Кикните мегя

#

КИНИТЕ

restive otter
old kernel
restive otter
#

what is it

#

@old kernel

old kernel
#

#discord #discord.js #realcoder
Hey am official member of realbot

Source Code - https://github.com/RealPukhraj/Stats-Count-For-topgg
Github - https://github.com/RealPukhraj

If you need any help join
Discord Server - https://discord.gg/k9zFcucTKp
Thank You
Regarding Real e-Sports
Always We are waiting for your joining.

Social Links :
✔ We...

▶ Play video
#

you see here

#

its a tutorial

restive otter
#

ok

lean pond
#

hi

#

Im making a voting system

#

    def __init__(self, bot):
        self.bot = bot
        self.token = 'token'
        self.dblpy = dbl.DBLClient(stuff here)```
can someone explain these things to me>?
wind flame
#

Please help

smoky marten
wind flame
lean pond
#

please explain py webhook_path='', webhook_auth='', webhook_port=5000)`````` to me!!

smoky marten
wind flame
#

ohk

keen sleet
#

I'm not the only one intermittently receiving a 502 BAD GATEWAY from top.gg am I?

long storm
#

Nope

#

Site went down a few minutes ago

keen sleet
#

Ah, okay. Gotcha! For some reason, it crashes one of my shards each time that happens. I guess I need to implement some proper error handling for that. Odd

long storm
#

Yeah 😅

keen sleet
#

I appreciate that, Gugu!

long storm
#

Np!

late oracle
#

I am unable to import the topggpy documentation into my script

late oracle
#

Have you tried putting where "WebhookAuthCode'" is? replace by putting the token in place

#

In pytnon is about to put a "password" I also didn't understand very well hahaha

neat sierra
#

how u going to use Embed in the route? you have not defined discord functions

wind flame
#

@neat sierra that wasn't the prblm nvm it's fixed

restive otter
#

do i need the authorization token for getting server_count with php ?

rain heart
#

yes

edgy willow
#

Why do the webhooks need to be acknowledged? Just curious

pastel musk
#

Is there a way to get your bots server count on the top.gg page, instead of having it just stay [N/A]?

#

I saw someone above post something in js but is there maybe a python way or only js?

restive otter
#

How make a vote event listener ? I don't understand what we need to put in this line :

const webhook = new Topgg.Webhook("your webhook auth")```
#

What is webhook auth ?

#

:(

pastel musk
#

On your bots top.gg page there should be a page like this

#

And then here

restive otter
#

We put https://top.gg/bot/:your-bot-id/webhooks in the webhook URL and the webhook auth is the Authorization or the webhook URL ?

pastel musk
#

Auth. Is the shortened word for authorization so I would say authorization

late walrus
#

Hello

#

How should i make a voting cmd

whole python
sullen nymph
#

On command send request to API, store returned value in cache, work with that value

#

Or use webhooks and a database

whole python
sullen nymph
#

Sounds like an issue with your code

#

Unless you're talking about the delay between voting and actually being able to get it from the API

whole python
sullen nymph
#

So you're using webhooks?

whole python
#

it's this part of the webhook I didn't know if it's mandatory so I put it

#

I'm using this code

#
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});
restive otter
#

use @top-gg/sdk

fading phoenix
#

what should i do at authorization??

fading phoenix
#

anyone...?

hidden sedge
#

how to use the top.gg api to vote
i recreated the request in python
but i get {"error":"Invalid vote"}
instead of already voted

#

the endpoint isn't documented pandasad

#

this is the end point i am hitting

restive otter
#
import re 

def addUpvoteRecord(userid) :

@bot.event
async def on_message(message) :
    
    if message.channel.id == XXXXXXXXXXXXXXXX : 
        data = message.content.split(" ") 
        user = re.sub("\D", "", data[0]) 
        addUpvoteRecord(user) 
        
    
    await bot.process_commands(message) 

This is the code
i want to make a command restricted to voters only how can i do it can anyone please help??

hidden sedge
#

the payload is really conusing

#

bunch random noisy characters

unique ruin
lean pond
#

can someone fricking explain how to use self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='', webhook_auth='', webhook_port=5000) pls

restive otter
#

dblpy is deprecated by the way, you'd better migrate to topggpy

earnest roost
#

anyone got a tutorial on how to make that webhook thing

#

so it emits an event when someone votes

#

please

whole python
#

how do i get the ip server

hearty vortex
earnest roost
smoky marten
#

after following the tutorial try this code

const express = require('express')
const Topgg = require('@top-gg/sdk')

const app = express() // Your express app

const webhook = new Topgg.Webhook('topggauth123') // add your Top.gg webhook authorization (not bot token)

app.post('/dblwebhook', webhook.listener(vote => {
  // vote is your vote object
  console.log(vote.user) // 221221226561929217
})) // attach the middleware

app.listen(3000)
earnest roost
#

hmmm ok
thanks 😄

stable helm
#

Can anyone help me personally to do this? I will pay for that.

smoky marten
stable helm
stable helm
stable helm
#

@smoky marten, @meager mural bro I have done everything but still not showing in the website. Does it take time?

meager mural
#

If im not mistaken, information will appear on the website after 30 minutes.

restive otter
#
def addUpvoteRecord(userid):
  with open("vote.json") as f:
      vote_list = json.load(f)

  if not userid in vote_list:
      vote_list[userid] = []

  with open("vote.json", "w+") as f:
      json.dump(vote_list, f)

@client.event
async def on_message(message) :

    if message.channel.id == 870147153706750022 :
        data = message.content.split(" ")
        user = re.sub("\D", "", data[5])
        addUpvoteRecord(user)
    
    await client.process_commands(message) 

i am getting this error TypeError: list indices must be integers or slices, not str

can anyone help me??

stable helm
#

Anyone know how many time it takes to show the info like the image after editing bot's code.

restive otter
umbral scaffold
#

can someone help me with the bot event on_dbl_vote

#

like when i vote the bot

#

it doesn't show the data

#
@bot.event
async def on_dbl_vote(data):
    print(data)
rain heart
#

can you possibly post your code

umbral scaffold
stable helm
umbral scaffold
rain heart
#

the part of you posting to the api

#

no sppoonfeeding please

restive otter
#

sorry

rain heart
#

that's spoonfeeding, not helping

stable helm
# rain heart the part of you posting to the api

//const client = Discord.Client() // Your discord.js client or any other
const { AutoPoster } = require('topgg-autoposter')

AutoPoster('topgg-token', client)
.on('posted', () => {
console.log('Posted stats to Top.gg!')
})

umbral scaffold
stable helm
#

@rain heart i had to make the 1st line as comment bcz it was giving error saying that client has already been added.

rain heart
#

well no wonder it wont work

stable helm
#

Why?

rain heart
#

do you get the log line of "Posted stats to top.gg"?

#

remember it posts every 30 minutes

stable helm
#

But before putting the code i have installed all the modules from npm i @top-gg/sdk

stable helm
rain heart
#

Have you waited for 30 minutes?

#

because that particular bot has not posted shards yet

#

it should respond with the Server count if it has been posted

stable helm
rain heart
#

then your code is faulty, wait for someone who can help

stable helm
#

It’s been 1 hour.

rain heart
#

you have to post your count to the api, yes

umbral scaffold
#

can someone send the example output of data ?

#

that is passed in on_dbl_vote

rain heart
#

check the docs

stable helm
#

@restive otter can u give the code that you gave earlier.

umbral scaffold
rain heart
#

if the docs say that, yes

restive otter
umbral scaffold
#

test endpoint for upvote where

restive otter
#

It's the same endpoint

umbral scaffold
restive otter
#

By clicking the test button

#

What have you tried?

umbral scaffold
#

then i refactored the code

#

and when now i vote

#

the 12 hour limit

sonic anchor
#

How do i post my server count on Top.gg?

umbral scaffold
rain heart
#

There's a button for that

umbral scaffold
rain heart
#

Yes

#

Oh if you're not using webhooks, you can't really test it

umbral scaffold
#

ohuuu