#topgg-api

1 messages · Page 16 of 1

placid mesa
#

Can we attract voters with top.gg api?

#

example

#

Username - <VOTE NUMBER> Vote

unique cedar
#

But you can fetch votes from API with a webhook

placid mesa
restive otter
#

nop

spring lake
unique cedar
lofty geyser
#

I made this website for my bot, and i want to add various stats from my top.gg page on it using topggpy and my auth key. How would i be able to do such a thing?

#

I would like to have it like a small copy of my topgg page (votes, reviews, etc as well), but with a link to the official page if possible.

restive otter
#

not possible to get the reviews, the votes you can get without needing to use topggpy - just make an HTTP request

lofty geyser
restive otter
#
import requests

r = requests.get(
    "https://top.gg/api/bots/bot_id",
    headers={
        "Authorization": "topggtokenhere",
    },
)
print(r.json())
vapid torrent
#

Is it possible to access the topgg API without the bot being registered on top.gg

restive otter
#

no

vapid torrent
#

And I'm assuming if I were to use one of my other bots API it wouldn't work on the code so great

mortal raptor
#

"server_count" and "shards" isnt the same?

icy aurora
dapper copper
astral osprey
#

here i have something important to tell you

tidal idol
astral osprey
#

who is the mod ?

#

i can report him

#

@tidal idol

marsh harbor
#
export interface VoteUser1 {
    user: string
    type: 'upvote' | 'test'
    query: string
    isWeekend: boolean
    bot: string
}

export interface VoteUser2 {
    admin: boolean
    avatar: string
    username: string
    id: string
}

export interface VoteUser {
    user_id: string
    type: 'vote' | 'test'
    source: 'topgg' | 'discordbotlist'
}

VoteUser.ts ^

#
import { VoteUser } from './VoteUser';
import { getCollection } from '../mongo';
import { addEvent } from '../functions';

module.exports = async (data: VoteUser) => {
    getCollection("votes").updateOne({id: data.user_id}, {"$push": {votes: {at: Date.now(), source: data.source}}}, {upsert: true});
    addEvent({
        type: "vote",
        command: "vote",
        source: data.source
    });
}
#

vote.ts

#

can anyone help

#

it isnt adding votes to the database

runic creek
#

It's more about your code than the top.gg api

#

If there is nothing in your database, .updateOne() will not work. You would first have to check whether a document with such an id field exists and if not, you would have to create it

dapper copper
#

You can also do ```js
import { VoteUser } from './VoteUser';
import { getCollection } from '../mongo';
import { addEvent } from '../functions';

module.exports = async (data: VoteUser) => {
await getCollection("votes").findOneAndUopdate({
id: data.user_id
},
{ "$set": {
votes: {
at: Date.now(),
source: data.source
}
}
},
{
upsert: true,
new: true
}
);
addEvent({
type: "vote",
command: "vote",
source: data.source
});
}

jaunty plank
#

Hey @rose sierra
just saw your deleted post(smelly automod)

That query param is generated by cloudflare and can be ignored.

marsh harbor
#

oh typo

#
import { VoteUser } from './VoteUser';
import { getCollection } from '../mongo';
import { addEvent } from '../functions';

module.exports = async (data: VoteUser) => {
    await getCollection("votes").findOneAndUpdate(
        { id: data.user_id },
        { 
            "$push": { 
                votes: { at: Date.now(), source: data.source }
            }
        },
        {
            upsert: true
        }
    );

    addEvent({
        type: "vote",
        command: "vote",
        source: data.source
    });
}
#

should this work?

dapper copper
#

Should do

marsh harbor
dapper copper
#

You’re not doing how I did it

#

It’s $set in mongo iirc

marsh harbor
#

Oh

#

Not home for another 3 hours I’ll fix it in a sec 😂

#

Or 3 hours…

marsh harbor
marsh harbor
# dapper copper It’s $set in mongo iirc
import { VoteUser } from './VoteUser';
import { getCollection } from '../mongo';
import { addEvent } from '../functions';

module.exports = async (data: VoteUser) => {
    await getCollection("votes").findOneAndUpdate({
                    id: data.user_id
                  }, 
                  { "$set": {
                     votes: {
                        at: Date.now(), 
                        source: data.source
                     }
                  }
              }, 
              {
                  upsert: true, 
                  new: true
              }
    );
    addEvent({
        type: "vote",
        command: "vote",
        source: data.source
    });
}```
#

this didnt work

fast elm
#

Hello, I just set up the configuration of webhook, the test button is working fine, it sent the test request successfully, but when someone votes it doesn't send anything at all

