diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..6c383277 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,35 @@ +name-template: "v$RESOLVED_VERSION: " +tag-template: "$RESOLVED_VERSION" +prerelease: false +publish: false +exclude-labels: +- "Action: No Changelog" + +category_template: "### $TITLE" +categories: +- title: "🚀 Features" + labels: + - "Type: Enhancement" +- title: "🐛 Bug fixes" + labels: + - "Type: Bug (Confirmed)" +- title: "🔧 Dependencies" + labels: + - "Type: Dependency update" + +change-template: "- [#$NUMBER]: **$TITLE**" + +version-resolver: + major: + labels: + - "Action: Update Major" + minor: + labels: + - "Action: Update Minor" + patch: + labels: + - "Action: Update Patch" + default: patch +template: | + ## Release Notes + $CHANGES diff --git a/.github/workflows/auto_approve_pr.yml b/.github/workflows/auto_approve_pr.yml index d9c5dc8d..1d98d72b 100644 --- a/.github/workflows/auto_approve_pr.yml +++ b/.github/workflows/auto_approve_pr.yml @@ -1,7 +1,7 @@ name: Automatically approve Pull requests on: - pull_request: + pull_request_target: types: - opened branches: diff --git a/.github/workflows/gen_javadocs.yml b/.github/workflows/gen_javadocs.yml new file mode 100644 index 00000000..5fb91ee3 --- /dev/null +++ b/.github/workflows/gen_javadocs.yml @@ -0,0 +1,27 @@ +name: Build Javadocs + +on: + workflow_dispatch: + +jobs: + generateJavadoc: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v2.3.4 + with: + ref: 'master' + - name: Set up Java 11 + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: '11' + - name: Generate Javadoc + run: ./gradlew javadoc + - name: Push changes + uses: peaceiris/actions-gh-pages@v3.8.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs + commit_message: "Update Docs" + enable_jekyll: true diff --git a/.github/workflows/release_drafter.yml b/.github/workflows/release_drafter.yml new file mode 100644 index 00000000..82ec7805 --- /dev/null +++ b/.github/workflows/release_drafter.yml @@ -0,0 +1,18 @@ + +name: Release notes + +on: + push: + branches: + - master + pull_request_target: + branches: + - master + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle b/build.gradle index 228583f2..4a8ede93 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins{ id 'com.github.johnrengelman.shadow' version '5.2.0' } -def ver = new Version(major: 6, minor: 6, patch: 5) +def ver = new Version(major: 6, minor: 7, patch: 4) allprojects { apply plugin: 'maven-publish' @@ -21,7 +21,7 @@ allprojects { dependencies { api group: 'org.json', name: 'json', version: '20210307' - api group: 'com.github.ben-manes.caffeine', name: 'caffeine', version: '2.8.0' + api group: 'com.github.ben-manes.caffeine', name: 'caffeine', version: '3.0.2' api group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2' api group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30' @@ -87,6 +87,7 @@ allprojects { repositories { mavenCentral() jcenter() + maven { url = 'https://m2.dv8tion.net/releases' } } build { diff --git a/core/src/main/java/org/botblock/javabotblockapi/core/BotBlockAPI.java b/core/src/main/java/org/botblock/javabotblockapi/core/BotBlockAPI.java index 31068482..d460f704 100644 --- a/core/src/main/java/org/botblock/javabotblockapi/core/BotBlockAPI.java +++ b/core/src/main/java/org/botblock/javabotblockapi/core/BotBlockAPI.java @@ -88,6 +88,10 @@ public Builder addAuthToken(@Nonnull Site site, @Nonnull String token){ CheckUtil.notEmpty(token, "Token"); CheckUtil.condition(!site.supportsPost(), site.getName() + " does not support POST requests!"); + // Discordlist.space requires the token to start with "Bot " + if(site.getName().equals("discordlist.space") && !token.startsWith("Bot ")) + token = "Bot " + token; + tokens.put(site.getName(), token); return this; } @@ -113,6 +117,10 @@ public Builder addAuthToken(@Nonnull Site site, @Nonnull String token){ public Builder addAuthToken(@Nonnull String site, @Nonnull String token){ CheckUtil.notEmpty(site, "Site"); CheckUtil.notEmpty(token, "Token"); + + // Discordlist.space requires the token to start with "Bot " + if(site.equals("discordlist.space") && !token.startsWith("Bot ")) + token = "Bot " + token; tokens.put(site, token); return this; diff --git a/core/src/main/java/org/botblock/javabotblockapi/core/Info.java b/core/src/main/java/org/botblock/javabotblockapi/core/Info.java index 242ddead..b60d6587 100644 --- a/core/src/main/java/org/botblock/javabotblockapi/core/Info.java +++ b/core/src/main/java/org/botblock/javabotblockapi/core/Info.java @@ -35,11 +35,11 @@ public class Info{ /** * Minor version of the Wrapper. */ - public static final int MINOR = 6; + public static final int MINOR = 7; /** * Patch version of the Wrapper. */ - public static final int PATCH = 5; + public static final int PATCH = 4; /** * Full version in the format {@code major.minor.patch}. diff --git a/core/src/main/java/org/botblock/javabotblockapi/core/Site.java b/core/src/main/java/org/botblock/javabotblockapi/core/Site.java index 2ddffc77..5f543c3b 100644 --- a/core/src/main/java/org/botblock/javabotblockapi/core/Site.java +++ b/core/src/main/java/org/botblock/javabotblockapi/core/Site.java @@ -48,16 +48,6 @@ */ public class Site{ - /** - * arcane-center.xyz - * - *

