Class GetAction
- java.lang.Object
-
- com.andre601.javabotblockapi.requests.GetAction
-
public class GetAction extends java.lang.Object
Class to perform GET actions with.With this class can you do the following actions:
get full bot information
get bot info from all bot lists
get bot info from a specific list
get a specific bot list
get all supported bot lists
get a bots invite link
get a bots server count
get the owners of a bot
All requests are cached for 2 minutes. This can be disabled with
GetAction(true)
although it's not recommended.- Since:
- v3.0.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable org.json.JSONObject
getBotInfo(@NotNull java.lang.String id)
Gets the full information of a bot.@Nullable org.json.JSONObject
getBotInfo(java.lang.Long id)
Gets the full information of a bot.@Nullable org.json.JSONObject
getBotList(@NotNull java.lang.String id, @NotNull Site site)
Gets the API information of a specific bot list on botblock.org.@Nullable org.json.JSONObject
getBotList(@NotNull java.lang.String id, @NotNull java.lang.String site)
Gets the API information of a specific bot list on botblock.org.@Nullable org.json.JSONObject
getBotListInfo(@NotNull java.lang.String id)
Gets the information of the bot stored on the different bot lists.@Nullable org.json.JSONArray
getBotListInfo(@NotNull java.lang.String id, @NotNull Site site)
Gets the information of the bot on a specific bot list.@Nullable org.json.JSONArray
getBotListInfo(@NotNull java.lang.String id, @NotNull java.lang.String site)
Gets the information of the bot on a specific bot list.@Nullable org.json.JSONObject
getBotListInfo(java.lang.Long id)
Gets the information of the bot stored on the different bot lists.@Nullable org.json.JSONArray
getBotListInfo(java.lang.Long id, @NotNull Site site)
Gets the information of the bot on a specific bot list.@Nullable org.json.JSONArray
getBotListInfo(java.lang.Long id, @NotNull java.lang.String site)
Gets the information of the bot on a specific bot list.org.json.JSONObject
getBotLists(@NotNull java.lang.String id)
Gets the API information of all supported bot lists on botblock.org.java.lang.String
getInvite(@NotNull java.lang.String id)
Gets the OAuth invite of the bot.java.lang.String
getInvite(java.lang.Long id)
Gets the OAuth invite of the bot.java.util.List<java.lang.String>
getOwners(@NotNull java.lang.String id)
Gets an ArrayList with the owner ids of the bot.java.util.List<java.lang.String>
getOwners(java.lang.Long id)
Gets an ArrayList with the owner ids of the bot.int
getServerCount(@NotNull java.lang.String id)
Gets the server count of the bot.int
getServerCount(java.lang.Long id)
Gets the server count of the bot.
-
-
-
Constructor Detail
-
GetAction
public GetAction()
Constructor to get the instance of GetAction.
-
GetAction
public GetAction(boolean disableCache)
Constructor to get the instance of GetAction.- Parameters:
disableCache
- If the caching should be disabled.true
means the cache will be disabled.
It's recommended to NOT disable caching if you don't use a own caching/rate limit system.
-
-
Method Detail
-
getBotInfo
@Nullable public @Nullable org.json.JSONObject getBotInfo(java.lang.Long id)
Gets the full information of a bot.The JSONObject may look like this:
{ "id": "123456789012345678", "username": "MyBot", "discriminator": "1234", "owners": [ "234567890123456789" ], "server_count": 100, "invite":"https://discordapp.com/oauth2/authorize?client_id=123456789012345678&scope=bot", "list_data": { "somebotlist.com": [ {"data"}, 200 ], "otherlist.org": [ {"data"}, 404 ] } }
The values of id, username, discriminator, owners, server_count and invite are based on the most common appearance.{"data"}
depends on what the bot list returns.- Parameters:
id
- The bots id to use.- Returns:
- A possibly-null JSONObject containing the bots information.
-
getBotInfo
@Nullable public @Nullable org.json.JSONObject getBotInfo(@NotNull @NotNull java.lang.String id)
Gets the full information of a bot.The JSONObject may look like this:
{ "id": "123456789012345678", "username": "MyBot", "discriminator": "1234", "owners": [ "234567890123456789" ], "server_count": 100, "invite":"https://discordapp.com/oauth2/authorize?client_id=123456789012345678&scope=bot", "list_data": { "somebotlist.com": [ {"data"}, 200 ], "otherlist.org": [ {"data"}, 404 ] } }
The values of id, username, discriminator, owners, server_count and invite are based on the most common appearance.{"data"}
depends on what the bot list returns.- Parameters:
id
- The bots id to use.- Returns:
- A possibly-null JSONObject containing the bots information.
-
getBotListInfo
@Nullable public @Nullable org.json.JSONObject getBotListInfo(java.lang.Long id)
Gets the information of the bot stored on the different bot lists.
The returned JSON depends on what each bot list returns and is therefore different for each one.- Parameters:
id
- The bots id to use.- Returns:
- A possibly-null JSONObject containing the bots information from the different bot lists.
-
getBotListInfo
@Nullable public @Nullable org.json.JSONObject getBotListInfo(@NotNull @NotNull java.lang.String id)
Gets the information of the bot stored on the different bot lists.
The returned JSON depends on what each bot list returns and is therefore different for each one.- Parameters:
id
- The bots id to use.- Returns:
- A possibly-null JSONObject containing the bots information from the different bot lists.
-
getBotListInfo
@Nullable public @Nullable org.json.JSONArray getBotListInfo(java.lang.Long id, @NotNull @NotNull Site site)
Gets the information of the bot on a specific bot list.
The returned JSONArray depends on the bot list defined and can be different for each one.- Parameters:
id
- The bots id to use.site
- Thesite
to get info from.- Returns:
- A possibly-null JSONArray containing the bots info on the provided site.
-
getBotListInfo
@Nullable public @Nullable org.json.JSONArray getBotListInfo(java.lang.Long id, @NotNull @NotNull java.lang.String site)
Gets the information of the bot on a specific bot list.
The returned JSONArray depends on the bot list defined and can be different for each one.- Parameters:
id
- The bots id to use.site
- The site to get the info from.
A list of supported sites can be foundhere
.- Returns:
- A possibly-null JSONArray containing the bots info on the provided site.
-
getBotListInfo
@Nullable public @Nullable org.json.JSONArray getBotListInfo(@NotNull @NotNull java.lang.String id, @NotNull @NotNull Site site)
Gets the information of the bot on a specific bot list.
The returned JSONArray depends on the bot list defined and can be different for each one.- Parameters:
id
- The bots id to use.site
- Thesite
to get info from.- Returns:
- A possibly-null JSONArray containing the bots info on the provided site.
-
getBotListInfo
@Nullable public @Nullable org.json.JSONArray getBotListInfo(@NotNull @NotNull java.lang.String id, @NotNull @NotNull java.lang.String site)
Gets the information of the bot on a specific bot list.
The returned JSONArray depends on the bot list defined and can be different for each one.- Parameters:
id
- The bots id to use.site
- The site to get the info from.
A list of supported sites can be foundhere
.- Returns:
- A possibly-null JSONArray containing the bots info on the provided site.
-
getBotList
@Nullable public @Nullable org.json.JSONObject getBotList(@NotNull @NotNull java.lang.String id, @NotNull @NotNull Site site)
Gets the API information of a specific bot list on botblock.org.The returned JSON could look like this:
{ "api_docs": "https://thelist.org/api/docs", "api_post": "https://thelist.org/api/bot/stats/:id", "api_field": "server_count", "api_shard_id": "shard_id", "api_shard_count": "shard_count", "api_shards": null, "api_get": "https://thelist.org/api/bot/info/:id" }
- Parameters:
id
- The id used for the internal caching.site
- Thesite
to get information from.- Returns:
- A possibly-null JSONObject containing information from the provided bot list.
-
getBotList
@Nullable public @Nullable org.json.JSONObject getBotList(@NotNull @NotNull java.lang.String id, @NotNull @NotNull java.lang.String site)
Gets the API information of a specific bot list on botblock.org.The returned JSON could look like this:
{ "api_docs": "https://thelist.org/api/docs", "api_post": "https://thelist.org/api/bot/stats/:id", "api_field": "server_count", "api_shard_id": "shard_id", "api_shard_count": "shard_count", "api_shards": null, "api_get": "https://thelist.org/api/bot/info/:id" }
- Parameters:
id
- The id used for the internal caching.site
- The site to get information from.
A list of supported sites can be foundhere
.- Returns:
- A possibly-null JSONObject containing information from the provided bot list.
-
getBotLists
public org.json.JSONObject getBotLists(@NotNull @NotNull java.lang.String id)
Gets the API information of all supported bot lists on botblock.org.The returned JSON could look like this:
{ "thelist.org": { "api_docs": "https://thelist.org/api/docs", "api_post": "https://thelist.org/api/bot/stats/:id", "api_field": "server_count", "api_shard_id": "shard_id", "api_shard_count": "shard_count", "api_shards": null, "api_get": "https://thelist.org/api/bot/info/:id" }, "listofbots.com": { "api_docs": "https://listofbots.com/docs", "api_post": "https://listofbots.com/api/stats/:id", "api_field": "guild_count", "api_shard_id": null, "api_shard_count": null, "api_shards": "shards", "api_get": null } }
- Parameters:
id
- The id used for the internal caching.- Returns:
- A possibly-null JSONObject containing information from all supported bot lists.
-
getInvite
public java.lang.String getInvite(java.lang.Long id)
Gets the OAuth invite of the bot.
The invite is based on the most common appearance of it.- Parameters:
id
- The bots id to use.- Returns:
- A String containing the OAuth invite for the bot.
-
getInvite
public java.lang.String getInvite(@NotNull @NotNull java.lang.String id)
Gets the OAuth invite of the bot.
The invite is based on the most common appearance of it.- Parameters:
id
- The bots id to use.- Returns:
- A String containing the OAuth invite for the bot.
-
getServerCount
public int getServerCount(java.lang.Long id)
Gets the server count of the bot.
The server count is based on the most common appearance of it.- Parameters:
id
- The bots id to use.- Returns:
- A Integer containing the server count for the bot.
-
getServerCount
public int getServerCount(@NotNull @NotNull java.lang.String id)
Gets the server count of the bot.
The server count is based on the most common appearance of it.- Parameters:
id
- The bots id to use.- Returns:
- A Integer containing the server count for the bot.
-
getOwners
public java.util.List<java.lang.String> getOwners(java.lang.Long id)
Gets an ArrayList with the owner ids of the bot.
The IDs listed are based on how often they appear on the different bot lists.- Parameters:
id
- The bots id to use.- Returns:
- A possibly-empty ArrayList.
-
getOwners
public java.util.List<java.lang.String> getOwners(@NotNull @NotNull java.lang.String id)
Gets an ArrayList with the owner ids of the bot.
The IDs listed are based on how often they appear on the different bot lists.- Parameters:
id
- The bots id to use.- Returns:
- A possibly-empty ArrayList.
-
-