fast elm
#
router.post("/webhook", authUpvote(), async (c) => {
  try {
    const body = await c.req.json();
    const parseData = voteWebhookSchema.parse(body);
    if (parseData.type == "test") {
      info("Upvote test recived");
      return c.json({ success: true }, 200);
    }
    return c.json({ success: true }, 200);
  } catch (err) {
    error(err);
    return c.json({ success: false, error: 500, message: "Internal Server Error" }, 500);
  }
});```
jaunty plank
dapper copper
#

they dont see any other POST requests coming in other than for test votes

latent trench
#

"504 Gateaway Timeout" what tf is that

restive otter
#

server not responding, means you gotta try again later

chilly condor
#

After I added this, I can't edit the site anymore

#

I tried removed the team still no luck

icy aurora
#

yo

cursive sierra
#

Yo

abstract monolith
#

Hello, I have a question. How can I have a reward for voting like the rest of the bots?

winter raft
#

I included a query in the vote link but query was null in the request to my webhoook

rose sierra
#

can you add other custom params to the voting url?

#

(an be returned back those params on the webhook on vote)

jaunty plank
raven plume
#

Sometimes my post to the api for server count doesn't post and it drops down to 123 servers which i've heards is the default value or something, anyone know why?

    dbl = DBLClient(client, (the token was here), autopost=True, post_shard_count=True, autopost_interval=1800)
    await dbl.post_guild_count()
celest slate
#

can anyone help me on this?

btw, there is no real id in there. i just screenshot it because it got blocked.

dry maple
#

probably tripped it as a phone number

vernal badger
#

Will the top.gg API support sending update requests for user counts?
My bot is primarily user installed and is installed by quite a few more users than it is on servers and not being able to send user count means it only paints part of the picture of how much use it has

restive otter
#

Good idea tbh, might want to make a post at https://feedback.top.gg

vernal badger
#

Although it would only be possible to update once every 12 hours because that's the delay between the approximate user count being updated

vernal badger
rose sierra
#

A custom redirect once user votes for the bot is possible?

#

or any sort of message displayed for next step info

restive otter
#

nop

rose sierra
restive otter
#

It was about the normal behavior which was a redirect on top.gg after a vote, not people able to redirect to external websites. It redirected to the wrong space (back when DAOs were existing)

jaunty plank
jaunty plank
willow nexus
#

Can we use python in the bot page ?

jaunty plank
willow nexus
#

Oh we can't ok

willow nexus
#

I heard that one could make websites using python

jaunty plank
#

Make backend for websites sure.

#

There might even be compilers for frontend to JS, but at that point just use JS 😄

willow nexus
#

Oh 😆

vernal badger
#
vestal bobcat
#

how can i make vote tracker reward system in py can anyone help?

tight sable
winter raft
jaunty plank
#

I dont think its broken, I can check in a bit.

winter raft
#

thank you

jaunty plank
#

query seems to be working for me, what query are you using?

covert brook
#

Hello good Day.

how can I go by adding the voting button on my page and how can I make each person gain reward from voting?

untold sparrow
#

what library / language are you using?

covert brook
untold sparrow
# covert brook It's in Javascript w/ Node.

this guide should help you out blob_nod https://www.youtube.com/watch?v=wqlU2KOxQws

Quick showcase on how the top.gg API can be easily used with the help of the top.gg javascript SDK to give users a reward for voting for your bot as well as how you can easily implement the autoposter library to keep your bot stats up to date on the website.

Credits

Produced...

▶ Play video
visual elm
#

i cant put imgur even its png

#

oh nvm, i'm ask in wrong channel hehe

vale cipher
icy aurora
#

5xx means Server is down

tidal idol
icy aurora
#

nah 5xx you broke the server bun

vale cipher
#

Alr

dry maple
#

Server can still be up and return 5xx errors

old jasper
#

Yes sir i am here

jaunty plank
#

@old jasper Can you show the code you're using to post your bots stats via the API?

old jasper
#

@jaunty plank

jaunty plank
#

Thats not posting stats, thats just html.

#

What programming language does your bot use?

old jasper
jaunty plank
#

This is our library for posting your bots stats to top.gg

orchid forum
#

thats htis thing, isnt it?

jaunty plank
#

If you want your server and shard count to show up.

It can help, but it doesn't mean it will.

#

Yeah that's a server count

orchid forum
jaunty plank
#

I don't think we have any search params for server count.

Its mostly for users who want to see your server count before inviting.

When I added it to my old bot I got more servers quickly.

#

Vote rewards and vote reminders are more important.

orchid forum
orchid forum
orchid forum
jaunty plank
#

Yeah, Friday sat sun UTC is double votes

#

Votes and good seo on your bot page is the most important

#

Reminders for voting in your bot helps a ton.

orchid forum
jaunty plank
#

If you plan to DM regularly you'll want an opt in system.

If you want to do reminders 12 hours after voting you can do an opt out system.

orchid forum
jaunty plank
#

We have guidelines for vote reminders

orchid forum
jaunty plank
#

Guideline 15

orchid forum
#

Thanks ! 🙏

jaunty plank
#

If you're sending mass DMS periodically discord can disable your bot. So you'll want opt in.

Unsubscribe in our guidelines is an opt out system.
It can be every 24 hours, 48, 64, whatever. We just don't like people being spammed reminders. 99% of bots use a 12 hour reminder system.

#

12 hours after voting*

#

One you can look at is pixxiebot.
Invite it to a server and vote for it. After 12 hours you'll get a reminder.

orchid forum
wicked zephyr
#

i have a theory

surreal pilot
#

the internet is dead

scarlet cobalt
icy aurora
#

You fucking weeb

#

oh shit weong channel

scarlet cobalt
#

One message removed from a suspended account.

icy aurora
#

It says you fucking weeb

scarlet cobalt
#

One message removed from a suspended account.

icy aurora
icy aurora
scarlet cobalt
#

One message removed from a suspended account.

icy aurora
#

jk

visual elm
prime edge
still shore
#

can anyone send that vote logging creating website, which was user friendly and it was lot easier to create voting logs, i can't remember it's url

still shore
#

hm

jaunty plank
cursive sierra
#

is there any test methode ?

orchid forum
icy aurora
cursive sierra
icy aurora
#

your welcome

orchid forum
# cursive sierra Thanks ❤️

uw ❤️
could also be useful to debug on your server... 127.0.0.1 (if you want ports being opened to the public) and localhost (if posts closed up and it gets thrugh another port (80 or 443) thus you want to test the internal routing)

orchid forum
icy aurora
orchid forum
icy aurora
orchid forum
raven plume
#

Whenever I don't post my server count it appears as 123, why?

restive otter
#

Because you didn't post it, and that's the old value that has been posted

raven plume
#

My bot is at 1.4k

#

sometimes it posts the real number

#

and then when the bot is offline or smth it magically goes to 123

#

like every time

#

for weeks

#

123

runic creek
#

top.gg only accepts what you send it, so I would look for a problem in how you send the number of servers to the top.gg api

#

The most popular reason that I have noticed is that people have their own test version of the bot, which also has a script for sending the number of servers to top.gg api, and they overwrite the information that was previously sent by their main bot

raven plume
#

no

icy aurora
raven plume
#

that is nt whats happening

#

this is literally all I have it to do

dbl = DBLClient(client, thetokenishere, autopost=True)

#

you can see it posts like the actual count then for some reason it goes to 123

#

I am not posting a different bot, it is the same bot, and my code is only the DBLclient.

scarlet cobalt
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

raven plume
#

client = commands.Bot(command_prefix=".", intents=intents, activity=custom_activity)

#

🤷‍♀️

jaunty plank
#

All the library does is check what your bot is reporting as the server count, not using the discord API directly.
The number is gets is from the bot session itself, which is why it asks for client.

#

That's also why they asked if you have a testing bot/other bot that you put this code into, as you'd post that bots stats from time to time.

dbl = DBLClient(client, thetokenishere, autopost=True) 
jaunty plank
#

question?

icy aurora
raven plume
jaunty plank
raven plume
#

does this work woo?

@client.event
async def on_autopost_success():
print("Successfully posted server count to top.gg!")

@client.event
async def on_autopost_error(error):
print(f"Failed to post to top.gg: {error}")

jaunty plank
raven plume
#

the on_autopost_success has no paramaters so a bit confused, would be nice if had a paramatere for what it posted tho surely thats doable

jaunty plank
icy aurora
raven plume
#

using the client object that i pass in the dbl object

raven plume
#

unrealated: Any idea with the review system on top.gg will be fixed?

rocky oriole
#

Hello guys !

#
const webhook = new Topgg.Webhook(process.env.TOPGG_WEBHOOK);

// Define the webhook listener
app.post('/dblwebhook', webhook.listener(async vote => {
    console.log('Vote received from user:', vote.user); // Logs the user who voted
    await client.utils.getReward(client, vote);
}));

const port = process.env.PORT || 3000;
app.listen(port, () => {
    client.logger.start(`Webhook listener running on port ${port}`);
});
#

anyone can help me about this case

orchid forum
#

what do u want?

#

what?

#

whats that

#

who this?

#

I aint got no issues

silk idol
#

@jaunty plank

orchid forum
#

@tidal mulch @young cedar Whats that for an advertisement and spam?

#

@jaunty plank ngl... can u ban @tidal mulch and @young cedar ?
They deleted their messages but try hard to get devs to join some other servers which are strange... without even knowing what we be writting here.

#

sorry that i cant provide screenshot for u to look at

silk idol
#

With thr pic

orchid forum
silk idol
#

@jade pecan

#

Thabks for making my job eazyer

rocky oriole
silk idol
#

@young cedar is a scammer so dont join the server

dry maple
#

💀

rocky oriole
#

what's that

silk idol
silk idol
dry maple
rocky oriole
silk idol
#

At some point inv should be blocked

rocky oriole
#

can you help me about track the user have vote bot brother

#

don't ping me

#

i don't like you

silk idol
fiery crown
#

-purge 10

raven plume
orchid forum
raven plume
#

Additionally for it to be in 123 servers I would have had to verify it to with my ID, I only verified one bot my main one

#

Like I am 100% certain it has nothing to do with a test bot idk why people keep suggesting that

scarlet cobalt
#

One message removed from a suspended account.

jaunty plank
spring cliff
#

yo chat im new here how do i get top.gg auth token

spring cliff
#

okay thanks

icy aurora
#

your welcome

frozen flame
#

is there any documentation on how i can know when someone votes for my bot?

restive otter
frozen flame
runic creek
outer cliff
#

yo chat im new here how do i get top.gg auth token through api

icy aurora
scarlet cobalt
#

One message removed from a suspended account.

keen sleet
#

Is this intentional to drive people to use webhooks instead?

#

If I could get a timestamp on the vote, I could skip the webhook implementation altogether.

#

Although I don't know the details of the backend, it seems as though some sort of "fetch" from the database / cache is already happening. I'm making an assumption that the timestamp of the action may be at your disposal.

If it was implemented, the webhook wouldn't be necessary anymore if the UI of the bot had a "check" / "verify vote" / "claim" button.

jaunty plank
#

Tbh, the ratelimit is so low on the check anyway its really only meant to support webhooks.

keen sleet
#

Oh! Is there a rate limit on that?

jaunty plank
#

Yeah

keen sleet
#

Damn, I must have missed the documentation on that.

jaunty plank
keen sleet
jaunty plank
#

Webhooks are super simple anyway, they're more reliable too.

#

scale better

keen sleet
jaunty plank
#

strain? 👀

keen sleet
#

The implementer now has to handle spinning up an endpoint to receive webhook requests, handle downtime, scale it separately as a bot scales, etc.

#

It's not bad at all, just calling out that it pushes more of the work onto the consumer. Which is likely the only way TopGG can handle it for it ... considering the scale of votes they receive per second / minute

#

Plus, at the scale of my bot, it'll be trivial to run a webhook implementation that receives fewer than a hundred or two requests.

jaunty plank
#

Its event driven, for events. Theres a reason webhooks are standard practice for this kind of stuff.
Polling is just awful, at any scale.

keen sleet
#

Well, let me take that back: it would be a "poll". But TopGG opening something like that up to consumers would be subject to people polling.

#

That's a good point.

keen sleet
orchid forum
keen sleet
orchid forum
keen sleet
jaunty plank
#

I feel like it's rough for everyone the first time, no matter the platform.
Then if you do it once its easy everywhere.

orchid forum
orchid forum
# jaunty plank I feel like it's rough for everyone the first time, no matter the platform. Then...

I don't know if my way is the right one or if there is more easy ways... But I had to configure nginx to route properly to the application... Which wasn't that easy, as I got some weird imports I have left in there before and was edditing the wrong file.

Additionally when I tried to get an example on the top.gg api running... it was rather aweful... in the internet there were several ways of doing it and i did not really appreciate any... Now I am using the WebhookManager from top.gg and letit do the work. In my opinion the topgg api documentation is bad and could have some extensive example code. Or maybe I have been dumb and did not find it right away 🤷‍♀️

Additionally it's disencourging that we also got the other solution on hand to just ask if someone voted... I implemented this first... Now I am using both kinda. Just to make sure I havent missed any xd

jaunty plank
dull lagoon
#

Hello i hava a question im using discord hybrid sharding and now top gg displays me 145 servers but my bot has 430 servers when i remove sharding its working how can i fix that i need to use await client.cluster.broadcastEval('this.users.cache.size'); to get the total guilds?

#

topgg autoposer

restive otter
#

cross posting won't be more useful

icy aurora
icy aurora
dull lagoon
#

But im using discord hybrid sharding

icy aurora
#

or really clusters

dull lagoon
#

I just want to fix the error you have an ideas?

icy aurora
#

i dont use discord hybrid sharding, i use discord.js Sharding Manager

dull lagoon
#

oh okay

dull lagoon
#

I fixed it

#

That helped

hollow hatch
#

Hello, when trying to post stats to top.gg api but im getting the error You are not allowed to update this bot anyone know why?

jaunty plank
#

tokens are specific to their bot

hollow hatch
#

As well as double checked my bot ID.

jaunty plank
#

regen the token and try again

#

new bug I guess

hollow hatch
jaunty plank
#

refresh the page just after

hollow hatch
hollow hatch
signal granite
tidal idol
#

wdym

signal granite
tidal idol
#

:bot_id is just an example, you replace :bot_id with your bots ID

#

it doesn't matter if you use :bot_id or {bot.user.id} as an example, it works if you replace the ID

signal granite
#

Ahh I see cheers smile

hollow hatch
#

So I set my bot to post server stats to topgg every hour, yet the number has only updated once in 2 days. What am I doing wrong?

sharp cape
#

is this the place for feature requests?

jaunty plank
rose sierra
#

is voting webhook bugged today?

icy aurora
#

no

icy aurora
rose sierra
#

sending sample webhook works, im not getting it back when an actual user votes, and he was able to vote multiple times (Im assuming his vote was not registering)

jaunty plank
quick adder
untold sparrow
dapper copper
quick adder
# icy aurora https://docs.top.gg

yeah I've been using the topgg library, tried with both a source installation and a pip installation and there's just countless errors like "topgg module has no endpoint", "topgg module has no data"

#

it doesnt seem like the module downloads everything

normal steeple
#

why when i get user info return 404?

icy aurora
normal steeple
#

ooh ok

tidal idol
#

what?

#

404 means not found

#

403 means not allowed

tidal idol
#

if it returns json { "error": "Not found" }
that means the user is not on Top.gg

icy aurora
#

oh

#

i had it other way around

normal steeple
#

and i've tried using someone else's id but still got nothing

tidal idol
#

check if its returning HTML - if so, you've messed up the API url somewhere

normal steeple
restive otter
normal steeple
restive otter
#

Sometimes the same as Discord but not always

silk idol
rigid sable
#

Are there any fine tutorials for covering Python API?

#

Since I don't understand what is a topgg.DBLClient

restive otter
#

Also the GitHub repo has examples iirc

rigid sable
#

Well, I figured it out

#

I used ChatGPT but who cares?

restive otter
#

The people that collect and reuse your data mmLol

hot gyro
#

hi

worldly palm
#

can someone ping me with python setup code snippet for stats

fleet marsh
#

How to post server count with api?

cursive sierra
outer stream
#

Where can i find a api key or api from top.gg?

restive otter
restive otter
fickle mica
#

How can i get a API Key?

silk idol
fickle mica
#

Oh ok 👍

scarlet snow
#

im trying to add voter rewards to my bot, how do i find my webhook url?

#

or do i just need the api key

#

i try to import it (py) and it says theres no module named topgg or topggpy, its definetely been installed. Am i using the right name for th 1.14 version? i find it weird why you would name the module and import different things

scarlet snow
#

Any help guys weirdsip

Im not stupid so it wont be a pain to explain, ive just never worked with APIs before. Data science bachelor (i prolly should learn it proper either way for web scraping)

jaunty plank
#

The api has pretty restrictive ratelimits, webhooks are the way to go

scarlet snow
#

Holy working with webhooks is a pain

#

Spent 30 minutes trying to figure out how to correctly implement with my spaghetti code

#

And now im not getting the POST, and when i try to check my router to open my port it doesnt connect to the admin panel….

robust root
#

these lines exist in the community topggpy examples:

def stats(client: discord.Client = topgg.data(discord.Client)):
    return topgg.StatsWrapper(guild_count=len(client.guilds))```