Supported methods: - *

- */ - public static final Site ARCANE_CENTER_XYZ = new Site("arcane-center.xyz", HttpMethod.POST); - /** * bladebotlist.xyz * @@ -83,15 +73,28 @@ public class Site{ public static final Site BLIST_XYZ = new Site("blist.xyz", HttpMethod.GET, HttpMethod.POST); /** - * botsdatabase.com - * + * boatspace.xyz + * + *

Supported methods: + *

+ */ + public static final Site BOATSPACE_XYZ = new Site("boatspace.xyz", HttpMethod.GET, HttpMethod.POST); + + /** + * botlist.me + * *

Supported methods: *

+ * + * @since 6.7.2 */ - public static final Site BOTSDATABASE_COM = new Site("botsdatabase.com", HttpMethod.GET, HttpMethod.POST); + public static final Site BOTLIST_ME = new Site("botlist.me", HttpMethod.GET, HttpMethod.POST); /** * bots.discordlabs.org @@ -112,8 +115,13 @@ public class Site{ *
  • GET
  • *
  • POST
  • * + * + * @deprecated List was aquired by {@link #DISCORDS_COM discords.com} */ - public static final Site BOTSFORDISCORD_COM = new Site("botsfordiscord.com", HttpMethod.GET, HttpMethod.POST); + @Deprecated + @DeprecatedSince(major = 6, minor = 7, patch = 4, replacements = "DISCORDS_COM") + @PlannedRemoval(major = 6, minor = 7, patch = 6) + public static final Site BOTSFORDISCORD_COM = new Site("botsfordiscord.com"); /** * bots.ondiscord.xyz @@ -146,23 +154,6 @@ public class Site{ */ public static final Site DISCORD_BOATS = new Site("discord.boats", HttpMethod.GET, HttpMethod.POST); - /** - * discordbotdirectory.net - * - *

    Supported methods: - *

    - * - * @deprecated Site no longer exists. - * - * @since 6.3.0 - */ - @Deprecated - @DeprecatedSince(major = 6, minor = 6, patch = 4) - @PlannedRemoval(major = 6, minor = 6, patch = 6) - public static final Site DISCORDBOTDIRECTORY_NET = new Site("discordbotdirectory.net"); - /** * discordbotlist.com * @@ -231,6 +222,27 @@ public class Site{ */ public static final Site DISCORDLIST_SPACE = new Site("discordlist.space", HttpMethod.GET, HttpMethod.POST); + /** + * discords.com formerly botsfordiscord.com + * + *

    Supported methods: + *

    + */ + public static final Site DISCORDS_COM = new Site("discords.com", HttpMethod.GET, HttpMethod.POST); + + /** + * discordservices.net + * + *

    Supported methods: + *

    + */ + public static final Site DISCORDSERVICES_NET = new Site("discordservices.net", HttpMethod.POST); + /** * disforge.com * @@ -265,6 +277,30 @@ public class Site{ */ public static final Site INFINITYBOTLIST_XYZ = new Site("infinitybotlist.xyz", HttpMethod.GET, HttpMethod.POST); + /** + * listcord.gg + * + *

    Supported methods: + *

    + */ + public static final Site LISTCORD_GG = new Site("listcord.gg", HttpMethod.GET, HttpMethod.POST); + + /** + * motiondevelopment.top + * + *

    Supported methods: + *

    + * + * @since 6.7.2 + */ + public static final Site MOTIONDEVELOPMENT_TOP = new Site("motiondevelopment.top", HttpMethod.GET, HttpMethod.POST); + /** * paradisebots.net * @@ -278,6 +314,19 @@ public class Site{ */ public static final Site PARADISEBOTS_NET = new Site("paradisebots.net", HttpMethod.GET, HttpMethod.POST); + /** + * radarbotdirectory.xyz + * + *

    Supported methods: + *

    + * + * @since 6.7.2 + */ + public static final Site RADARBOTDIRECTORY_XYZ = new Site("radarbotdirectory.xyz", HttpMethod.GET, HttpMethod.POST); + /** * space-bot-list.xyz * @@ -289,6 +338,18 @@ public class Site{ */ public static final Site SPACE_BOT_LIST_XYZ = new Site("space-bot-list.xyz", HttpMethod.GET, HttpMethod.POST); + /** + * stellarbotlist.com + * + *

    Supported methods: + *

    + * + * @since 6.7.2 + */ + public static final Site STELLARBOTLIST_COM = new Site("stellarbotlist.com", HttpMethod.GET); + /** * topcord.xyz * @@ -300,6 +361,19 @@ public class Site{ */ public static final Site TOPCORD_XYZ = new Site("topcord.xyz", HttpMethod.GET, HttpMethod.POST); + /** + * vcodes.xyz + * + *

    Supported methods: + *

    + * + * @since 6.7.2 + */ + public static final Site VCODES_XYZ = new Site("vcodes.xyz", HttpMethod.GET, HttpMethod.POST); + /** * voidbots.net * @@ -348,7 +422,7 @@ private Site(String name){ /** * The name used by the BotBlock API to identify the site. - *
    The name usually is just the domain of the site without the http(s):// in front of it. + *
    The name usually represents the domain of the bot list without the https in front of it. * * @return The name of the site used for the BotBlock API. */ @@ -374,6 +448,12 @@ public boolean supportsPost(){ return !methods.isEmpty() && methods.contains(HttpMethod.POST); } + /** + * Nested enum for the Http-methods supported by the bot lists. + * + *

    Depending on what Http-Methods a bot list supports can its corresponding entry be used for the GET methods, + * POST methods or both. + */ public enum HttpMethod{ /** * Bot list supports GET requests. diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 0b7a14e9..00000000 --- a/docs/index.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JavaBotBlockAPI | Java Wrapper for the BotBlock API - - - - - - - - - -

    - -
    -
    -
    -
    -
    -

    JavaBotBlockAPI

    -
    -
    -
    -
    -
    -
    -
    -

    About

    -

    JavaBotBlockAPI is the official Java Wrapper for the BotBlock API. -
    It supports all GET and POST requests that the BotBlock API offers. - -

    Modules

    -

    The Wrapper is split up into different modules to allow you more control about what you need. -
    Current modules incude: -

      -
    • Core The main module needed for everything else.
    • -
    • Javacord Module to add support for the Javacord Library
    • -
    • JDA Module to add support for the JDA Library
    • -
    • Request Module for GET and POST requests from/to the BotBlock API. Javacord and JDA Module depend on this.
    • -
    - -

    Support

    -

    If you require support with this Wrapper, join Andre's Support Server. -
    For help regarding the BotBlock API itself should you join the BotBlock Discord Server. -
    The BotBlock Discord also has a #api Channel where you can ask for support regarding this wrapper. - -

    Do NOT contact (Ping or DM) BotBlock Staff for questions regarding this wrapper! -

    -
    -
    -
    -
    -
    -
    - -
    - - - - \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000..9691e9bf --- /dev/null +++ b/docs/index.md @@ -0,0 +1,75 @@ +# JavaBotBlockAPI +A Java Wrapper for the BotBlock.org API, supporting all API endpoints of it. + +## Javadocs +Below can you find Javadocs for each module. + +- [Core](https://docs.botblock.org/JavaBotBlockAPI/core/) +- [Javacord](https://docs.botblock.org/JavaBotBlockAPI/javacord/org/botblock/javabotblockapi/javacord/package-summary.html) +- [JDA](https://docs.botblock.org/JavaBotBlockAPI/jda/org/botblock/javabotblockapi/jda/package-summary.html) +- [Request](https://docs.botblock.org/JavaBotBlockAPI/request/org/botblock/javabotblockapi/requests/package-summary.html) + +## Installation +Please replace `{version}` with the latest build available on [CodeMC](https://ci.codemc.io/job/botblock/job/JavaBotBlockAPI/). + +### Gradle +```groovy +repositories{ + maven{ url = 'https://repo.codemc.io/repository/maven-public' } +} + +dependencies{ + // The Core and Request modules are always required. + compile group: 'org.botblock', name: 'javabotblockapi-core', version: '{version}' + compile group: 'org.botblock', name: 'javabotblockapi-request', version: '{version}' + + // Javacord module for direct support with Javacord. + compile group: 'org.botblock', name: 'javabotblockapi-javacord', version: '{version}' + + // JDA module for direct support with JDA. + compile group: 'org.botblock', name: 'javabotblockapi-jda', version: '{version}' +} +``` + +### Maven +```xml + + + codemc + https://repo.codemc.io/repository/maven-public/ + + + + + + + org.botblock + javabotblockapi-core + {version} + + + + org.botblock + javabotblockapi-request + {version} + + + + org.botblock + javabotblockapi-javacord + {version} + + + + org.botblock + javabotblockapi-jda + {version} + + +``` + +## Links + +- [BotBlock Documentation](https://botblock.org/docs) +- [BotBlock Discord](https://botblock.org/discord) (**Do NOT ask BotBlock-Staff for help with this API Wrapper**) +- [Andre's Support Discord](https://discord.gg/6dazXp6) (Ask in the `#javabotblockapi` channel) diff --git a/jda/build.gradle b/jda/build.gradle index 27635dd2..ceac9153 100644 --- a/jda/build.gradle +++ b/jda/build.gradle @@ -1,5 +1,5 @@ dependencies { - api(group: 'net.dv8tion', name: 'JDA', version: '4.2.0_247'){ + api(group: 'net.dv8tion', name: 'JDA', version: '4.3.0_280'){ exclude(module: 'opus-java') } implementation project(":core") diff --git a/request/src/main/java/org/botblock/javabotblockapi/requests/GetBotAction.java b/request/src/main/java/org/botblock/javabotblockapi/requests/GetBotAction.java index e455da44..fc5d57b6 100644 --- a/request/src/main/java/org/botblock/javabotblockapi/requests/GetBotAction.java +++ b/request/src/main/java/org/botblock/javabotblockapi/requests/GetBotAction.java @@ -124,36 +124,8 @@ public GetBotAction(boolean disableCache, @Nonnull String userAgent, @Nonnull St /** * 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":{@literal "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. + * An example of how the returned JSON may look like can be found here:
    + * https://gist.github.com/Andre601/b18b1c4e88e9a405806ce7b6c29a0136 * *

    Following Exceptions can be thrown from the HTTP request: *