Package org.botblock.javabotblockapi.requests

## Class GetBotAction

- java.lang.Object
- - org.botblock.javabotblockapi.requests.GetBotAction

-     public class GetBotAction
      extends Object

  Class used to perform GET actions on the `/api/bots/:id` endpoint.

  GET requests are cached for 2 minutes unless disabled through `GetBotAction(true)`

  Since:
    5.0.0

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `GetBotAction()` | Constructor to get the instance of GetBotAction.
    `GetBotAction​(boolean disableCache)` | Constructor to get the instance of GetBotAction.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `@Nullable JSONObject` | `getBotInfo​(@NotNull Long id)` | Gets the full information of a bot.
    `@Nullable JSONObject` | `getBotInfo​(@NotNull String id)` | Gets the full information of a bot.
    `@Nullable JSONObject` | `getBotListInfo​(@NotNull Long id)` | Gets the information from the various bot lists.
    `@Nullable JSONArray` | `getBotListInfo​(@NotNull Long id, @NotNull String site)` | Gets the information from the specified bot list.
    `@Nullable JSONArray` | `getBotListInfo​(@NotNull Long id, @NotNull Site site)` | Gets the information from the specified bot list.
    `@Nullable JSONObject` | `getBotListInfo​(@NotNull String id)` | Gets the information from the various bot lists.
    `@Nullable JSONArray` | `getBotListInfo​(@NotNull String id, @NotNull String site)` | Gets the information from the specified bot list.
    `@Nullable JSONArray` | `getBotListInfo​(@NotNull String id, @NotNull Site site)` | Gets the information from the specified bot list.
    `String` | `getDiscriminator​(@NotNull Long id)` | Gets the discriminator (The 4 numbers after the # in the username) of the bot.
    `String` | `getDiscriminator​(@NotNull String id)` | Gets the discriminator (The 4 numbers after the # in the username) of the bot.
    `String` | `getGitHub​(@NotNull Long id)` | Gets the GitHub link of the bot.
    `String` | `getGitHub​(@NotNull String id)` | Gets the GitHub link of the bot.
    `String` | `getInvite​(@NotNull Long id)` | Deprecated. Replaced with `getOAuthInvite(Long)` to be more clear.
    `String` | `getInvite​(@NotNull String id)` | Deprecated. Replaced with `getOAuthInvite(String)` to be more clear.
    `String` | `getLibrary​(@NotNull Long id)` | Gets the currently used library of the bot.
    `String` | `getLibrary​(@NotNull String id)` | Gets the currently used library of the bot.
    `String` | `getName​(@NotNull Long id)` | Gets the name of the bot.
    `String` | `getName​(@NotNull String id)` | Gets the name of the bot.
    `String` | `getOAuthInvite​(@NotNull Long id)` | Gets the OAuth invite link of a bot.
    `String` | `getOAuthInvite​(@NotNull String id)` | Gets the OAuth invite link of a bot.
    `List<String>` | `getOwners​(@NotNull Long id)` | Gets an ArrayList with the owner ids of the bot.
    `List<String>` | `getOwners​(@NotNull String id)` | Gets an ArrayList with the owner ids of the bot.
    `String` | `getPrefix​(@NotNull Long id)` | Gets the prefix of the bot.
    `String` | `getPrefix​(@NotNull String id)` | Gets the prefix of the bot.
    `@Nullable Integer` | `getServerCount​(@NotNull Long id)` | Gets the server count of the bot.
    `@Nullable Integer` | `getServerCount​(@NotNull String id)` | Gets the server count of the bot.
    `String` | `getSupportLink​(@NotNull Long id)` | Gets the support link (i.e.
    `String` | `getSupportLink​(@NotNull String id)` | Gets the support link (i.e.
    `String` | `getWebsite​(@NotNull Long id)` | Gets the website of the bot.
    `String` | `getWebsite​(@NotNull String id)` | Gets the website of the bot.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GetBotAction

          public GetBotAction()

      Constructor to get the instance of GetBotAction.

    - #### GetBotAction

          public GetBotAction​(boolean disableCache)

      Constructor to get the instance of GetBotAction.
      Use this if you want to disable the caching of the GET requests.
      We do not recommend this without own caching/ratelimiting.
      Parameters:
        `disableCache` - Whether or not caching should be disabled.
        `true` means caching is disabled!

  - ### Method Detail

    - #### getBotInfo

          @Nullable
          public @Nullable JSONObject getBotInfo​(@NotNull
                                                 @NotNull 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",
               "prefix": "?",
               "website": "",
               "github": "",
               "support": "",
               "library": "JDA",
               "list_data": {
                   "somebotlist.com": [
                       {"data": "Unique bot list data"},
                       200
                   ],
                   "otherlist.org": [
                       {"data": "Unique bot list data"},
                       404
                   ]
               }
           }

      With exception of id and list_data are all returned values based on how often one appears.
      Each entry in list data is unique to what the respective bot list returns.
      Parameters:
        `id` - The id of the bot to get the information from.
      Returns:
        `JSONObject` containing the full information of the bot.

    - #### getBotInfo

          @Nullable
          public @Nullable JSONObject getBotInfo​(@NotNull
                                                 @NotNull 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",
               "prefix": "?",
               "website": "",
               "github": "",
               "support": "",
               "library": "JDA",
               "list_data": {
                   "somebotlist.com": [
                       {"data": "Unique bot list data"},
                       200
                   ],
                   "otherlist.org": [
                       {"data": "Unique bot list data"},
                       404
                   ]
               }
           }

      With exception of id and list_data are all returned values based on how often one appears.
      Each entry in list data is unique to what the respective bot list returns.
      Parameters:
        `id` - The id of the bot to get the information from.
      Returns:
        `JSONObject` containing the full information of the bot.

    - #### getBotListInfo

          @Nullable
          public @Nullable JSONObject getBotListInfo​(@NotNull
                                                     @NotNull Long id)

      Gets the information from the various bot lists.
      The returned data is entirely dependant on the bot list itself and is therefore unique.
      Parameters:
        `id` - The bots id to use.
      Returns:
        `JSONObject` containing information from the different bot list.

    - #### getBotListInfo

          @Nullable
          public @Nullable JSONObject getBotListInfo​(@NotNull
                                                     @NotNull String id)

      Gets the information from the various bot lists.
      The returned data is entirely dependant on the bot list itself and is therefore unique.
      Parameters:
        `id` - The id of the bot to get the bot list info from.
      Returns:
        `JSONObject` containing information from the different bot list.

    - #### getBotListInfo

          @Nullable
          public @Nullable JSONArray getBotListInfo​(@NotNull
                                                    @NotNull Long id,
                                                    @NotNull
                                                    @NotNull Site site)

      Gets the information from the specified bot list.
      The returned data is entirely dependant on the bot list itself and is therefore unique
      Parameters:
        `id` - The id of the bot to get the bot list info from.
        `site` - The `site` to get info from.
      Returns:
        `JSONArray` containing the information of the provided bot list.

    - #### getBotListInfo

          @Nullable
          public @Nullable JSONArray getBotListInfo​(@NotNull
                                                    @NotNull Long id,
                                                    @NotNull
                                                    @NotNull String site)

      Gets the information from the specified bot list.
      The returned data is entirely dependant on the bot list itself and is therefore unique
      Parameters:
        `id` - The id of the bot to get the bot list info from.
        `site` - The `site` to get info from.
      Returns:
        `JSONArray` containing the information of the provided bot list.

    - #### getBotListInfo

          @Nullable
          public @Nullable JSONArray getBotListInfo​(@NotNull
                                                    @NotNull String id,
                                                    @NotNull
                                                    @NotNull Site site)

      Gets the information from the specified bot list.
      The returned data is entirely dependant on the bot list itself and is therefore unique
      Parameters:
        `id` - The id of the bot to get the bot list info from.
        `site` - The `site` to get info from.
      Returns:
        `JSONArray` containing the information of the provided bot list.

    - #### getBotListInfo

          @Nullable
          public @Nullable JSONArray getBotListInfo​(@NotNull
                                                    @NotNull String id,
                                                    @NotNull
                                                    @NotNull String site)

      Gets the information from the specified bot list.
      The returned data is entirely dependant on the bot list itself and is therefore unique
      Parameters:
        `id` - The id of the bot to get the bot list info from.
        `site` - The `site` to get info from.
      Returns:
        `JSONArray` containing the information of the provided bot list.

    - #### getDiscriminator

          public String getDiscriminator​(@NotNull
                                         @NotNull Long id)

      Gets the discriminator (The 4 numbers after the # in the username) of the bot.
      The discriminator is based on the most common appearance of it across the bot lists.
      Parameters:
        `id` - The id of the bot to get the discriminator from.
      Returns:
        The discriminator of the bot or `0000` if the provided id is invalid.
      Since:
        4.2.0

    - #### getDiscriminator

          public String getDiscriminator​(@NotNull
                                         @NotNull String id)

      Gets the discriminator (The 4 numbers after the # in the username) of the bot.
      The discriminator is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the discriminator from.
      Returns:
        The discriminator of the bot or `0000` if the provided id is invalid.
      Since:
        4.2.0

    - #### getGitHub

          public String getGitHub​(@NotNull
                                  @NotNull Long id)

      Gets the GitHub link of the bot.
      The GitHub link is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the GitHub link from.
      Returns:
        Possibly-empty String containing the GitHub link of the bot.
      Since:
        4.2.0

    - #### getGitHub

          public String getGitHub​(@NotNull
                                  @NotNull String id)

      Gets the GitHub link of the bot.
      The GitHub link is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the GitHub link from.
      Returns:
        Possibly-empty String containing the GitHub link of the bot.
      Since:
        4.2.0

    - #### getInvite

          @Deprecated
          @DeprecatedSince(version="5.2.0",
                           replacements="#getOAuthInvite(Long)")
          public String getInvite​(@NotNull
                                  @NotNull Long id)

      Deprecated.
      Replaced with `getOAuthInvite(Long)` to be more clear.
      Gets the OAuth invite of the bot.
      The invite is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the OAuth link from.
      Returns:
        Possibly-empty String containing the OAuth invite for the bot.

    - #### getInvite

          @Deprecated
          @DeprecatedSince(version="5.2.0",
                           replacements="#getOAuthInvite(String)")
          public String getInvite​(@NotNull
                                  @NotNull String id)

      Deprecated.
      Replaced with `getOAuthInvite(String)` to be more clear.
      Gets the OAuth invite of the bot.
      The invite is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the OAuth link from.
      Returns:
        Possibly-empty String containing the OAuth invite for the bot.

    - #### getLibrary

          public String getLibrary​(@NotNull
                                   @NotNull Long id)

      Gets the currently used library of the bot.
      The library is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the library from.
      Returns:
        Possibly-empty String containing the library of the bot.
      Since:
        4.2.0

    - #### getLibrary

          public String getLibrary​(@NotNull
                                   @NotNull String id)

      Gets the currently used library of the bot.
      The library is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the library from.
      Returns:
        Possibly-empty String containing the library of the bot.
      Since:
        4.2.0

    - #### getName

          public String getName​(@NotNull
                                @NotNull Long id)

      Gets the name of the bot.
      The name is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the name from.
      Returns:
        The name of the bot or `Unknown` if the provided id is invalid.
      Since:
        4.2.0

    - #### getName

          public String getName​(@NotNull
                                @NotNull String id)

      Gets the name of the bot.
      The name is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the name from.
      Returns:
        The name of the bot or `Unknown` if the provided id is invalid.
      Since:
        4.2.0

    - #### getOAuthInvite

          public String getOAuthInvite​(@NotNull
                                       @NotNull Long id)

      Gets the OAuth invite link of a bot.
      The OAuth invite is used to add a bot to a Discord server.
      Parameters:
        `id` - The id of the bot to get the OAuth link from.
      Returns:
        Possibly-empty String containing the OAuth link for the bot.
      Since:
        5.2.0

    - #### getOAuthInvite

          public String getOAuthInvite​(@NotNull
                                       @NotNull String id)

      Gets the OAuth invite link of a bot.
      The OAuth invite is used to add a bot to a Discord server.
      Parameters:
        `id` - The id of the bot to get the OAuth link from.
      Returns:
        Possibly-empty String containing the OAuth link for the bot.
      Since:
        5.2.0

    - #### getOwners

          public List<String> getOwners​(@NotNull
                                        @NotNull 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 id of the bot to get the Owners from.
      Returns:
        Possibly-empty ArrayList containing the owners of the bot.

    - #### getOwners

          public List<String> getOwners​(@NotNull
                                        @NotNull 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 id of the bot to get the Owners from.
      Returns:
        Possibly-empty ArrayList containing the owners of the bot.

    - #### getPrefix

          public String getPrefix​(@NotNull
                                  @NotNull Long id)

      Gets the prefix of the bot.
      The prefix is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the prefix from.
      Returns:
        Possibly-empty String containing the prefix of the bot.
      Since:
        4.2.0

    - #### getPrefix

          public String getPrefix​(@NotNull
                                  @NotNull String id)

      Gets the prefix of the bot.
      The prefix is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the prefix from.
      Returns:
        Possibly-empty String containing the prefix of the bot.
      Since:
        v4.2.0

    - #### getServerCount

          @Nullable
          public @Nullable Integer getServerCount​(@NotNull
                                                  @NotNull Long id)

      Gets the server count of the bot.
      The server count is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the server count from.
      Returns:
        Possibly-null Integer containing the server count for the bot.

    - #### getServerCount

          @Nullable
          public @Nullable Integer getServerCount​(@NotNull
                                                  @NotNull String id)

      Gets the server count of the bot.
      The server count is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the server count from.
      Returns:
        Possibly-null Integer containing the server count for the bot.

    - #### getSupportLink

          public String getSupportLink​(@NotNull
                                       @NotNull Long id)

      Gets the support link (i.e. Discord invite) from the bot.
      The link is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the support link from.
      Returns:
        Possibly-empty String containing the support link.

    - #### getSupportLink

          public String getSupportLink​(@NotNull
                                       @NotNull String id)

      Gets the support link (i.e. Discord invite) from the bot.
      The link is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the support link from.
      Returns:
        Possibly-empty String containing the support link.

    - #### getWebsite

          public String getWebsite​(@NotNull
                                   @NotNull Long id)

      Gets the website of the bot.
      The website is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the website from.
      Returns:
        Possibly-Empty String containing the bot's website.
      Since:
        v4.2.0

    - #### getWebsite

          public String getWebsite​(@NotNull
                                   @NotNull String id)

      Gets the website of the bot.
      The website is based on the most common appearance of it.
      Parameters:
        `id` - The id of the bot to get the website from.
      Returns:
        Possibly-Empty String containing the bot's website.
      Since:
        v4.2.0