#

however:

Traceback (most recent call last):
  File "/home/container/######.py", line 3, in <module>
    from callbacks import autopost, webhook
  File "/home/container/callbacks/autopost.py", line 10, in <module>
    def stats(bot: commands.Bot = topgg.data(commands.Bot)):
                                  ^^^^^^^^^^
AttributeError: module 'topgg' has no attribute 'data'```
#

what did i do wrong here

#

im using the example file itself and it isnt working

scarlet snow
#

you get data from a POST not from the module istelf.

#

-# everything i know i learned the past 48 hrs so take it with a grain of salt

#
        try:
            # Parse incoming vote data
            data = await request.json()
            print(f"Webhook triggered! Received data: {data}")

            # Extract user ID (the voter)
            user_id = data.get("user")

            # Trigger func
            if user_id:
                print(f"User {user_id} just voted on Top.gg!")

                await vote_rewards(user_id, bot)
            else:
                print("No user ID found in the webhook payload.")

            # Send a success response back to Top.gg
            return web.Response(status=200, text="Vote processed successfully.")

        except Exception as e:
            print(f"Error in on_vote handler: {e}")
            return web.Response(status=500, text="Failed to process vote.")```
scarlet snow
#

what are you trying to do? I am in no way well versed API's but ive wrapped my head around using TopGG's

