Top-gg-Community / java-sdk

An API wrapper for https://top.gg/api/docs that works in Java
Apache License 2.0
36 stars 22 forks source link

Inconsistent naming and values for setStats and getGuildCount #7

Open Andre601 opened 5 years ago

Andre601 commented 5 years ago

The problem

When I checked the code, I noticed, that setStats requires you to provide the Server count as an Integer. On the other hand, does getServerCount() return the current Server count on the DBL-Site as a Long.

This makes it unnecessary complicated for the dev to update (or get) his bots Server count on DBL, since it requires them to use two different values: Integer for setStats and Long for getServerCount. Java-APIs/Wrappers like JDA return the bots Server count as a Long, so you have to first change it to an Integer in order to send it through the setStats method. While this isn't that complicated, it still is annoying and a useless step to do.

Also, the naming of the methods can be misleading. Right now does setStats only update the total Server count of the bot, the Server count of a single shard from the bot or the Server count of all the shards the bot has. Since this is literally the only thing the method does (And I'm fairly sure there won't be any future additions for stats to update) I recommend to rename those to setServerCount, to have a more consistent naming with the getServerCount method.

Links

Here are the mentioned methods that I mean.

setStats in DiscordBotListAPI.java: https://github.com/DiscordBotList/DBL-Java-Library/blob/219345b9a8704fca8f9c46539ed98979ea53c2cb/src/main/java/org/discordbots/api/client/DiscordBotListAPI.java#L12-L14

getServerCount in Bot.java: https://github.com/DiscordBotList/DBL-Java-Library/blob/219345b9a8704fca8f9c46539ed98979ea53c2cb/src/main/java/org/discordbots/api/client/entity/Bot.java#L120-L122