Skip to content
Merged

V3.0 #19

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 29 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,36 +78,36 @@ Remember to use `.build();` at the end to create the class.

### Auto Posting
JavaBotBlockAPI allows you to post the guild counts automatically every X minutes.
To do this, you first need to get an instance of the RequestHandler and then call `.startAutoPosting(...)`.
To do this, you first need to get an instance of the PostAction and then call `.enableAutoPost(...)`.

Here is an example:
```java
RequestHandler handler = new RequestHandler();
PostAction postAction = new PostAction();

// api is the instance of the BotBlockAPI
handler.startAutoPosting(jda, api);
postAction.enableAutoPost(jda, api);
```
The delay in which you post the guild counts is set through the `.setUpdateInterval(int)` method in the BotBlockAPI.Builder().

### Cancel auto posting
To cancel the auto posting just call `.stopAutoPosting();` in the RequestHandler and it should cancel the scheduler.
To cancel the auto posting just call `.disableAutoPost();` in the RequestHandler and it should cancel the scheduler.

### Manually posting
There are methods that allow you to post the guild counts manually.
To Post your guild counts, just call the `.postGuilds(..., ...)` method in the RequestHandler.
To Post your guild counts, just call the `.postGuilds(...)` method in the PostAction.

```java
RequestHandler handler = new RequestHandler();
PostAction postAction = new PostAction();

// api is the instance of the BotBlockAPI
handler.postGuilds(jda, api);
postAction.postGuilds(jda, api);
```

## GET methods
Since version 2.0.0 of JavaBotBlockAPI can you get certain informations of a bot or the available Botlists on the BotBlock API.
Since version 2.0.0 of JavaBotBlockAPI can you get certain information of a bot or the available Bot lists on the BotBlock API.

### All available Botlists
You can call `.getBotlists()` to receive a JSONObject with all available Botlists in the BotBlockAPI.
### All available Bot lists
You can call `.getBotLists()` to receive a JSONObject with all available Botlists in the BotBlockAPI.

The returned JSONObject could look like this:
```json
Expand All @@ -133,9 +133,9 @@ The returned JSONObject could look like this:
}
```

### Single Botlist
Calling `.getBotlist(String)` returns a specific Botlist as JSONObject.
For example does `.getBotlist("lbots.org")` return the following JSONObject:
### Single Bot list
Calling `.getBotList(String, Site|String)` returns a specific Botlist as JSONObject.
For example does `.getBotList("123456789012345678", "lbots.org")` return the following JSONObject:
```json
{
"api_docs": "https://lbots.org/api/docs",
Expand All @@ -148,7 +148,9 @@ For example does `.getBotlist("lbots.org")` return the following JSONObject:
}
```

### Complete Botinfo
The first String parameter is used for the internal caching.

### Complete Bot info
Calling `.getAll(...)` returns a JSONObject from all the botlists and with some general information.