I could help you if you told me your end goal @robust root

robust root
#

i find the tutorials/docs either hard to understand or just not work

scarlet snow
scarlet snow
#

this is all the code you need

#

make sense?

robust root
robust root
#

wait do i need a decorator or does this run by itself

#

i mean do i need to trigger it somewhere

scarlet snow
#

yeah call topgg_setup in your main

robust root
#

alright

scarlet snow
#

the on_vote() is attached to the "/dblwebhook" path

so whenever you get a POST with the path "/dblwebhook" its gonna trigger on_vote

#

webhook_manager.webserver.router.add_post(path="/dblwebhook", handler=on_vote)

#

oh actually this is the wrong code, you have to respond with a 200 to the POST immediately or its gonna error out.

So remember to respond first

#
        try:
            # Parse incoming vote data
            data = await request.json()
            print(f"Webhook triggered! Received data: {data}")

            # Extract user ID (the voter)
            user_id = data.get("user")

            #
            

            response = web.Response(status=200, text="Vote processed successfully.")

            if user_id:
                print(f"User {user_id} just voted on Top.gg!")

                asyncio.create_task(vote_rewards(user_id, bot))  # This runs in the background
            else:
                print("No user ID found in the webhook payload.")

            return response

        except Exception as e:
            print(f"Error in on_vote handler: {e}")
            return web.Response(status=500, text="Failed to process vote.")```
#

this is the correct code for the vote handler

#

am i making sense 😆 im horrible at explenations

robust root
scarlet snow
robust root
#

either i called the function wrong or the port is not open

#

im using a hosting service, not my own hardware so things are complicated

#

am i stupid or something

scarlet snow
#

so

#

topgg_setup(bot)

#

if you have access to a terminal you should also check if your script is actually listening to your port

robust root
robust root
#

i dont think i have access to the terminal

scarlet snow
#

hmm

#

send me ur setup script

#

ill review it

robust root
# scarlet snow send me ur setup script
async def topgg_setup(bot):
    topgg_token = "nuh uh"
    topgg_client = topgg.DBLClient(bot, topgg_token, autopost = True)

    webhook_manager = topgg.WebhookManager(bot)
    webhook_manager.run(port = 1039)

    async def on_vote(request):
        try:
            data = await request.json()
            print(f"Webhook received data: {data}")
            id = data.get("user")
            response = web.Response(status=200, text="Vote processed successfully.")
            if id and id in bot.data:
                reward = randint(50000, 100000)
                if bot.weekend:
                    reward = int(reward * 1.5)
                bot.data[id]["cash"] += reward
                embed = discord.Embed(...)
                dm = await bot.fetch_user(id)
                try:
                    await dm.send(embed = embed)
                except Exception:
                    pass
            return response
        except Exception:
            return web.Response(status=500, text="Failed to process vote.")
    webhook_manager.webserver.router.add_post(path = "/dblwebhook", handler = on_vote)
    return webhook_manager```
