#topgg-open-source

1 messages · Page 3 of 1

drowsy thistle
#

@steady kite which sdks can you work on?

steady kite
#

defeiently docs

#

topgg-voting-node-sdk

drowsy thistle
#

oooo nice

steady kite
#

node-docs that I had no idea about until just now

#

whats the URL to that

drowsy thistle
#

node-docs?

steady kite
drowsy thistle
#

never knew that existed until now

#

lmao

dense barn
#

would be neat to get those merged into the main docs site

steady kite
#

true

#

do we have URL for it rn?

#

or is it just a github kek

drowsy thistle
#

me when i wanted to update my url

deft merlin
#

lol

steady kite
#

just shoot me a DM Prayge

drowsy thistle
#

i believe everyone deserves to be able to see our progress too

deft merlin
#

send me the link and i'll post it here and pin it

drowsy thistle
#

sure sure

drowsy thistle
#

should the SDKs accept raw JSON dictionaries? because this will vary depending on language

#

what do you think @steady kite

steady kite
#

I’d accept both

#

Raw as an escape

drowsy thistle
#

as an escape?

steady kite
#

Validation is like non existent from raw?

drowsy thistle
#

yea

#

also tokens will not be related to discord bots anymore right

steady kite
#

what

drowsy thistle
#

no wait i mean

#

do server owners get access to the API as well? i dont remember if i've asked this before

steady kite
#

im confused

#

ofc they would??

#

what API ig

drowsy thistle
steady kite
#

oh

#

you have to be the owner to add a server

drowsy thistle
#

and now that servers are back, who knows if they also want to give API access to server owners

#

and maybe more things down the line

steady kite
drowsy thistle
#

yeah i know

steady kite
#

manage server or admin can't add servers to top.gg

#

so ofc the owner would get access

#

cause they are the only ones who can add it?

drowsy thistle
#

in v0, the API is very much discord bot-based because it was prior to servers becoming available again

steady kite
#

correct

drowsy thistle
#

will v1 be the same or can server owners retrieve API tokens from their top.gg server page now?

steady kite
#

still confused cause the API key's are historically on the server page, so yes server owners would have acces to there own page because they are the only ones who can add it. Maybe a missing something so imma just step back and maybe Veld understands and can answer your question.

drowsy thistle
#

or maybe they already can? (i dont have a server on the site atm)

steady kite
#

on the staging site, I don't see an option for API at the moment

drowsy thistle
#

oh

#

because if they get the same kind of token as the ones devs get for discord bots, i need to adapt the documentation accordingly

steady kite
#

I get it

drowsy thistle
#

because there's a lot of "Your discord bot"

#

in all of the sdks docs

steady kite
#

if my name was veld, I would create different API keys for different apps

#

that way you can share it to trusted individuals wihtout sharing your whole account

drowsy thistle
#

me too

deft merlin
#

You'll be given the <@&844267965742186619> or the <@&412346069675147264> role if you make a recognized contribution DoggThumbsUp

drowsy thistle
#

Yes iara_nodnotes

dense barn
drowsy thistle
#

will work on it next week

#

i need to finish this week's uni first

dense barn
drowsy thistle
#

yipppeeeee

dense barn
#

it would be nice if we could atleast update the node & python sdks sooner rather than later

drowsy thistle
#

alr

#

working on it right now

dense barn
#

im announcing the update in a few hours happy

#

just doing some final checks now

drowsy thistle
#

so no more new endpoints?

dense barn
#

two routes are available

drowsy thistle
#

