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 either `GetBotAction(true, String)` or `GetBotAction(true, String, String)`.

  Since:
    5.0.0

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `GetBotAction​(boolean disableCache, String id)` | Constructor to get an instance of GetBotAction.
    `GetBotAction​(boolean disableCache, String userAgent, String id)` | Constructor to get the instance of GetBotAction.
    `GetBotAction​(String id)` | Constructor to get an instance of GetBotAction.

  - ### Method Summary

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

      Constructor to get an instance of GetBotAction.

      Using this constructor will set the following default values:

      - Cache: `Enabled`
      - User-Agent: `"JavaBotBlockAPI-0000/API_VERSION (Unknown; +https://jbba.dev) DBots/{id}"`
      Parameters:
        `id` - The id of the bot. This is required for the internal User-Agent.
      Throws:
        `NullPointerException` - When the provided id is empty.

    - #### GetBotAction

          public GetBotAction​(boolean disableCache,
                              @Nonnull
                              String id)

      Constructor to get an instance of GetBotAction.
      This constructor allows you to disable the internal caching, by providing `true` as the first argument.

      Using this constructor will set the following default values:

      - User-Agent: `"JavaBotBlockAPI-0000/API_VERSION (Unknown; +https://jbba.dev) DBots/{id}"`
      Parameters:
        `disableCache` - If the cache should be disabled.
        `true` means the cache is disabled.
        `id` - The id of the bot. This is required for the internal User-Agent.
      Throws:
        `NullPointerException` - When the provided id is empty.

    - #### GetBotAction

          public GetBotAction​(boolean disableCache,
                              @Nonnull
                              String userAgent,
                              @Nonnull
                              String id)

      Constructor to get the instance of GetBotAction.
      This constructor allows you to disable the internal caching, by providing `true` as the first argument and also set a own User-Agent for the requests by providing any String as the second argument.

      Note that you can provide `{id}` inside the userAgent to get it replaced with the provided id.

      Parameters:
        `disableCache` - If the cache should be disabled.
        `true` means the cache is disabled.
        `userAgent` - The Name that should be used as User-Agent.
        `id` - The id of the bot. This is required for the internal User-Agent.
      Throws:
        `NullPointerException` - When the provided userAgent or id is empty.

  - ### Method Detail

    - #### getBotInfo

          @Nullable
          public JSONObject getBotInfo​(@Nonnull
                                       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 JSONObject getBotInfo​(@Nonnull
                                       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 JSONObject getBotListInfo​(@Nonnull
                                           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 JSONObject getBotListInfo​(@Nonnull
                                           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 JSONArray getBotListInfo​(@Nonnull
                                          Long id,
                                          @Nonnull
                                          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 JSONArray getBotListInfo​(@Nonnull
                                          Long id,
                                          @Nonnull
                                          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 JSONArray getBotListInfo​(@Nonnull
                                          String id,
                                          @Nonnull
                                          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 JSONArray getBotListInfo​(@Nonnull
                                          String id,
                                          @Nonnull
                                          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​(@Nonnull
                                         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​(@Nonnull
                                         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​(@Nonnull
                                  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​(@Nonnull
                                  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

    - #### getLibrary

          public String getLibrary​(@Nonnull
                                   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​(@Nonnull
                                   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​(@Nonnull
                                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​(@Nonnull
                                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​(@Nonnull
                                       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.1.13

    - #### getOAuthInvite

          public String getOAuthInvite​(@Nonnull
                                       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.1.13

    - #### getOwners

          public List<String> getOwners​(@Nonnull
                                        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​(@Nonnull
                                        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​(@Nonnull
                                  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​(@Nonnull
                                  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 Integer getServerCount​(@Nonnull
                                        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 Integer getServerCount​(@Nonnull
                                        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​(@Nonnull
                                       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​(@Nonnull
                                       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​(@Nonnull
                                   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​(@Nonnull
                                   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