scarlet snow
#

cause if the script actually received a POST it would tell you

#

where do you host?

robust root
#

but im afraid the port is not opened or something

scarlet snow
#

most server hosters will give you a ip and port thats open

robust root
#

its an address and i used ping (cmd) to get the ip

scarlet snow
#

so you have

#

access to the terminal??

robust root
#

the console only

#

cant run commands on it

scarlet snow
#

oh ok

#

plug the port and ip into this

#

will tell u if the port is open

robust root
scarlet snow
#

hmm

#

and what link do you have on topgg?

#

and do you have the same webhook auth on script and topgg?

robust root
robust root
scarlet snow
robust root
#

its right here but my dumb brain cant process it

scarlet snow
#

oh

#

uh

#

so usually

#

when you initiate webhookmanager on topgg

#

you add the dbl webhook

#

thats what they tell you to do anyways

#

webhook_manager = topgg.WebhookManager(bot).dbl_webhook(route = "/dblwebhook, auth_key = WEBHOOKAUTH)

#

right? this is how you would do it, BUT the way it worked for me was to add the webhook later

#

usinbg

#

webhook_manager.webserver.router.add_post(path = "/dblwebhook", handler = on_vote)

#

which doesnt ask for an auth key

#

afaik

#

and i gotta be honest ive got no idea why it works i just know it does

#

but it shouldnt actually matter, as you see "All requests are allowed if this is not set."

robust root
scarlet snow
#

So the only remaining solutions are:

  • Your script is not listening to your port, which you cannot check because you cant run commands on the terminal.
#

oh

robust root
#

ill try to remove the auth

scarlet snow
#

yeah remove the manager.dblwebhook

robust root
#

key

scarlet snow
#

only have the router.addpost line

robust root
#

no one will ever find out the ip and port of the webhook anyway so whats the point for an auth right

scarlet snow
#

the .dbl_webhook function is the same as adding a post on router, and you cant add 2 post checks with the same path/rout if you understand.

robust root
#

does this button do anything

scarlet snow
scarlet snow
#

havent you been sending tests 😆

#

if you click that it will send a test POST

robust root
scarlet snow
#

oh ok

#

yeah it sends a fake vote with your @

#

are you sure u cant tell me ur server provider? it wont let me hack you 😆

robust root
#

nothing poppin up in console

scarlet snow
#

your other solution is NGROK

robust root
#

RIP topgg

scarlet snow
robust root
scarlet snow
#

😭

#

ngrok is free to use

#

so i recomend trying to run the bot on your pc

#

and then test it out with ngrok

#

and if it works

#

thats great

#

idk

#

your code should work, if youre not getting errors. So the problem is that its not getting the POST, which means either :

  • your port is not open
  • your link to your server ip and port is wrong
  • or your script is listening to the wrong port.

test all these out first and see if any of those solve it.

robust root
#

the IP is obtained when i ping the host's address

#

port is the same in the script/link/host

#

and ofc its open as I checked it

jaunty plank
#

It's just a good security practice

robust root
jaunty plank
#

Does your host have limited ports?

robust root
jaunty plank
#

Some hosts use shared ips, especially budget hosts.

#

So they can have limited ports

robust root
jaunty plank
#

One way we sometimes handle these situations is just visiting the url in your browser.

It should give an error in your browser about not having a GET method.

#

If it gives that kind of error it means the request should be reaching your server.

If it gives an unreachable error it means the request is blocked somewhere

robust root
jaunty plank
#

Dedicated as in you only have one port?

#

Then their panel should tell you which port you need to use.

robust root
#

wont work

#

hit "send test" and nothing showed up

jaunty plank
#

Yeah, seems a firewall is likely blocking it.

#

You're using linux for your server?

robust root
jaunty plank
#

Id check your firewall settings, see if thats blocking requests.

robust root
#

welp i may be out of choices here

jaunty plank
#

Interesting, not on a vps?

robust root
#

no idea about this

#

i have no info about the host or anything related to it

jaunty plank
#

I hate suggesting my own services, but look into my website.
https://webhook-topgg.com/

It just forwards the request to a discord webhook.

If you want the event in your bot, you can read the message my service sends out and handle it any way you want. Its not recommended but a lot of people do it.

Simplifying top.gg webhooks for all users, allowing non-developers and developers to use webhooks for their bot and server without confusing configuration.

robust root
jaunty plank
#

Sadly I dont know python and cant really help any more than linking to the docs

robust root
#

alright thanks for all these info ill try to make use of them later

#

its well over 11pm for me

#

ima head to bed

scarlet snow
jaunty plank
#

That's something you store on your side, I like using redis for that kind of stuff, but any database works. Or if you don't mind losing reminders when your bot restarts it can even be in memory

scarlet snow
jaunty plank
#

One of these days I'll be upgrading my site to websockets and include reminder events.

I just need to stop being lazy about it.

scarlet snow
#

lol yeah

#

the sleep function doesnt require much overhead and is incredibly easy to implement.

so i guess youve gotta decide between checking every single stored datetime every minute or just the sleep.

CPU vs RAM

#

in my case im prolly gonna do both, CPU and RAM.

my poor servers

jaunty plank
#

Just chuck it in a database ^-^ or redis

scarlet snow
#

yeah ive already got a cooldowns database for various other commands, its just a bother. Each time theres a new cooldown i alway think "but yeah this is the last one" and dont bother making a function for it and so i always gotta make it custom 😭

#

good coding practices are not allowed in my codebase

jaunty plank
#

database cooldowns?

robust root
#

Hey guys

#

I just woke up

#

So my host provider confirmed that there is nothing that could possibly block the requests

#

This is real messed up now cuz idk what is wrong: my code or the host

tidal idol
#

does the code work locally

#

(not on your host)

robust root
#

I cant port forward so cant really check it

tidal idol
#

you can

robust root
#

Yeah but i dont have access to my home router

tidal idol
#

run the code locally and visit localhost:<port> in your browser

robust root
#

Cuz it aint mine

tidal idol
#

you dont need access to test it locally

robust root
tidal idol
#

it means you can test if your code works

#

because if you can visit the URL in your browser locally, then its a host issue

robust root
#

Alright where do i get the port from

scarlet snow
# jaunty plank database cooldowns?

well no its not a database sorry, but ive got a system for storing cooldowns already is what i mean. I just dont have a system for handling cooldowns, so i gotta make a custom func each time.

scarlet snow
tidal idol
jaunty plank
robust root
scarlet snow
tidal idol
robust root
tidal idol
#

is this in javascript?

robust root
#

No its python

scarlet snow
tidal idol
#

lol

jaunty plank
#

;p

robust root
scarlet snow
scarlet snow
#

and i had the same problems he had

#

with the test sending and getting no response at all

robust root
#

In some on_ready() func?

scarlet snow
#

for me it was an issue with my port (shitty provider) so using NGROK fixed it for me locally, and it worked just fine on server

scarlet snow
scarlet snow
#

he couldnt check if anything was actually listening to the ports on his server because he doesnt have access to a terminal

jaunty plank
#

👀 no ssh access?

scarlet snow
#

but the port was open on the ip and he had the same ip in top.gg

#

so either the script didnt connect correctly or yes, something was blocking the POST after it reached the server

jaunty plank
#

This has to be the single worst host 👀

tidal idol
#

lol

scarlet snow
scarlet snow
#

so his only solution is to assume the script is listening and work from there

#

and thats why i suggested starting the test locally first, using ngrok as its very simple work around.

#

cus if it works locally with ngrok, we know the script isnt the problem.

robust root
#

Guess I'll have to use Woo's service for now

#

Cant really identify the problem

scarlet snow
#

test it with ngrok

#

its super easy

robust root
#

I have school right now 👀

scarlet snow
#

allows you to just send the POST to ngrok instead, and they will send it to the app running on your PC, and then that app will locally send it to the port you need.

scarlet snow
jaunty plank
#

Hopefully I'll finish websockets one of these days so we can avoid this problem

scarlet snow
scarlet snow
scarlet snow
#

question: can the topgg be laggy / overloaded at times? when i was testing it right now it sometimes wouldnt go through for 30 seconds, and sometimes it wouldnt go through but then i when i sent another they both came at the same time instantly.

Just asking cus i wanna know if this is a issue with my script, cus if so i gotta fix it 😆

robust root
#

@jaunty plank @scarlet snow the problem is solved

#

it was the host thats blocking requests

#

the host owner fixed it and now its working

jaunty plank
#

classic

robust root
#

🥳

#

thank you guys for helping me all this time

robust root
#

what

#
future: <Task finished name='Task-1889' coro=<WebhookManager._run() done, defined at /home/container/.local/lib/python3.12/site-packages/topgg/webhook.py:144> exception=OSError(98, "error while attempting to bind on address ('0.0.0.0', 1039): [errno 98] address already in use")>
Traceback (most recent call last):
  File "/home/container/.local/lib/python3.12/site-packages/topgg/webhook.py", line 150, in _run
    await self._webserver.start()
  File "/home/container/.local/lib/python3.12/site-packages/aiohttp/web_runner.py", line 121, in start
    self._server = await loop.create_server(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1577, in create_server
    raise OSError(err.errno, msg) from None
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 1039): [errno 98] address already in use```
#

this randomly appeared

limpid plover
#

I started getting these errors today while checking if the user voted. This didn’t happen before?

normal hedge
#

randomly started getting this error?

#

(posting stats to top.gg with AutoPoster)

robust root
#

oh yeah and 403 forbidden too

normal steeple
#

yeah i have the same problem

winter raft
# jaunty plank query seems to be working for me, what query are you using?

Bit late response but I was trying to implement the query again today and it's still not working for me. I even tried the exact same query as you. Any ideas?

https://top.gg/bot/942858850850205717/vote?wee=woo

{
  "bot": "942858850850205717",
  "user": "1324330109078999070",
  "type": "upvote",
  "isWeekend": false,
  "query?": null
}

Also interesting that in the json the query contains a question mark next to it. In your screenshot it's just called query not query?. I would personally only expect the question mark to be in the docs to indicate optional not in the actual code.

But that shouldn't make a difference for me since I am logging the entire json.

normal steeple
lyric smelt
sharp flame
scarlet snow
#

Topgg servers messing up then, if everyone suddenly had the same problem 😂

white pumice
#

I see, I thought I was the only one who got it😭

opal solar
vital anvil
#

hi sorry let me take a looksie

#

Can you try again? bbun_smile

old forge
vital anvil
night jungle
vital anvil
old forge
#

cc @normal hedge ^

vital anvil
#

or if it's a fetch thonk_art

night jungle
vital anvil
#

yeah I know, I am asking for some other information e.g. what your web request looks like

night jungle
# vital anvil yeah I know, I am asking for some other information e.g. what your web request l...
[2025-1-2 17:55:30] [INTERACTION_CREATE] Please check you are using the correct execute method: "async execute(interaction, client)": Error: Unable to connect to the Top.gg API.
    at verifyVote (D:\Coding MultiVerse\Discord Bots\Cloudy\3.3.0\cloudy\src\utils\topgg.js:50:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.execute (D:\Coding MultiVerse\Discord Bots\Cloudy\3.3.0\cloudy\src\commands\Music\play.js:37:30)
    at async Object.execute (D:\Coding MultiVerse\Discord Bots\Cloudy\3.3.0\cloudy\src\events\SlashCreateEvents\interactionCreate.js:78:13)
[1/2/2025] [5:55:30 PM] [Cloudy] » ✖  error     [ERROR] UNCAUGHT EXCEPTION: TypeError: Cannot read properties of undefined (reading 'send')
    at Object.execute (D:\Coding MultiVerse\Discord Bots\Cloudy\3.3.0\cloudy\src\events\SlashCreateEvents\interactionCreate.js:151:43)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[1/2/2025] [5:55:30 PM] [Cloudy] » ✖  error     [ERROR] UNCAUGHT EXCEPTION: TypeError: Cannot read properties of undefined (reading 'send')
    at Object.execute (D:\Coding MultiVerse\Discord Bots\Cloudy\3.3.0\cloudy\src\events\SlashCreateEvents\interactionCreate.js:151:43)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[1/2/2025] [5:55:30 PM] [Cloudy] » ✖  error     Uncaught Exception:```
normal hedge
vital anvil
#

noted

#

shoooould be fixed now

normal hedge
#

yes all fixed

vital anvil
#

lovely!

normal hedge
#

thank you

vital anvil
#

thanks for you help

normal hedge
#

no worries

night jungle
normal hedge
#

im pretty sure theres documentation on it but its just a package from topgg-autoposter

sharp flame
#

thanks bro ❤️

normal hedge
#

import it and then get your token from your bot page and use the AutoPoster function

jaunty plank
shell crest
#

I've been running the SDK for about a year with no problems, and now I get out of work and my users are complaining that the bot isn't really working. This seems to be the main issue at hand, especially because it NEVER STOPS FIRING

#

I haven't touched the bot for months, so I'm not sure where this comes from

jaunty plank
#

Regen your token and use the new token. See if that works.

shell crest
jaunty plank
#

Not that I'm aware of

shell crest
#

Alright, thanks 🙂 I'll try the token thing then 😄

jaunty plank
shell crest
#

Funny thing is, getVotes works just fine, but the IsWeekend doesn't 😄

vital anvil
#

ah, sorry. this seems to not be a documented endpoint thonk_art

shell crest
#

Doesn't matter, I replaced it with something a bit more simple.

new Date().getDay() % 6 == 0
vital anvil
#

done! :)