The JSONObject can look like this:
Expand Down Expand Up @@ -176,10 +178,10 @@ The JSONObject can look like this:
```

`{"data"}` is the JSON that is returned by the provided Botlist meaning it's different for each site.
`name`, `owners`, `server_count` and `invite` is based on the most common appearances of the data.
`name`, `discriminator`, `owners`, `server_count` and `invite` are based on the most common appearances of the data.

### Botinfo from all Botlists
You can call `.getBotInfos(...)` to only receive the bot info from all the Botlists.
### Bot info from all Bot lists
You can call `.getBotListInfo(...)` to only receive the bot info from all the Botlists.

The returned JSONObject can look like this:
```json
Expand All @@ -196,10 +198,18 @@ The returned JSONObject can look like this:
```
`{"data"}` is the JSON that is returned by the provided Botlist meaning it's different for each site.

### Botinfo of a single site
With `.getBotInfo(..., String)` can you receive the info of a specific site.
### Bot info of a single site
With `.getBotListInfo(..., Site|String)` can you receive the info of a specific site.
The returned data depends on the selected site and can be different for each one.

### Invite
The method `getInvite(Long|String)` allows you to get the OAuth invite of the bot.
The invite is based on the most common appearance on the different bot lists.

### Server count
`.getServerCount(Long|String)` gives you the server count of the bot.
The server count is based on the most common appearance on the different bot lists.

### Owners
You can call `.getOwners(...)` to get the owners of a Bot from all the Botlists.
The info is returned as ArrayList and is based on how often the info is provided by the botlists.
Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ plugins{
}

group = 'com.andre601'
version = '2.4.0'

version = '3.0.0'

sourceCompatibility = targetCompatibility = 1.8

Expand All @@ -24,7 +25,7 @@ dependencies{
api group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.2.2'
api group: 'org.json', name: 'json', version: '20190722'
api group: 'org.jetbrains', name: 'annotations', version: '18.0.0'
api(group: 'net.dv8tion', name: 'JDA', version: '4.0.0_60'){
api(group: 'net.dv8tion', name: 'JDA', version: '4.0.0_61'){
exclude(module: 'opus-java')
}
api group: 'com.github.ben-manes.caffeine', name: 'caffeine', version: '2.8.0'
Expand Down
31 changes: 21 additions & 10 deletions docs/allclasses-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.4) on Mon Sep 30 18:18:15 CEST 2019 -->
<!-- Generated by javadoc (11.0.4) on Thu Nov 14 15:06:58 CET 2019 -->
<title>All Classes (JavaBotBlockAPI Javadocs)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2019-09-30">
<meta name="dc.created" content="2019-11-14">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="script.js"></script>
Expand All @@ -28,7 +28,7 @@
catch(err) {
}
//-->
var data = {"i0":2,"i1":2,"i2":2,"i3":2,"i4":4};
var data = {"i0":2,"i1":2,"i2":2,"i3":2,"i4":2,"i5":2,"i6":4};
var tabs = {65535:["t0","All Classes"],2:["t2","Class Summary"],4:["t3","Enum Summary"]};
var altColor = "altColor";
var rowColor = "rowColor";
Expand Down Expand Up @@ -114,8 +114,7 @@ <h1 title="All&amp;nbsp;Classes" class="title">All&nbsp;Classes</h1>
<tr id="i0" class="altColor">
<td class="colFirst"><a href="com/andre601/javabotblockapi/BotBlockAPI.html" title="class in com.andre601.javabotblockapi">BotBlockAPI</a></td>
<th class="colLast" scope="row">
<div class="block">Class for handling the sites to post to and the delay for the auto-post option in the
<a href="com/andre601/javabotblockapi/RequestHandler.html" title="class in com.andre601.javabotblockapi"><code>RequestHandler</code></a>.</div>
<div class="block">Class used to define the auth-tokens used for the different sites.</div>
</th>
</tr>
<tr id="i1" class="rowColor">
Expand All @@ -125,21 +124,33 @@ <h1 title="All&amp;nbsp;Classes" class="title">All&nbsp;Classes</h1>
</th>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><a href="com/andre601/javabotblockapi/exceptions/RatelimitedException.html" title="class in com.andre601.javabotblockapi.exceptions">RatelimitedException</a></td>
<td class="colFirst"><a href="com/andre601/javabotblockapi/requests/GetAction.html" title="class in com.andre601.javabotblockapi.requests">GetAction</a></td>
<th class="colLast" scope="row">
<div class="block">Used when the Wrapper gets ratelimited by the BotBlockAPI.</div>
<div class="block">Class to perform GET actions with.</div>
</th>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><a href="com/andre601/javabotblockapi/RequestHandler.html" title="class in com.andre601.javabotblockapi">RequestHandler</a></td>
<td class="colFirst"><a href="com/andre601/javabotblockapi/requests/PostAction.html" title="class in com.andre601.javabotblockapi.requests">PostAction</a></td>
<th class="colLast" scope="row">
<div class="block">Class to handle post-requests to the <a href="https://botblock.org" target="_blank">BotBlock API</a>.</div>
<div class="block">Class to perform post actions with.</div>
</th>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><a href="com/andre601/javabotblockapi/exceptions/RatelimitedException.html" title="class in com.andre601.javabotblockapi.exceptions">RatelimitedException</a></td>
<th class="colLast" scope="row">
<div class="block">Used when the Wrapper gets ratelimited by the BotBlockAPI.</div>
</th>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><a href="com/andre601/javabotblockapi/RequestHandler.html" title="class in com.andre601.javabotblockapi">RequestHandler</a></td>
<th class="colLast" scope="row">Deprecated.
<div class="deprecationComment">Use <a href="com/andre601/javabotblockapi/requests/PostAction.html" title="class in com.andre601.javabotblockapi.requests"><code>PostAction</code></a> or <a href="com/andre601/javabotblockapi/requests/GetAction.html" title="class in com.andre601.javabotblockapi.requests"><code>GetAction</code></a> respectively.</div>
</th>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><a href="com/andre601/javabotblockapi/Site.html" title="enum in com.andre601.javabotblockapi">Site</a></td>
<th class="colLast" scope="row">
<div class="block">Enum class with all currently supported sites of BotBlock.org.</div>
<div class="block">Enum class containing all sites currently supported by BotBlock.org.</div>
</th>
</tr>
</table>
Expand Down
6 changes: 4 additions & 2 deletions docs/allclasses.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.4) on Mon Sep 30 18:18:15 CEST 2019 -->
<!-- Generated by javadoc (11.0.4) on Thu Nov 14 15:06:58 CET 2019 -->
<title>All Classes (JavaBotBlockAPI Javadocs)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2019-09-30">
<meta name="dc.created" content="2019-11-14">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="script.js"></script>
Expand All @@ -24,6 +24,8 @@ <h1 class="bar">All&nbsp;Classes</h1>
<ul>
<li><a href="com/andre601/javabotblockapi/BotBlockAPI.html" title="class in com.andre601.javabotblockapi">BotBlockAPI</a></li>
<li><a href="com/andre601/javabotblockapi/BotBlockAPI.Builder.html" title="class in com.andre601.javabotblockapi">BotBlockAPI.Builder</a></li>
<li><a href="com/andre601/javabotblockapi/requests/GetAction.html" title="class in com.andre601.javabotblockapi.requests">GetAction</a></li>
<li><a href="com/andre601/javabotblockapi/requests/PostAction.html" title="class in com.andre601.javabotblockapi.requests">PostAction</a></li>
<li><a href="com/andre601/javabotblockapi/exceptions/RatelimitedException.html" title="class in com.andre601.javabotblockapi.exceptions">RatelimitedException</a></li>
<li><a href="com/andre601/javabotblockapi/RequestHandler.html" title="class in com.andre601.javabotblockapi">RequestHandler</a></li>
<li><a href="com/andre601/javabotblockapi/Site.html" title="enum in com.andre601.javabotblockapi">Site</a></li>
Expand Down
8 changes: 6 additions & 2 deletions docs/allpackages-index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.4) on Mon Sep 30 18:18:15 CEST 2019 -->
<!-- Generated by javadoc (11.0.4) on Thu Nov 14 15:06:58 CET 2019 -->
<title>All Packages (JavaBotBlockAPI Javadocs)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2019-09-30">
<meta name="dc.created" content="2019-11-14">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="script.js"></script>
Expand Down Expand Up @@ -114,6 +114,10 @@ <h1 title="All&amp;nbsp;Packages" class="title">All&nbsp;Packages</h1>
<th class="colFirst" scope="row"><a href="com/andre601/javabotblockapi/exceptions/package-summary.html">com.andre601.javabotblockapi.exceptions</a></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<th class="colFirst" scope="row"><a href="com/andre601/javabotblockapi/requests/package-summary.html">com.andre601.javabotblockapi.requests</a></th>
<td class="colLast">&nbsp;</td>
</tr>
</tbody>
</table>
</li>
Expand Down
12 changes: 6 additions & 6 deletions docs/com/andre601/javabotblockapi/BotBlockAPI.Builder.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.4) on Mon Sep 30 18:18:15 CEST 2019 -->
<!-- Generated by javadoc (11.0.4) on Thu Nov 14 15:06:58 CET 2019 -->
<title>BotBlockAPI.Builder (JavaBotBlockAPI Javadocs)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2019-09-30">
<meta name="dc.created" content="2019-11-14">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
Expand Down Expand Up @@ -278,8 +278,8 @@ <h4>addAuthToken</h4>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>site</code> - The <a href="Site.html" title="enum in com.andre601.javabotblockapi"><code>Site</code></a> to get the name from.</dd>
<dd><code>token</code> - The API token from the corresponding botlist. May not be null or empty.
<br>You may receive the API token from the botlist.</dd>
<dd><code>token</code> - The API token from the corresponding bot list. May not be null or empty.
<br>You may receive the API token from the bot list.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The Builder after the site and token were set. Useful for chaining.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
Expand All @@ -305,8 +305,8 @@ <h4>addAuthToken</h4>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>site</code> - The name of the site. May not be null.
<br>A list of supported sites can be found <a href="https://botblock.org/api/docs#count" target="_blank">here</a>.</dd>
<dd><code>token</code> - The API token from the corresponding botlist. May not be null or empty.
<br>You may receive the API token from the botlist.</dd>
<dd><code>token</code> - The API token from the corresponding bot list. May not be null or empty.
<br>You may receive the API token from the bot list.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The Builder after the site and token were set. Useful for chaining.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
Expand Down
Loading