Skip to content

Commit

Permalink
Merge pull request #237 from botblock/master
Browse files Browse the repository at this point in the history
Sync development branch
  • Loading branch information
Andre601 authored May 3, 2021
2 parents 4682f29 + 1316be5 commit c3e7c06
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 96 deletions.
7 changes: 2 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Bug Report
description: Found a Bug about JavaBotBlockAPI? Use this template to report it!
labels: "Type: Bug (Unconfirmed)"
issue_body: false
body:
- type: markdown
attributes:
Expand Down Expand Up @@ -71,11 +70,9 @@ body:
description: |-
Put your code here.
This code needs to be able to reproduce the bug consistently!
placeholder: |-
value: |
```java
public void error(){
throw new Exception("ERROR");
}
```
render: "java"
validations:
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Feature Request
description: Suggest a new Feature for JavaBotBlockAPI
labels: 'Type: Enhancement'
issue_body: false
body:
- type: markdown
attributes:
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/auto_approve_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Automatically approve Pull requests

on:
pull_request:
types:
- opened
branches:
- master

jobs:
auto-approve:
runs-on: ubuntu-latest
if: ${{ github.actor == 'Andre601' }}
steps:
- uses: hmarr/auto-approve-action@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
6 changes: 4 additions & 2 deletions .github/workflows/generate_javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
- name: Set up Java 11
uses: actions/setup-java@v2
with:
java-version: 1.11
distribution: 'adopt'
java-version: '11.0.10+9'
- name: Generate Javadoc
run: ./gradlew javadoc
- name: Push changes
Expand All @@ -36,7 +37,8 @@ jobs:
- name: Set up Java 11
uses: actions/setup-java@v2
with:
java-version: 1.11
distribution: 'adopt'
java-version: '11.0.10+9'
- name: Generate Jars
run: ./gradlew build
- name: Zip files
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ The BotBlockAPI class contains a nested Builder class which allows a more stream
```java
BotBlockAPI api = new BotBlockAPI.Builder()
.addAuthToken("discordextremelist.xyz", "my_s3cr3t_t0k3n")
.addAuthToken(Site.BOTLIST_SPACE, "my_53cret_tok3n")
.addAuthToken(Site.DISCORDLIST_SPACE, "my_53cret_tok3n")
.build();
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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: 6, patch: 6)

allprojects {
apply plugin: 'maven-publish'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class Info{
/**
* Patch version of the Wrapper.
*/
public static final int PATCH = 5;
public static final int PATCH = 6;

/**
* Full version in the format {@code major.minor.patch}.
Expand Down
52 changes: 33 additions & 19 deletions core/src/main/java/org/botblock/javabotblockapi/core/Site.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ public class Site{
* <ul>
* <li>POST</li>
* </ul>
*
* @deprecated Website not responding.
*/
public static final Site ARCANE_CENTER_XYZ = new Site("arcane-center.xyz", HttpMethod.POST);
@Deprecated
@DeprecatedSince(major = 6, minor = 6, patch = 6)
@PlannedRemoval(major = 6, minor = 6, patch = 8)
public static final Site ARCANE_CENTER_XYZ = new Site("arcane-center.xyz");

/**
* <a href="https://bladebotlist.xyz" target="_blank">bladebotlist.xyz</a>
Expand All @@ -82,6 +87,17 @@ public class Site{
*/
public static final Site BLIST_XYZ = new Site("blist.xyz", HttpMethod.GET, HttpMethod.POST);

/**
* <a href="https://boatspace.xyz" target="_blank">boatspace.xyz</a>
*
* <p>Supported methods:
* <ul>
* <li>GET</li>
* <li>POST</li>
* </ul>
*/
public static final Site BOATSPACE_XYZ = new Site("boatspace.xyz", HttpMethod.GET, HttpMethod.POST);

/**
* <a href="https://botsdatabase.com" target="_blank">botsdatabase.com</a>
*
Expand All @@ -90,8 +106,13 @@ public class Site{
* <li>GET</li>
* <li>POST</li>
* </ul>
*
* @deprecated Website not responding.
*/
public static final Site BOTSDATABASE_COM = new Site("botsdatabase.com", HttpMethod.GET, HttpMethod.POST);
@Deprecated
@DeprecatedSince(major = 6, minor = 6, patch = 6)
@PlannedRemoval(major = 6, minor = 6, patch = 8)
public static final Site BOTSDATABASE_COM = new Site("botsdatabase.com");

/**
* <a href="https://bots.discordlabs.org" target="_blank">bots.discordlabs.org</a>
Expand Down Expand Up @@ -146,23 +167,6 @@ public class Site{
*/
public static final Site DISCORD_BOATS = new Site("discord.boats", HttpMethod.GET, HttpMethod.POST);

/**
* <a href="https://discordbotdirectory.net" target="_blank">discordbotdirectory.net</a>
*
* <p>Supported methods:
* <ul>
* <li>GET</li>
* </ul>
*
* @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");

/**
* <a href="https://discordbotlist.com" target="_blank">discordbotlist.com</a>
*
Expand Down Expand Up @@ -231,6 +235,16 @@ public class Site{
*/
public static final Site DISCORDLIST_SPACE = new Site("discordlist.space", HttpMethod.GET, HttpMethod.POST);

/**
* <a href="https://discordservices.net" target="_blank">discordservices.net</a>
*
* <p>Supported methods:
* <ul>
* <li>POST</li>
* </ul>
*/
public static final Site DISCORDSERVICES_NET = new Site("discordservices.net", HttpMethod.POST);

/**
* <a href="https://disforge.com" target="_blank">disforge.com</a>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,36 +124,8 @@ public GetBotAction(boolean disableCache, @Nonnull String userAgent, @Nonnull St
/**
* Gets the full information of a bot.
*
* <p>The JSONObject may look like this:
* <br><pre><code>
* {
* "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
* ]
* }
* }
* </code></pre>
* <br>With exception of id and list_data are all returned values based on how often one appears.
* <br>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:<br>
* <a href="https://gist.github.com/Andre601/b18b1c4e88e9a405806ce7b6c29a0136" target="_blank">https://gist.github.com/Andre601/b18b1c4e88e9a405806ce7b6c29a0136</a>
*
* <p>Following Exceptions can be thrown from the HTTP request:
* <ul>
Expand All @@ -167,43 +139,15 @@ public GetBotAction(boolean disableCache, @Nonnull String userAgent, @Nonnull St
* @return Possibly-null {@link org.json.JSONObject JSONObject} containing the full information of the bot.
*/
@Nullable
public JSONObject getBotInfo(@Nonnull Long id){
public JSONObject getBotInfo(long id){
return getBotInfo(String.valueOf(id));
}

/**
* Gets the full information of a bot.
*
* <p>The JSONObject may look like this:
* <br><pre><code>
* {
* "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
* ]
* }
* }
* </code></pre>
* <br>With exception of id and list_data are all returned values based on how often one appears.
* <br>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:<br>
* <a href="https://gist.github.com/Andre601/b18b1c4e88e9a405806ce7b6c29a0136" target="_blank">https://gist.github.com/Andre601/b18b1c4e88e9a405806ce7b6c29a0136</a>
*
* <p>Following Exceptions can be thrown from the CheckUtil:
* <ul>
Expand Down Expand Up @@ -248,7 +192,7 @@ public JSONObject getBotInfo(@Nonnull String id){
* @return Possibly-null {@link org.json.JSONObject JSONObject} containing information from the different bot list.
*/
@Nullable
public JSONObject getBotListInfo(@Nonnull Long id){
public JSONObject getBotListInfo(long id){
return getBotListInfo(String.valueOf(id));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void performPOST(@Nonnull JSONObject json, int sites) throws IOException{
response.protocol(),
response.code(),
response.message(),
response.headers().toString()
response.headers()
);
return;
}
Expand All @@ -155,7 +155,7 @@ public void performPOST(@Nonnull JSONObject json, int sites) throws IOException{
response.protocol(),
response.code(),
response.message(),
response.headers().toString()
response.headers()
);
return;
}
Expand Down Expand Up @@ -213,7 +213,7 @@ private JSONObject performGET(@Nonnull String url, String header) throws IOExcep
response.protocol(),
response.code(),
response.message(),
response.headers().toString()
response.headers()
);
return null;
}
Expand All @@ -227,7 +227,7 @@ private JSONObject performGET(@Nonnull String url, String header) throws IOExcep
response.protocol(),
response.code(),
response.message(),
response.headers().toString()
response.headers()
);
return null;
}
Expand Down

0 comments on commit c3e7c06

Please sign in to comment.