#

should be open again

#

ah that also works lol

#

🤔 doens't this only handle one day?

#

not two days

#

<@&412346069675147264> might be good to replace that with actual logic.

const weekendDays = [0, 5, 6];
const isWeekend = () => {
  const day = new Date().getUTCDay();
  return weekendDays.includes(day);
};

here's the logic to replicate the endpoint thumbsupsmiley UTC time ofcourse. I'll keep the endpoint but since it hasn't been documented in the docs for like... four years, Cpray

shell crest
vital anvil
shell crest
#

Ahh, right. Okay. I see xD I guess mine doesn't include that anymore 😄

sullen tusk
#

how do you use the webhooks on the website to grant a user a role when they vote for your bot?

signal harness
#

your server would listen for the webhook being sent through, inside there is metadata that includes the user information, you would then do a post request to Discords API to assign a role

scarlet snow
#

Does the API send 2 POST in the weekend?

tidal idol
#

no

#

your API is not responding to Top.gg fast enough so it's resending the request

#

always send the 200 response BEFORE doing anything like issuing rewards, DMing, or any DB inserts

scarlet snow
#

Hmm, this is the first time this happened. And i do send the 200 first.

#

Musta been a server glitch or something

#

Error

jaunty plank
#

If your server is far away, or it gets delayed at all it can cause this.