(that's what i meant in general)

#

god damn this internet sucks

dense barn
#
POST /api/v1/projects/@me/commands
GET /api/v1/projects/@me/votes/:source_id?source=discord|topgg
drowsy thistle
#

alr alr

dense barn
#

any expected errors are passed through the problem+json spec

#

thank u null

#

I would recommend making a new class for v1 api clients btw

#

since they need a new token

drowsy thistle
#

god damn

dense barn
#

but any V0 api endpoints can be used for them still

drowsy thistle
#

didn't you say that they were deprecated

dense barn
#

they're not going away

drowsy thistle
#

huh

dense barn
#

the v0 api isnt being updated

drowsy thistle
#

should the documentation state that they're deprecated

dense barn
#

but the new tokens are recognized on the old api

#

no

drowsy thistle
#

alright

dense barn
#

we still support the API

drowsy thistle
#

new tokens are not 100% relative to discord bots right

dense barn
#

but we dont add new functionality to v0

drowsy thistle
#

which means that server owners can have them

dense barn
#

no, discord servers also have tokens

drowsy thistle
#

nice nice

#

will reflect it on our docs

#

does it have the same structure?

dense barn
#

wdym

drowsy thistle
#

because we used to unpack its base64 to get the ID

dense barn
#

nothing is different at all between bots and servers

#

what for?

drowsy thistle
#

/bots/:id/stats

drowsy thistle
#

or something like that

dense barn
#

i added that back

drowsy thistle
#

that fails for tokens relative to discord servers right

dense barn
#

yes

drowsy thistle
#

good good

dense barn
#

maybe

#

idk

#

lol

#

i would have to check

drowsy thistle
#

should we refer to discord bots/servers as entities or as projects

dense barn
#

projects

drowsy thistle
#

alrighty

#

will work on it as soon as i can

#

(note that i have priorities atm so be patient, other developers are more than welcome to help!)

dense barn
#

no worries

#

whenever u can

drowsy thistle
#

@dense barn do you know why this is the case? i've already asked xiuh to give me the lib dev bot's v1 token

dense barn
#

you're getting an error which does not give you json?

#
if (!res.ok) {
  throw new Error("Error updating commands: " + await rest.text());
}

...
dense barn
#

do you have "Bearer" in front of ur token

#
How do JSON Web Tokens work?
In authentication, when the user successfully logs in using their credentials, a JSON Web Token will be returned. Since tokens are credentials, great care must be taken to prevent security issues. In general, you should not keep tokens longer than required.

You also should not store sensitive session data in browser storage due to lack of security.

Whenever the user wants to access a protected route or resource, the user agent should send the JWT, typically in the Authorization header using the Bearer schema. The content of the header should look like the following:

Authorization: Bearer <token>
drowsy thistle
#

guess it's required now

#

does Bearer work with legacy tokens?

dense barn
#

Yes, but i would recommend keeping legacy as-is

#

Bearer is required now yes

#

the new API will follow the spec for anything

drowsy thistle
#

alrighty

#

will there be things like /servers/votes or /projects/votes?

dense barn
#

projects can be anything

#

a project is a server

#

or a bot

#

or whatever else

drowsy thistle
#

yeah

#

but /projects/ endpoints are not that much atm

drowsy thistle
#

POST /v1/projects/@me/commands has been implemented to the Python SDK poggythumbsup

#

other SDKs have also saw several changes (see pins)

#

i'll continue tomorrow (or whenever i have time)

#

lots of TODOs plump_pain

drowsy thistle
#

oh btw test-top.gg/api/v1/projects/@me/votes/asdf gives out 500 when it should've been a 400 error

drowsy thistle
dense barn
dense barn
#

make sure there's a V1Client instead if you havent already

drowsy thistle
#

creating a separate v1 client will take a while tho

dense barn
#

how so

#

class V1Client (token: string) extends V0Client(token) {
updateCommands() { ... }
}

#

V0 api works with v1 token

drowsy thistle
#

hmm

#

sure thing

dense barn
#

to get the token version you can use this:

const checkTokenVersion = (token: string) => { 
  const segments = token.split(".");
  if (segments.length !== 3) {
    throw new Error("invalid token");
  }

  const data = JSON.parse(btoa(segments[1]));
  if ("_t" in data) {
    return "version 1";
  }

  if ("id" in data) {
    return "version 0";
  }

  throw new Error("invalid token");
};
drowsy thistle
#

oooohh niceee!

dense barn
#

id is present in both

#

but id in v1 token is the topgg id

#

not the discord id

drowsy thistle
#

oh damn

#

what does /bots/.../stats use again

#

the legacy ones

#

do they use both

#

i forgot

dense barn
#

wdym

drowsy thistle
#

the optional bot IDs

drowsy thistle
#

so do you mind if i throw a warning whenever people use legacy tokens

drowsy thistle
#

i could add checks so that new tokens use the new /v1/projects/@me/votes endpoint while legacy tokens use the older /bots/check?userId= endpoint

drowsy thistle
#

i replaced has_voted with get_vote

#

should be compatible with both legacy and new tokens

drowsy thistle
drowsy thistle
#

both endpoints have been tested!

drowsy thistle
#

both endpoints have been implemented on the Rust SDK poggythumbsup the latter has been tested. the former is yet to be tested.

minor viper
#

Bro cooking

drowsy thistle
#

nah i'm suffering

minor viper
dense barn
#

Thanks, appreciated!! Prayge

#

The goat does it again

cunning locust
#

we love nully

#

doing gods work

dense barn
#

100%

drowsy thistle
#

thank you so much y'all 😭 your words are way too kind hahaha

drowsy thistle
drowsy thistle
drowsy thistle
#

will need feedback first

#

is the latest version of the API final?

#

(aka you won't add more features for the time being)

dense barn
#

the current feature cycle is done yes

#

i might add new features with new features or launches

drowsy thistle
#

the C++ SDK has been updated and tested for the new v1 endpoints!

#

i'll update the documentation accordingly soon poggythumbsup

#

hey veld, do you mind if i incorporate the changes in your v1 pr in top-gg/docs to my fork?

drowsy thistle
dense barn
#

are the changes PR'd?

#

I don't see any PRs open

drowsy thistle
dense barn
#

uh go for it

#

but aren't those changes supposed to be derived from the main repo?

drowsy thistle
#

yes

dense barn
#

its quite out of sync already

#

maybe syncing it up would do good

drowsy thistle
#

oh wait

#

i didn't realize that you've merged the pr

dense barn
#

yes

#

it's all out

drowsy thistle
#

i'll sync it soon

dense barn
#

i did the launch a while back

drowsy thistle
dense barn
#

yes

drowsy thistle
#

oh great

dense barn
#

we launched

#

so it's all live

drowsy thistle
#

nice

#

i'm currently updating my docs fork

#

so far it seems like the Node.js, Python, Rust, and C++ SDKs are ready

dense barn
#

ok

#

can you PR them/

drowsy thistle
#

as soon as i can

dense barn
#

it would be beneficial to let people use them earlier rather than preparing every single one then all launching

steady kite
#

what other languages need done?

drowsy thistle
#

Lua, Java, Go, Ruby, C#, and PHP

dense barn
#

it also avoids other people doing duplicate work if a PR is atleast open

drowsy thistle
#

they are still stuck at v0 (on my forks at least)

drowsy thistle
#

(i also have uni)

steady kite
#

ya don't have to do it yourself

#

ill get back to you on which ones I can do

drowsy thistle
#

you know PHP right

steady kite
#

haven't really done SDK's before only API's

#

yes

drowsy thistle
#

wait wait lemme push my changes on my php fork

#

wait i'll work on it later, i gotta focus on these 4 first

#

sorry william ayaka_pray

steady kite
#

Your good XD I can take a look

drowsy thistle
#

alright all four's documentations (readmes and .mdx files for top-gg/docs) are done, working on finishing touches

#

also working on syncing my fork, this will take a bit

#

@dense barn so the old endpoints require /v0/ right?

dense barn
#

no thats a docs link

drowsy thistle
#

right

#

also just realized i forgot to work on the source query parameter for the 4 sdks dumb one sec guys

#

is the user source always accompanied by a snowflake?

#

thinking of making an enum for my rust sdk for this

#

something like ```rs
pub enum UserSource<I> {
Topgg(I),
Discord(I),
}

#

also this is non-exhaustive right

dense barn
drowsy thistle
#

right

#

what do you think about that veld

#

should i treat it as an enum or as a variant

dense barn
#

either is fine

drowsy thistle
#

fair

drowsy thistle
#

@dense barn hey uhm in top.gg/api legacy endpoints don't work with new tokens (with or without Bearer)

#

but test-top.gg/api works fine

dense barn
#

Oh prolly my bad will update config

drowsy thistle
#

now all that's left is to sync my top-gg/docs fork with the upstream commit and finalizing it

minor viper
#

poggythumbsup poggythumbsup bro cooking

drowsy thistle
#

hey @dense barn, i just found out that POST /v1/projects/@me/commands works with { name: '', description: null }

#

{} gives out 500

#

same goes for { description: 'test' }

#

you should add checks for these

dense barn
#

Clueless just dont send bad data

drowsy thistle
#

it's only that "" and an empty body give out 400 😭

#

is the validation just to check if the body is an array of objects or not?

#

i believe 500 should be reserved for unexpected errors, don't wanna send the wrong message to bot devs

drowsy thistle
drowsy thistle
#

changes to the four SDKs are now pushed!

steady kite
#

your amazing

drowsy thistle
#

appreciate it!

dense barn
#

man these are some insanely large PRs for a route addition

#

why so many breaking changes on the node sdk

#

why didn't we just make a new class called ApiV1

#

why shoehorn it all into the same api client

dense barn
#

I left comments on all of the SDK PR's

drowsy thistle
#

will work on it

drowsy thistle
dense barn
#

Biggest thing is that there’s too many changes in one go

#

Would be awesome if we can merge the changes one by one instead of all in one go

#

It’s really hard to look at a pr that changes how releases work, tests are structured, docs are set up, and then also the separate features

drowsy thistle
#

my bad

#

will do it next time

#

sorry veld

dense barn
#

No need to apologise! I still really appreciate you taking the effort and ownership to handle this

drowsy thistle
#

i am aware i am very much imperfect and this is a learning process for me, thanks!

#

for the python SDK pull request, i'll split my pull request into four pull requests:

  1. the one that fixes/updates the v0 endpoints (also incorporates changes that make it compatible with newer python versions)
  2. the one that adds v1 endpoints
  3. the one that rewrites the readthedocs.io documentation
  4. the one that rewrites the github actions
#

i'll do the same in subsequent pull requests, i hope it makes reviewing them easier for you

drowsy thistle
#

i could split it more if you think this is still too much ayaka_pray

#

for the C++ SDK pull request, i'll split my pull request into four pull requests:

  1. the one that fixes/updates the v0 endpoints
  2. the one that adds webhooks
  3. the one that adds v1 endpoints
  4. the one that adds tests
drowsy thistle
#

there's not much going on in Rust SDK's pull request, do you mind if i split it into two batches (v0 and v1)?

dense barn
drowsy thistle
dense barn
#

it is able to find them as moves there

drowsy thistle
#

ahhh

drowsy thistle
#

done for the C++ one

#

can you check that one again? thanks

#

merged Rust SDK's pull request, now working on a second one.

drowsy thistle
#

finished, i'll issue the pull request tomorrow

drowsy thistle
#

since the other SDKs are virtually done v0-wise, i'll issue a pull request for all of them very soon

drowsy thistle
#

to help everyone keep track of things, the list of pull requests is added to the google spreadsheet. it will be actively updated. see pins. poggythumbsup

pull requests under "Pending review" are in need of review.

drowsy thistle
drowsy thistle
drowsy thistle
drowsy thistle
drowsy thistle
drowsy thistle
drowsy thistle
drowsy thistle
drowsy thistle
drowsy thistle
drowsy thistle
drowsy thistle
#

yes

#

just look at the diff in package.json

dense barn
#

do you have a screenshot of the changes?

#

i see a light mode one

#

but not dark mode AG_Think

drowsy thistle
#

dark mode in the older version?

dense barn
#

in the PR

drowsy thistle
#

oh sure

dense barn
#

overall seems good tho

#

thanks!

drowsy thistle
#

no worries!

dense barn
#

left one comment

drowsy thistle
#

will check in a sec

dense barn
drowsy thistle
#

sure

#

will work on it soon

#

i'll avoid renaming functions from now on, sorry

drowsy thistle
#

thanks veld, will work on them as soon as i can

drowsy thistle
dense barn
#

replied

drowsy thistle
#

thanks

drowsy thistle
#

do you think old features (especially things like the old widgets and get_user) should be deprecated or removed?

dense barn
#

mark them as deprecated but nothing else

drowsy thistle
#

alright

drowsy thistle
#

reverting changes will take a while, please be patient!

drowsy thistle
#

this is taking a bit longer than expected. i'll work on other things first, sorry everyone!

drowsy thistle
#

alright, reverting changes is done for the Rust SDK. it also has been linted via cargo check and cargo clippy. all that's left is to test it and double-check its documentation. poggythumbsup

drowsy thistle
drowsy thistle
drowsy thistle
#

^ also done for #30, but it's not tested yet.

dense barn
#
- .GET {
-   --header-color: blue;
- }
+ --header-color-info: blue;
+ --header-color-danger: red;
drowsy thistle
#

but the colors for GET and POST HTTP Headers are different, no?

dense barn
#

yes but now you'll get this

#
lightmode:
  variable: 
    .GET:
      blue
    .POST:
      red
darkmode:
  ...
#

lots of complexity for a simple variable usage

#

you can set the variable in react to the static value

#

you already know the method here

#

so you can just set it to the correct variable as well

#

the variables will be reliant on CSS so there's no desync

#

for example: here's how dynamic colors work for top.gg:

#

variable is used to set a dynamic color based on the application state

#

then flattened so it's consistent everywhere

#

so if you're on dark mode, all colors will be on dark mode regardless of your theme

#

the components themselves have control over the visuals needing any race conditions on CSS-in-JS

#

aaaand that way there are also no re-renders in the react tree

#

because css is managed by the browser's DOM, not the react virtual tree

#

tl;dr keep color variables flat, use react to render which variables

#

don't mix concern of responsibilities

drowsy thistle
#

alright poggythumbsup was planning to do that before this but worried it would somehow still desync

#

TIL

dense barn
#

it shouldn't

#

just make sure not to reference the hook at all

#

we dont need it

drowsy thistle
dense barn
#

That works yes

#

Can we remove the use colour mode hook now

drowsy thistle
#

also both pull requests for the .NET SDK should be resolved by now

drowsy thistle
#

hey veld, can you check the docs pull request again? thanks

drowsy thistle
drowsy thistle
#

both of the Go SDK's pull requests' breaking changes have been reverted (with one exception) and can be reviewed!

drowsy thistle
#

Lua SDK partially done -- working on reverting breaking changes tomorrow or next week.

harsh shore
drowsy thistle
drowsy thistle
drowsy thistle
#

@dense barn just making sure, is /bots deprecated or is it just the search parameter?

dense barn
#

all of v0 is deprecated lol but we're not changing the api

#

my answer every time will be the same

#

"the current state is how it'll be"

#

no more. no less

drowsy thistle
dense barn
#

exactly

#

its not going to change

#

so no need to change or depracte it

#

there will be an announcement when things get deprecated

drowsy thistle
# dense barn no need to change anything

i remember you stating that before the entirety of v0 is marked as deprecated, the /bots endpoint is deprecated (in the same vein as the user endpoint and legacy widget endpoints)

is deprecated here in the same vein as the deprecation of the entirety of v0?

dense barn
#

i mean yeah but we dont change the client for that

#

its more of a line of thought where we arent changing v0 anymore ever

#

its legacy

#

no need to mark it as deprecated because it's not for user's pov

#

they use the endpoints and there are no alternatives so you can't deprecate the endpoint

#

neither is there plans to remove it

#

so just keep things are they are and focus on v1

drowsy thistle
dense barn
#

yep no need to change it

drowsy thistle
#

no need to change it iara_think_thonk

dense barn
#

yes

drowsy thistle
#

should i still mark it as deprecated

dense barn
#

no

drowsy thistle
#

damnit

dense barn
#

we dont change the v0 api

#

so there's no need to change the v0 client

drowsy thistle
#

guess most of the pull requests are back to WIP

#

working on them as soon as i can, thanks veld!

dense barn
#

i mean it's been pretty consistent no

drowsy thistle
#

wdym

dense barn
#

just pretend v0 doesnt exist anymore, it's an old api with buggy functionality

#

why waste time on it when the current apis for the routes work

#

people are using really only post-stats and the /vote one

drowsy thistle
#

because i realized that in the latest version of the rust sdk i removed the get_bots function

#

there was a pull request for it and it got merged and everything

dense barn
#

lol

drowsy thistle
#

im unsure if i should bring it back

dense barn
#

don't bother

drowsy thistle
#

same goes for the get_users function

dense barn
#

don't waste your time on it

drowsy thistle
#

some of the sdks no longer have it (as in they are deleted)

#

i've been an advocate for consistency, guess you're not too serious on that kittysad

dense barn
#

I'm an advocate on impact

drowsy thistle
#

wait what about attributes like shards? should those be marked as deprecated?

#

because i'm sure the docs page will reflect this

dense barn
drowsy thistle
#

sooo i'm taking that as a no

#

sorry veld, thanks for clarifying

dense barn
#

If you've done the work, we can merge and release it

#

but im more keen on getting command uploading across man

#

i dont really care about the v0 api because it's more of a thorn in our side atm

drowsy thistle
#

but i thought the majority of bots still depend on them

#

but fairs fairs ig

dense barn
#

yes and it works

#

and that's all it'll do

drowsy thistle
#

i hope bot devs are not mad at my rust sdk cuz it does not have the get_bots endpoint even though it's there on the docs page 😭

#

okay nvm you know what i'm bringing em back

#

i couldn't stop thinking about the bot devs man plump_pain

#

i'm bringing the sdks back to when it had the most of the v0 features

drowsy thistle
#

btw since you value impact, do you consider adding a parameter to a method as breaking? because some languages do not support optional arguments @dense barn

dense barn
#

incremental changes are not breaking changes

#

if they do not support optional arguments we should use objects with optional properties instead

#

the highest impact thing the clients can do now is support v1

drowsy thistle
#

alright

drowsy thistle
#

alright, reverting has been done for the Rust SDK! poggythumbsup

so far, its api feature has been tested. other aspects such as its autoposter and webhooks are yet to be tested.

drowsy thistle
#

after 6 hours of debugging the Rust SDK's doctests (including autoposters for both discord libraries) have finally been tested iara_yay

#

all that's left is to do test its webhooks and we should be good to go!

drowsy thistle
#

axum webhook port tested poggythumbsup

drowsy thistle
#

warp webhook port tested poggythumbsup

drowsy thistle
#

rocket webhook port tested poggythumbsup

drowsy thistle
#

actix-web webhook port tested poggythumbsup everything has been tested! expect a pull request coming up in a few moments!

#

debugging this SDK has made me nearly maxed out my laptop's storage several times lol

#

but at least every docstring example has been tested! BunNod

drowsy thistle
drowsy thistle
drowsy thistle
#

i read it directly from my github notifs so i was confused lmfao

#

i'm gonna be mostly unavailable tomorrow, so i'll see if i could get last-minute fixes done at this hour (it's 12am)

drowsy thistle
#

i'll work on updating it to use a timer tomorrow when i can!

drowsy thistle
drowsy thistle
#

^ also done for .NET SDK's v0 revert branch. yet to be tested when i have time.

#

please be patient ayaka_pray so sorry for the delays everyone! i'm giving my best for all of this

copper oxide
drowsy thistle
#

i'm taking a break from this so i can focus on uni until next week. the first half of this week has been non-stop SDK development lol kittysalute

copper oxide
#

good luck with uni!!

minor raft
#

mcp server for top.gg api would be a great

#

idk if anyone else would use tho tbh but can be a feature for sure

chilly yacht
#

i think the priority should be kept on what it currently is, such as stability and improvements rather than LLM buzz

drowsy thistle
dense barn
minor raft
#

true and it's understandable 😭

#

its just tools made easy for plug and play but that itself is annoying cuz theres loads of servers and the general ai users dont know how to set it up

dense barn
#

😂 valid

minor raft
#

ill make one anyway as i want my ai bot to suggest other bots if user asks 😅

dense barn
#

oohh

#

that would be awesome :)

drowsy thistle
#

alright, time to start working on testing the .NET SDK poggythumbsup

drowsy thistle
#

the split/v0 branch has been tested! which means that it's now time to file a pull request iaraThumbsUp

drowsy thistle
#

hey @dense barn, can you check the pull request above again? i've responded to your comments

dense barn
#

that's fine I would've preferred to do

public string SupportUrl { get; init; }
public string SupportInviteCode => SupportUrl;

but there's no real downside to your solution perf-wise

drowsy thistle
dense barn
#

yeah thats fine

drowsy thistle
#

alright

#

now the pull request can be merged

#

(i don't have permissions to do it)

#

maybe you or faithie

dense barn
#

done

drowsy thistle
#

epic

drowsy thistle
drowsy thistle
#

currently reverting the breaking changes done on the C++ SDK, this will take a while, sorry!

drowsy thistle
drowsy thistle
#

changes reverted and tested for the webhooks pull request!

#

the pull requests for the C++ SDK are now ready to be re-reviewed!

drowsy thistle
#

now working on adding v1 functionalities to the .NET SDK poggythumbsup

#

and also maybe a dsharpplus adapter

#

(oh btw i just noticed that some of the .NET functions have inconsistencies like for example a method that does not end with Async is actually async notlikekomi )

drowsy thistle
#

im gonna mark the old methods as obsolete and create an async version of them, because the method names can be misleading

#

also i just realized that the .NET SDK has never handled HTTP exceptions properly plump_pain

drowsy thistle
#

cuz otherwise it will be super messy

dense barn
#

if you need the .net adapter first work on that first

#

get that merged first

#

then work on the next dependant

drowsy thistle
#

alright

#

im pretty much done now, about to test it

#

but to test the post bot commands functionality, i would need to depend on a discord library because the raw functionality depends on an generic type which would be serialized to a JSON format. while i could theoretically create a mock application command class for this, that would be too complicated is it not?

#

wait i think i have a workaround for this, one sec

drowsy thistle
#

alright, done!

#

other pull requests in the SDK are also available for review btw

drowsy thistle
#

i'll focus on the documentation side of things tomorrow BunNod

drowsy thistle
#

documentation for Rust, C++, Node.js, Go, .NET, and Lua SDKs is now complete!

TODO: document v1 features for the C++, Go, and Lua SDKs

drowsy thistle
#

both pull requests that adds v1 functionality can now be reviewed (see pins)

drowsy thistle
#

currently working on reverting breaking changes for the python sdk. this will take a while, please be patient!

broken frost
#

i will not be patience

#

where update

drowsy thistle
drowsy thistle
#

alright, i am finally done with porting its structures! now it's time to port its webhook and autoposter, this will take some time ayaka_pray

#

i'll work on it tomorrow! ayaka_pray

drowsy thistle
#

alright, autoposter and webhook done! now it's time for make some finishing touches and finally start testing

drowsy thistle
#

API methods and autoposter tested!

drowsy thistle
#

webhook tested!

drowsy thistle
#

alright, i'm pretty much done! i've split my changes into three pull requests (because previously the diff was really big):

  • the one that adapts it to the latest version of v0 (split/v0)
  • the one that simplifies its tests by reducing them into two files (split/tests)
  • the one that overhauls its readthedocs documentation (split/docs)
drowsy thistle
drowsy thistle
#

alright, time to work on the Java SDK plump_pain

drowsy thistle
drowsy thistle
#

alright, i've split my changes to three pull requests!

  • the one that adapts it to the latest version of v0 (split/v0)
  • the one that adds an autoposter functionality (split/autoposter)
  • the one that adds a webhooks wrapper for Spring Boot, Dropwizard, and Eclipse Jetty (split/webhooks)
drowsy thistle
#

i'll work on the Ruby SDK tomorrow! poggythumbsup

drowsy thistle
#

breaking changes has been reverted and everything has been tested, it's time to work on adding v1 functionalities fastnod

drowsy thistle
#

alright, everything has been tested!

drowsy thistle
#

one SDK left proudkitty

drowsy thistle
#

PHP SDK done! now it's time to test it BunNod

drowsy thistle
#

alright, everything has been successfully tested!

drowsy thistle
#

alright, i'm FINALLY done with every SDK!!! iara_yaykittyparty

#

now all that's left is to continue on with the pull requests BunNod

drowsy thistle
#

god it feels so good to finally have a break proudkitty

kindred maple
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

drowsy thistle
#

they made the channel open not too long ago

#

afaik they created a role that allowed people to send messages in this channel and added it to id:customize, i'm not sure if that role still exists

#

kinda sucks that i've been getting unrelated messages here :/

kindred maple
#

One message removed from a suspended account.

drowsy thistle
kindred maple
#

One message removed from a suspended account.

drowsy thistle
#

@wraith pulsar

#

another one

wraith pulsar
drowsy thistle
#

you are the only mod i rely on when the others are asleep lol

wraith pulsar
#

no worries times zones are weird

drowsy thistle
#

now it's ready to be issued immediately once the v0 pull request is reviewed and merged

drowsy thistle
#

every tests now work for the Python SDK!

#

#87 has gotten pretty big (over 1,700 line diffs), i'm splitting it into three pull requests.

drowsy thistle
drowsy thistle
#

added v1 support for the Python SDK! poggythumbsup

tawny nest
#

Have / will the examples on the repo be updated?

drowsy thistle
#

in fact i will rewrite the entire README and documentation

#

the former will apply to ALL SDKs

tawny nest
#

yay

drowsy thistle
#

@tawny nest the readme changes will be be carried over by the split/docs pull request, it will be issued once the split/v0 pull request is reviewed and merged

tawny nest
drowsy thistle
#

i am briefly taking a break from the SDKs because i am not really in a good mental state right now, sorry everyone!

tawny nest
#

mental and physical health always comes first

dense barn
#

take care AG_Pray

drowsy thistle
#

hey everyone, just wanted to let you all know that i should be able to return to this by mid-november. so sorry for the delay! ayaka_pray

supple nebula
#

where can i get the src for top.gg

cunning locust
supple nebula
cunning locust
#

thats not public

supple nebula
swift seal
#

Hey, I would like to help every now and then with top.gg's lib for Go language, how do I get about it?

#

I'm a Go professional, core developer of one of discord libraries (officially confirmed by discord)

#

I don't know if I can send links here, if so tell me.

drowsy thistle
#

hai! you can make a pull request, or dm one of the community managers to become one of the core maintainers and become a library developer (but in the end you still need to make changes via pull requests)

swift seal
drowsy thistle
#

huh really? to me it's not rude imo

#

feel free to make a pull request right away

#

but if you really wanna become the core maintainer, sure dm marco poggythumbsup

swift seal
#

Well tbh. the Go version of top.gg lib feels abandoned so if I were to make any changes - I would likely try rewriting most of it, normally it's seen as very bad / rude.

#

Thing is, the way it is written is not very in Go style

#

It feels imported from somewhere else

drowsy thistle
#

i understand, many of the other SDKs are abandoned as well

#

i've been updating most of them for the past month plump_pain

#

i have a pull request on the Go SDK that updates it to the latest API's changes, but feel free to rewrite it poggythumbsup

swift seal
#

Does top.gg API actually has so many changes to track? I thought it's like 1-2 pull requests a month and it should be golden with how slowly things move around top.gg I see.

drowsy thistle
#

kinda

#

i'm sure Veld is fine with you rewriting things, just make sure that you DO NOT make breaking changes

#

unless you make it a major release, but i don't think he's too keen on that atm

swift seal
#

Do we get some testing api keys for automated test cases?

drowsy thistle
#

yes

swift seal
#

Then it should be fine if I can setup maybe some github workflow tests

drowsy thistle
swift seal
#

Gotcha, I'll try talking to Marco and we'll see.

drowsy thistle
#

i dmed Xiuh for the token but i think you can dm marco too

swift seal
#

Oh... should I rather talk with Xiuh then? To not confuse them more

#

He was helping on my other ticket just few min ago

drowsy thistle
#

sure

#

also *she

swift seal
#

mb

swift seal
#

Hey @drowsy thistle could you link me the current, most up to date Top.gg API docs? It seems broken / incomplete what I found:

#

I would like to avoid having to scavenge throught other language libraries to reverse engineer endpoints and models...

drowsy thistle
chilly yacht
#

Those are the most recent ones

drowsy thistle
#

the latest version API is in docs.top.gg, it's just that it is not that well written atm imo

swift seal
#

Hmmm...... they are totally not in sync with my old go sdk I just cloned

drowsy thistle
#

i have a docs pull request that overhauls it coming up

swift seal
drowsy thistle
#

okay so

#

user source is essentially an enum

#

you can use this in the query param for the API endpoint that mentions it

#

both API versions are basically the same in terms of input/output types

drowsy thistle
#

try it out with top.gg and discord IDs and see what happens

swift seal
#

Ok, so for now - would it be correct to call it all as just v1 and have 3 API segments:

/bots (strict rate limits)
/users (regular rate limits)
/projects (strict rate limits)

drowsy thistle
#

no not really

#

/projects is v1

swift seal
#

I'm also currently crafting logic for rate limiter

drowsy thistle
#

/bots and /users are v0

#

which is technically deprecated but will remain supported

swift seal
#

Well, you see this is confusing because if v0 is deprecated -> this technically means any new code should ignore it / omit it, so logically I should only handle v1 but from what I see it only supports setting slash commands right now to be displayed so... developers using this library would have no control regarding bots/users?

#

Or no wait

drowsy thistle
#

what Veld's view on this is, v0 is technically deprecated BUT all SDKs should not mark it as so, it's just that it will NOT be maintained anymore.

#

therefore libraries should not mark them as depecated or dismiss them entirely

#

because of this he is opposed on breaking changes

#

and instead encourage lib devs to extend their sdks to add v1 support

#

(and also fix existing bugs, but thats not his priority rn)

swift seal
#

Hmm... got it but it's very confusing way of doing things, it's against any normal practices...

v1 alone as is - is not really usable on it's own from what I see, so v0 support is a must anyway

drowsy thistle
#

thousands of bots depend on top.gg's sdks, and i kinda understand him

#

he doesnt wanna upset the bot dev community

swift seal
#

Well, many things must keep backward compatibility, that's fine on it's own, just calling it v0 + @deprecated is weird

#

Anything under v1 is usually considered experimential, not production ready, comes with no promises whatsoever.

drowsy thistle
#

it's just that it's unmaintained indefinitely, existing bugs on v0 will remain forever

swift seal
#

Ok, I'll try adding commets to each method signaling which API version it uses.

drowsy thistle
#

most of v0 still work, you should not dismiss them

#

sagu honestly i did this too when v1 was announced, i rehashed many of my SDKs, and Veld was not happy with that

swift seal
#

Are those object descriptions in docs 100% up to date?

drowsy thistle
#

yes

#

you can make a request to the API to double check tho

drowsy thistle
swift seal
drowsy thistle
#

i understand

swift seal
#

Let me create what's available in documentation for now and cry later when things fail

drowsy thistle
#

if you want a frame of reference, see my python SDK

#

it does not have v1 atm but it has the newest version of v0

swift seal
#

It sounds so bad: latest version of v0

#

on so many levels

#

but it is what it is

drowsy thistle
#

well, i am working on them

#

and i am waiting for Veld to review all of my pull requests lol

#

or Luke

#

but days has passed

swift seal
#

I warned Xiuh I'm gonna drop a pull request with like 3k lines of code at once

#

to not be scared

drowsy thistle
#

uh

#

Veld had advised me that it's better for me to split big diff pull requests

#

reviewing 3k diffs is not fun

swift seal
#

Go lib version is absurdly behind and weirdly made for Go standards so it's really a good idea to rewrite most/all of it.

drowsy thistle
#

but in your context, maybe he'll be fine with it idk

swift seal
#

I'll be good and create some basic skelet of docs and testing

#

should be fine I hope

swift seal
#

it wouldn't pass tests when I'm rewriting nearly everything and I was now to split whole rewrite into few pull requests

drowsy thistle
#

good luck!

swift seal
#

@drowsy thistle unclear:

bot.defAvatar ?string | "The cdn hash of the bot's avatar if the bot has none"

#

Do you mean the cdn of the discord automatic avatar (one of five) when bot has no avatar?

#

The description makes no sense

drowsy thistle
#

defavatar is deprecated

#

avatar also now holds the ENTIRE url, not just the hash

#

how the go sdk docs was worded was kinda wack

swift seal
#

It's not just go sdk, same naming is in docs

drowsy thistle
#

yeah i understand

#

some parts of these dated years ago

swift seal
#

@drowsy thistle it's not completed, I'm heading to sleep for today but leave me info if using this kind of naming is fine. Default, raw values in API are commonly misleading without context so I modified few field names to better match + add some description. Also gotta love even API sometimes uses snake_case just for other time to use camelCase...

#

Also why docs says server & shard counts may be empty/omitted? It doesn't really make sense, I did few test API searches and every single bot appears to have those fields defined.

dense barn
dense barn
#

v0 is not deprecated. but it is not getting any more support.

#

v1 is the current recommended API

drowsy thistle
#

ohhh

dense barn
#

yeah there's no need to mark it as deprecated because in a sense v0 is no longer going to be updated from an API endpoint so whatever is there now will be there until it shuts down

#

if the client supports something it shouldn't it can safely be ignored and focus for libraries should be on building v1's clients

drowsy thistle
#

true

swift seal
#

Got some time on my hand lol, holidays

drowsy thistle
#

yipppeeeee

swift seal
#

Bot.vanity?

#

It doesn't seem to exist anymore?

#

I do test API requests with testing token but I got 0 bots with vanity field

drowsy thistle
#

yea

#

vanity is a feature exclusively for certified bots, bot certification was removed a looong time ago

swift seal
#

bot.donatebotguildid?

swift seal
drowsy thistle
#

yes

swift seal
#

Pls tell me if that matches up to date standards

#

I had to get bit creative with naming because what API uses in field values is really random

drowsy thistle
#

i'll check when i'm available

#

i'm very busy right now

#

maybe veld will

#

or someone else

swift seal
#

Hmmm

#

Could someone confirm if https://top.gg/api/bots/:bot_id/stats endpoint works properly?

#

I tried my own bot and got back:

{
    "server_count": 2,
    "shards": [],
    "shard_count": null
}

But it should say servers: 0 as I never published this data

#

Confused why it got 2

drowsy thistle
#

yes

#

i tested the post stats endpoint by posting {"server_count":2} often

swift seal
#

I tested fiew servers

#

bots*

#

It always shows the same response and is quite slow

drowsy thistle
#

oh

#

then i don't know

#

i've always used {"server_count":2} for the lib dev bot (1026525568344264724)

swift seal
#

Could it be that it just totally ignores what's in uri and targets bot from where it has auth token?

#

@deft merlin could we get clarification? I assume you have access to API spec details.

deft merlin
#

nah you'll have to talk to @dense barn

swift seal
#

Also

deft merlin
#

im not a technical resource hehe

swift seal
#

It even ends up getting 200 OK answer with empty [] array if data is invalid

#

It should never happen

#

It's all coming from v0 category so I'm confused if I should implement it knowing it's broken anyway or don't bother and ignore altogether...

drowsy thistle
dense barn
#

i think we still read the data if sent and aggregate it, but we dont store them individually

swift seal
#

Could we maybe get some list which endpoints works / partially / not at all?

dense barn
#

for backporting purposes

swift seal
#

Well, if I'm about to rewrite whole lib then I won't held back

dense barn
#

V1 is what's new

#

I would recommend using that

swift seal
#

Yeah but you said it yourself quite a bit of stuff exists in v0 only

dense barn
#

For stats, only server_count matters and should be used moving forward

swift seal
dense barn
#

ApprovalDate is actually creation date iirc

#

Library is not stored anymore so dont include it in the library you're writing

swift seal
#

I can rename it but it might be misleading*

#

By creation date insdie bot object, people might think it means when bot was created in general sense

dense barn
#

OwnerIDs is currently a mix of top.gg IDs and discord IDs

swift seal
#

Well, I used Discord valid uint64 snowflake

dense barn
#

in the UI we only accept both, but, will always map them to our internal IDs

#

FeaturedGuildIDs we don't expose in the API afaik

drowsy thistle
dense barn
#

we don't display approval date tho?

swift seal
#

Yeah, API sends empty array

drowsy thistle
#

oh wait what

dense barn
#

it's created at date

#

when the user submits the draft to top.gg

#

ShardCount should be removed

#

other than that lgtm

swift seal
#

Correct?

dense barn
#

feel free to also PR those fields out of docs tbh

#

yep lgtm

swift seal
#

I might do huge PR in 3 days or in 2 months

#

Realistically

dense barn
#

for reference

#

here's our legacy backporting function:


export const createLegacyApiSchema = (b: LegacyApiItemFragment): LegacyApiBot => {
  return {
    invite: b.__typename === "DiscordBot" ? (b.inviteUrl ?? undefined) : undefined,
    website: b.socials.find((s) => s.type === SocialPlatformType.Website)?.url,
    support: b.socials.find((s) => s.type === SocialPlatformType.Discord)?.url,
    github: b.socials.find((s) => s.type === SocialPlatformType.Github)?.url,
    longdesc: b.longDescription,
    shortdesc: b.shortDescription,
    prefix: b.__typename === "DiscordBot" ? b.prefix : undefined,
    lib: "",
    clientid: b.__typename === "DiscordBot" ? b.applicationId : undefined,
    avatar: b.iconUrl,
    id: b.externalId,
    username: b.name,
    date: b.createdAt,
    server_count: b.socialCount ?? 0, // eslint-disable-line camelcase
    shard_count: 0, // eslint-disable-line camelcase
    guilds: [],
    shards: [],
    monthlyPoints: b.votes,
    points: b.totalVotes,
    certifiedBot: false,
    owners: b.owners
      .map((o) => o.connections.find((x) => x.type === "discord")?.id)
      .filter((x) => x != null),
    tags: b.tags.map((t) => t.slug),
    reviews: {
      averageScore: b.reviewStats.averageScore > 0 ? b.reviewStats.averageScore / 20 : 0,
      count: b.reviewStats.reviewCount,
    },
    bannerUrl: b.__typename === "DiscordBot" ? (b.backgroundUrl ?? undefined) : undefined,
  };
};
#

^ turns out we do backport them to discord IDs so i guess there's that

drowsy thistle
#

i swear i remember someone saying that the date property is when the bot was approved 😭 time to change it on every sdk i've worked on

swift seal
#

I also believe it's when it was approved by top.gg

dense barn
#
 date: b.createdAt,
drowsy thistle
#

i know

#

not now

dense barn
#

might've been i wouldn't know

#

it's been like this for a long long time tho

drowsy thistle
#

i know

dense barn
#

since i haven't touched it since the last time i fixed bugs for it

swift seal
dense barn
#

it is typescript lol

#

it's actually very strictly typed

swift seal
#

lol my bad then, it was some time since I got free of any javascript/typescript in our codebases and I forgot how messy it was

dense barn
#

everything here is a type narrower

swift seal
#

I thought at first API was slow as server is dying

#

But if it's JS based then it would make sense :/

dense barn
swift seal
dense barn
#

it wont have a lot of elements

#

max 5

swift seal
#

Where it likely can be limited down to 1, maybe 2

#

And in case of JS it means new stack calls, etc.

dense barn
#

its really trivial

#

these are micro-optimizations of nanoseconds

swift seal
# dense barn these are micro-optimizations of nanoseconds

Both yes and no... I won't attack you about it or anything, just saying there's lots of hot spots blatantly on view.

While in a test case it's just a few nanoseconds or like 1ms, at scale it can quickly grow, especially in case it's single threaded. V8 uses IO loop (async/await stuff) but it's still ultimately bound to single core. V8 allows for child processes (aka threads) but they are very heavy, hard to use well.

Also it probably hits your GC like crazy, you create & instantly drop a bunch of stack frames and variables so my assumption is it makes GC way more frequent than it needs to be.

dense barn
#

why would it hit my GC, im iterating over a list of references

#

we currently run 250 requests per seconds on three tiny machines, i think perf is fine for the website :p

#

opportunity cost is higher than to refactor legacy apis

swift seal
swift seal
#

Calling functions is not free, especially in interpreted languages

#

Also as you use map/set, you likely want to access data via key, otherwise use arrays because data is then allocated next to each other, resulting in way faster for loops

#

Map can store data that can be all over the place, making memory lookups take longer time

dense barn
#

While what you're saying is true, it doesn't work for my usecase

#

Maps aren't serializable

swift seal
dense barn
#

its the entire react web server

swift seal
#

For example, our work services are made in Go but a single docker container with 1GB ram, 2vCPUs locked at 3GHz & 1gbps connection (2 sides) - it's able to handle about 60k req/sec

#

Ah, so the website and API are same codebase?

#

It runs as single process?

#

I guess it's fine... like react and fast are opposite words lol

dense barn
#

basically

#

hence why legacy api

#

new api runs on aspnet

swift seal
#

I have no idea about C# stuff

dense barn
#

C# fast

swift seal
#

I know it's reasonably fast

#

Just don't know any details

dense barn
#

yeah fair

#

@true sinew is my C# goat when it comes to internals

swift seal
#

Ye, well I do Go, Rust, C

#

Rarely TS if must

drowsy thistle
#

based stack

swift seal
#

Used to use TS way more back in the day but Go is just too good

#

It just works and is 5-10x faster just by being here lmao

drowsy thistle
#

both are cool, plan to use one of them in the future

swift seal
#

Yeah, well if you don't need to do front end stuff, you basically always want Go between it and TS.

#

It's like free upgrade

#

If you know TS well, moving to Go is simple

dense barn
#

tried go

#

its ok

#

prefer C#

swift seal
#

I never tried C# so idk, only know that after Java I have PTSD with classes

#

Yes, I would love 7th deep class inheritance

drowsy thistle
#

C# and Go are equally cool, love both

dense barn
#

meh, you dont need inheritance for web services

#

i barely use inheritance

swift seal
#

I use Go for nearly everything nowadays as my "go to" language, not just some web servers

#

Obviously don't do super low level drivers or databases in it - althought you can if people do similar shit in Java..

#

But it's fully capable as backend for some apps, game server, etc.

dense barn
#

yep

#

its what its designed for

swift seal
#

Yeah, coolest part is that how freaky simple it is to start - like imagine teaching junior Go vs C++ now

#

Sure C++ in good use can be faster but honestly not all that much

#

Good Go code can get like I would say to even 90% of what good C++ code can achieve

#

But you'll pay a lot of time and sanity to do C++ good code*

#

C# I've also heard it is rather easy to pick up, just similarly to Java it is bloated with a lot of patterns, specific expectations how to code...

drowsy thistle
#

i don't really compare languages lately, imo it depends on the ecosystem, if it has the crucial things i need for my project, i'll use it

swift seal
#

Yeah, for the most part I use it as tools

#

After all that's what they are

#

Just pick a correct tool for the job

#

Just never cry later when someone picks rust and is now behind with competition because it takes ages to make new features or when you have server in python and it's beyond slow...

dense barn
#

yeah

#

lol

drowsy thistle
#

well obviously you also need to be aware of its downsides prior to using it

swift seal
#

It's obvious you won't know everything from start

lyric magnet
wary spoke
#

Why is my bots pfp not showing on top.gg? And i cant fix it.

tawny nest
#

and lastly, dont post in 3 channels to get help.

wary spoke
tawny nest
tawny nest
wary spoke
# tawny nest yes

Yea not sure where u see a 'refresh data' button bc i just looked threw the tabs and dont see it anywhere

wary spoke
#

Yea i was lookin in setting where it should be.

broken frost
#

@wary spoke

  1. please use one channel to ask for support, we have a designated channel here: #support
  2. please be more respectful when interacting with other users
    thank you prayge
drowsy thistle
floral salmon
#

what is
Top.gg Lib Dev API Access

#

and can i use it

#

and how do you use it

#

hello

#

any help at all

drowsy thistle
#

a bot listed for the sole purpose of library developers being able to access the API without having to list their own bot in order to gain access to an API token

floral salmon
drowsy thistle
#

what

tawny nest
#

what

floral salmon
tawny nest
#

...

#
  1. im not a library dev
  2. i dont have access
  3. no
drowsy thistle
#

it does not do anything

#

its only purpose of being listed is to give non-project creator Top.gg API library developers (like me) an access to its API token

kindred maple
#

One message removed from a suspended account.

#

One message removed from a suspended account.

floral salmon
kindred maple
#

One message removed from a suspended account.

agile dock
#

Hi

#

@meager basin

meager basin
#

?

haughty plover
#

?verify

cunning locust
#

i miss when this channel was locked 🥀

drowsy thistle
#

same

dense barn
#

we made it open to make it easier for people to get into contributing to the SDKs

drowsy thistle
#

@wraith pulsar sigh

wraith pulsar
#

ty

drowsy thistle
#

okay

tawny torrent
#

Hey

drowsy thistle
#

veld, can you try checking some of the pull requests in pins? thanks ayaka_pray

#

just as a quick reminder

drowsy thistle
#

or maybe william can check them whenever he's free

slate mango
#

I say hallotopggSunglasses

night belfry
gilded notch
stone obsidian
slate mango
#

💪

heady halo
#

Does anyone maintain the top.gg JavaScript library? I'm getting the error Autoposter is not a function

#

I just copied and pasted the code that was in the documentation

heady halo
heady halo
dense barn
#

I would avoid renaming the Api since it causes for a breaking change. For an incremental improvement I would call it "ApiV1" for now.

heady halo
#

hum

heady halo
#

If you want, I can try to help create this class