tidal idol
#

^

#

top.gg only send duplicate requests in the instance of not receiving a response within 3 seconds

jaunty plank
#

Mines in Finland and I'm just waiting for the right time to move it back to New York.

scarlet snow
jaunty plank
#

New York ^-^

tidal idol
#

Webhook requests that time out or return a 5XX status response (like 500) will be retried up to 10 times. The retry delay is increased exponentially per retry by 2^N seconds, from a minimum delay of 1 second for the first retry up to 17 minutes for the tenth.

jaunty plank
#

If you take some time you can track down the exact data center it's in ^-^

scarlet snow
#

Only one second before retry? Seems short, i guess the distance delay would explain it.

jaunty plank
#

You can also cache the request and respond to duplicates and ignore any more.

scarlet snow
#

Ill also check for any raised errors, maybe the script just didnt work for some weird reason although its really barebones and has fall backs so there shouldnt be any issues.

scarlet snow
jaunty plank
#

I've had it happen a ton.

I wish it followed the docs a bit more accurately.
A timeout should start at 5 seconds.

Responses to webhooks must be returned within 5 seconds, otherwise they are considered a timeout and will be queued for a retry (if available).

robust root
#

wait @scarlet snow when u define topgg_setup() whats the purpose of return webhook_manager (the final line)?

scarlet snow
#

Well

#

Then you have the webhook manager

#

If you need it for something

robust root
#

ehem alright

scarlet snow
scarlet snow
#

But did you get it to work?

robust root
scarlet snow
robust root
#

host problem

#

eh

scarlet snow
#

Yeah i remember

jaunty plank
#

One day I'll add a guide for js to the actual docs.

The guide I have is for another library that doesn't get much use ^-^

scarlet snow
robust root
#

any suggestions on data management cuz im using json atm

#

any baby-mode database i can use

jaunty plank
#

I prefer just starting with SQL.
Postgres is great.

But mongodb is easier

robust root
#

i get confused reading SQL docs for 5 minutes

jaunty plank
#

For most people this is the first time they've worked with webhooks, and it can be quite hard.

Once you do a webhook once it's easy, but that first time takes time without proper resources.

scarlet snow
# robust root any suggestions on data management cuz im using json atm

Personally ive settled on JSONs as a permanent solution, you can load it all into memory and have instant acess. Only issues is with bot crashing but just save often and it shouldt be a major issue weirdsip

Plus most bot libraries will never totally crash unless youre doing something really really wonky thanks to error handling

jaunty plank
#

Well, you can still run into issues with json as storage without crashing.

#

text based databases can corrupt themselves very easily unless you take a LOT of time to properly implement it.

#

You'll need write locks in place

#

(to do it properly)

robust root
scarlet snow
jaunty plank
#

Its easier to learn a real database tbh

scarlet snow
#

😂

robust root
#

lmao

jaunty plank
#

Thats why you need write locks 😄

#

So two shards dont write at the same time.

scarlet snow
#

Yeah

winter raft
#

Regarding the query issue, should I re-post that in #1314012335320596520 to prevent it being forgotten?

jaunty plank
scarlet snow
#

Are shards two different instances of the script? Or just two different connections within the same instance.

If its the latter then it shouldn’t be an issue with write locks no?

jaunty plank
robust root
winter raft
robust root
jaunty plank
scarlet snow
jaunty plank
#

Or I can join your server. DM the link 😄

robust root
scarlet snow
#

Whats the best database to use? I should get this migration done before doing anything else.

Will involve a total refactor of the script kekstressed

#

Is my guess

jaunty plank
#

I use postgres. mongodb is good too, but it can get frustrating as you scale up.

winter raft
robust root
jaunty plank
#

Okay, just let me know whenever you're ready

winter raft
#

will do

scarlet snow
jaunty plank
#

Yikes, imagine losing that due to corruption 👀

scarlet snow
jaunty plank
#

yeah a real db would help.

You might even go with redis

scarlet snow
#

Often enough.. i hope

robust root
jaunty plank
#

Nah, relations are easy.

#

Its really really fun making a database graph. So satisfying.

scarlet snow
robust root
jaunty plank
#

👀 what uses execute?

#

Also, you need to make a dedicated db file

robust root
winter raft
jaunty plank
#

ah

#

I'm not even logged in to top.gg 👀

winter raft
robust root
#

10k servers damn

jaunty plank
scarlet snow
jaunty plank
#

man :/ I'm sorry

robust root
scarlet snow
#

I dont know if im remembering it right

robust root
#

oh wait

#

soz

#

u explained the thing lol

scarlet snow
#

But dont repeat yourself, if youre doing something often just make it a function

jaunty plank
#

All your db queries should be functions

scarlet snow
#

^

jaunty plank
#

I'll swap to my work machine real quick

tidal idol
#

worked for me

robust root
tidal idol
#

i did ?query

#

or is it a specific bot issue gato

jaunty plank
#

It might be bot specific

scarlet snow
tidal idol
scarlet snow
#

So you could do

#

user.stats.wins

#

Or

#

user.inventory.money

#

To easily edit the data u want

robust root
#

im using pure dict values data[player]["cash"] and such

#

im thinking about the implementation of DBs

scarlet snow
#

Ive gotta do some learning weirdsip

robust root
#

WOOOOOOOO is a JS dude?

scarlet snow
#

Idk

jaunty plank
#

Ye

scarlet snow
#

But i think best database practices transcend your language

jaunty plank
#

^

scarlet snow
#

I only know PANDAS but its not a database just a database editor

#

What would you call pandas actually

robust root
#

idek what pandas is

scarlet snow
#

you use it mainly for datascience afaik

#

Well, thats the use of it i know. Probably way more

#

Its just a library for storing and manipulating that can easily be used to do machine learning and data representation

robust root
#

classic

jaunty plank
#

I like how the first option is use redis 😄

robust root
#

o hell nah how do i make databases process dicts

scarlet snow
robust root
scarlet snow
robust root
#

with the current rate i dont think so

jaunty plank
#

Databases can get complex quick. But once you get it down its easy ^-^

I have a database file with all my functions, it just uses a single client.

robust root
#

my bot is relatively new

scarlet snow
robust root
jaunty plank
#

Itll grow, just takes time.

robust root
#

im having exams atm after that i plan to reskin my bot

#

it currently looks like it was made by a toddler

#

gotta rewrite some functions

#

bot was going well around 4 months ago when i have to shut it down

#

now i basically have to restart from the beginning

#

gaining popularity and such

scarlet snow
#

oof

#

why did u shut it down?

robust root
scarlet snow
jaunty plank
#

Everyone views their own code as buggy and messy ^-^

scarlet snow
#

haha yeah

robust root
scarlet snow
#

mine is so spaghetti, sometimes i go back to update code i havent touched in 2 weeks and literally go "wtf"

robust root
#

i use cogs now which sorts things out a bit

jaunty plank
#

Ah, well thats just a refactor.

robust root
#

had it sometimes too

jaunty plank
#

Does py have a JSDoc alternative?

scarlet snow
scarlet snow
robust root
jaunty plank
scarlet snow
jaunty plank
#

So, I can make a function, leave for 6 months and it will describe the function, its inputs, its outputs

scarlet snow
#

you can definetely decide what type is returned

#

and of course you can always comment

#

i should comment more

robust root
#

i dont even comment

jaunty plank
#

JSDoc is just comments. But it communicates with your IDE, so I can understand a function without looking at the function itself.

scarlet snow
#

wait if mongodb uses JSON can i just copy paste, really hope so.

robust root
#

theres not a single comment in my code (except those so that i can remember the keys of a dict or smth)

#

dunno if thats good or bad practice

scarlet snow
robust root
#

when i read my code i simply execute them in my mind

scarlet snow
#

"its called mongo because of its use for humongous data loads"

jaunty plank
#

You'll want to write your own handler for it, which isnt hard.

scarlet snow
#

hmm

jaunty plank
#

Ie, something that reads your entire json file, then create the mongo docs from that.

robust root
jaunty plank
#

just be weary of using chatgpt. Learning these things on your own without chatgpt is a good way to get more experince.

#

using chatgpt slows down learning.

winter raft
#

Do the new bot developer forums mean that topgg is being worked on again?
I had the impression that since the app directory, topgg hasn't been getting any updates anymore

robust root
jaunty plank
#

We've had significant backend upgrades 😄

old forge
winter raft
#

no new features though

old forge
#

patience

#

perfection takes time

#

fr

winter raft
#

ic

old forge
#

backend you can't see

winter raft
#

yea haha

tidal idol
#

i know a lot of backend changes are being made because i've seen them change features subtly

#

trust me a lot is going on and its going very well happy

winter raft
#

sounds promising

old forge
jaunty plank
#

bring back 75% uptime 😠

winter raft
#

lol

scarlet snow
#

99.94% is impressive

winter raft
#

The last patchnote being in 2022 just gives me that impression 😂

#

but I think it's the last day of 2022 actually

#

well mid december

jaunty plank
#

I think we've had quite a few upgrades in 2024 that have no patchnotes that users needed to see.
Its mostly been reliability and speed.

winter raft
#

I assume topgg gets more more traffic than the app directory right? Since most people will google for a discord bot and topgg ranks first

#

I mean you can't know for sure but I'm guessing

jaunty plank
#

The volunteer team really wouldn't know anything like that.

winter raft
#

yea

scarlet snow
#

@jaunty plank it looks like REDIS is the thing im looking for, nano second access times ❤️

#

lots of modules as well, even for AI which is just perfect for me. Gonna data science tf out of my players.

jaunty plank
#

Redis is great, just remember it stores everything in memory

#

So if something isn't accessed for weeks it's taking up memory

#

You'll want to learn to configure it before depending on it.

scarlet snow
robust root
#

with my bot's small scale I dont think Ill be learning DBs anytime soon D:

scarlet snow
#

gonna be a PIA to switch to a db now, wish i did it from the start.

jaunty plank
#

Since it's a cache system more than a database.

You can store stuff long term, but it doesn't always store right away.
It puts it in memory and stores it later.

#

Just do your research and you'll be fine.

cerulean island
#

Even if I use hosting and don't use replit, should I still use express's npm or not? And how would it be?, I am hosting the bot on a hosting and I want to make the system say that I already voted

jaunty plank
#

Express works pretty much anywhere

scarlet snow
cerulean island
robust root
scarlet snow
robust root
scarlet snow
#

as in

#

idk

#

like

#

a normal dict

#

is 1 deep

#

and then

#

if u have a dict in that dict

#

thats 2 deep

#

also yeah its no deeper than 2 not 3

robust root
#

ah nested dicts

scarlet snow
#

yes

#

exactly 😆

#

thats probably the right word for it

robust root
#

i also use nested dicts but however i also use lists

#

lists in dicts and dicts in dicts

scarlet snow
#

yeah i have lists in dicts in dicts

robust root
#

would be complicated to process with DBs

#

wish shards use shared data

scarlet snow
jaunty plank
#

👀 dicts are [item, item, item] right?

scarlet snow
jaunty plank
#

Ah objects