Skip to content

Commit d13e940

Browse files
committed
Let's go for 5.0.0
1 parent 49211b5 commit d13e940

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1977
-296
lines changed

.all-contributorsrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"files": [
3-
"README.md",
43
"contributors.md"
54
],
65
"imageSize": 100,

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,30 @@ dependencies{
7878
```
7979
</details>
8080

81+
____
82+
## v5
83+
- ### 5.0.0
84+
- Deprecated `GetAction`
85+
- It is now split up into `GetBotAction` and `GetListAction`
86+
- Many new methods for `/api/lists` endpoint.
87+
- `getApiField(String, Site|String, ApiField)`
88+
- `getBotWidgetUrl(String, Site|String)`
89+
- `getDescription(String, Site|String)`
90+
- `getDiscordInvite(String, Site|String)`
91+
- `getFeatures(String, Site|String)`
92+
- `getFilteredList(String)`
93+
- `getIcon(String, Site|String)`
94+
- `getId(String, Site|String)`
95+
- `getLanguage(String, Site|String)`
96+
- `getList(String, Site|String)`
97+
- `getLists(String)`
98+
- `getName(String, Site|String)`
99+
- `getOwners(String, Site|String)`
100+
- `getTimeAdded(String, Site|String)`
101+
- `getUrl(String, Site|String)`
102+
- `isDefunct(String, Site|String)`
103+
- `isDiscordOnly(String, Site|String)`
104+
81105
____
82106
## v4
83107
- ### v4.0.0_0

README.md

Lines changed: 4 additions & 198 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,8 @@
2525
[JetBrains annotations]: https://github.com/JetBrains/java-annotations
2626
[Caffeine]: https://github.com/ben-manes/caffeine
2727

28-
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
29-
[contributorsBadge]: https://img.shields.io/badge/Contributors_✨-3-green.svg?style=plastic
30-
<!-- ALL-CONTRIBUTORS-BADGE:END -->
31-
3228
![image]
3329

34-
[![contributorsBadge]](#contributors-)
35-
3630
JavaBotBlockAPI is a continued and updated Java Wrapper for [BotBlock], a website that makes it possible to update guild counts on multiple lists with one API.
3731
This wrapper is a fork of [BotBlock4J] and was updated and improved to make it as userfriendly as possible.
3832

@@ -67,180 +61,9 @@ For maven use this code snippet:
6761
```
6862

6963
# Usage
70-
To use the Wrapper you have to follow these steps.
71-
72-
## Notes
73-
In the below examples do I use a JDA instance called `jda`.
74-
This will also work with ShardManager.
75-
76-
## POST methods
77-
You can post you guild counts to the different Botlists using the BotBlock API.
78-
79-
### Creating an instance of BotBlockAPI
80-
For posting your guild counts towards the BotBlock API you first need to create an instance of the BotBlockAPI class.
81-
To do this it's recommended to use `BotBlockAPI.Builder()`.
82-
83-
Here is an example of how it could look like.
84-
```java
85-
BotBlockAPI api = new BotBlockAPI.Builder()
86-
.addAuthToken("lbots.org", "MySecretToken123")
87-
.addAuthToken("botlist.space", "MySecretToken456")
88-
.build();
89-
```
90-
Remember to use `.build();` at the end to create the class.
91-
92-
### Auto Posting
93-
JavaBotBlockAPI allows you to post the guild counts automatically every X minutes.
94-
To do this, you first need to get an instance of the PostAction and then call `.enableAutoPost(...)`.
95-
96-
Here is an example:
97-
```java
98-
PostAction postAction = new PostAction();
99-
100-
// api is the instance of the BotBlockAPI
101-
postAction.enableAutoPost(jda, api);
102-
```
103-
The delay in which you post the guild counts is set through the `.setUpdateInterval(int)` method in the BotBlockAPI.Builder().
64+
Please visit the [wiki] for all available POST and GET methods, as the amount of GET methods alone is quite large.
10465

105-
### Cancel auto posting
106-
To cancel the auto posting just call `.disableAutoPost();` in the RequestHandler and it should cancel the scheduler.
107-
108-
### Manually posting
109-
There are methods that allow you to post the guild counts manually.
110-
To Post your guild counts, just call the `.postGuilds(...)` method in the PostAction.
111-
112-
```java
113-
PostAction postAction = new PostAction();
114-
115-
// api is the instance of the BotBlockAPI
116-
postAction.postGuilds(jda, api);
117-
```
118-
119-
## GET methods
120-
Since version 2.0.0 of JavaBotBlockAPI can you get certain information of a bot or the available Bot lists on the BotBlock API.
121-
All methods listed below can be used through the `GetAction` class.
122-
123-
### All available Bot lists
124-
You can call `.getBotLists()` to receive a JSONObject with all available Botlists in the BotBlockAPI.
125-
126-
The returned JSONObject could look like this:
127-
```json
128-
{
129-
"botlist.space": {
130-
"api_docs": "https://docs.botlist.space",
131-
"api_post": "https://api.botlist.space/v1/bots/:id",
132-
"api_field": "server_count",
133-
"api_shard_id": null,
134-
"api_shard_count": null,
135-
"api_shards": "shards",
136-
"api_get": "https://api.botlist.space/v1/bots/:id"
137-
},
138-
"lbots.org": {
139-
"api_docs": "https://lbots.org/api/docs",
140-
"api_post": "https://lbots.org/api/v1/bots/:id/stats",
141-
"api_field": "guild_count",
142-
"api_shard_id": "shard_id",
143-
"api_shard_count": "shard_count",
144-
"api_shards": null,
145-
"api_get": null
146-
}
147-
}
148-
```
149-
150-
### Single Bot list
151-
Calling `.getBotList(String, Site|String)` returns a specific Botlist as JSONObject.
152-
For example does `.getBotList("123456789012345678", "lbots.org")` return the following JSONObject:
153-
```json
154-
{
155-
"api_docs": "https://lbots.org/api/docs",
156-
"api_post": "https://lbots.org/api/v1/bots/:id/stats",
157-
"api_field": "guild_count",
158-
"api_shard_id": "shard_id",
159-
"api_shard_count": "shard_count",
160-
"api_shards": null,
161-
"api_get": null
162-
}
163-
```
164-
165-
The first String parameter is used for the internal caching.
166-
167-
### Complete Bot info
168-
Calling `.getBotInfo(Long|String)` returns a JSONObject from all the botlists and with some general information.
169-
170-
The JSONObject can look like this:
171-
```json
172-
{
173-
"id": "123456789012345678",
174-
"name": "MyBot",
175-
"discriminator": "1234",
176-
"owners": [
177-
"234567890123456789"
178-
],
179-
"server_count": 100,
180-
"invite": "https://discordapp.com/oauth2/authorize?client_id=123456789012345678&scope=bot",
181-
"list_data": {
182-
"botlist.space": [
183-
{"data"},
184-
200
185-
],
186-
"lbots.org": [
187-
{"data"},
188-
404
189-
]
190-
}
191-
}
192-
```
193-
194-
`{"data"}` is the JSON that is returned by the provided Botlist meaning it's different for each site.
195-
`name`, `discriminator`, `owners`, `server_count` and `invite` are based on the most common appearances of the data.
196-
197-
### Bot info from all Bot lists
198-
You can call `.getBotListInfo(Long|String)` to only receive the bot info from all the Botlists.
199-
200-
The returned JSONObject can look like this:
201-
```json
202-
{
203-
"botlist.space": [
204-
{"data"},
205-
200
206-
],
207-
"lbots.org": [
208-
{"data"},
209-
404
210-
]
211-
}
212-
```
213-
`{"data"}` is the JSON that is returned by the provided Botlist meaning it's different for each site.
214-
215-
### Bot info of a single site
216-
With `.getBotListInfo(Long|String, Site|String)` can you receive the info of a specific site.
217-
The returned data depends on the selected site and can be different for each one.
218-
219-
### Invite
220-
The method `.getInvite(Long|String)` allows you to get the OAuth invite of the bot.
221-
The invite is based on the most common appearance on the different bot lists.
222-
223-
### Server count
224-
`.getServerCount(Long|String)` gives you the server count of the bot.
225-
The server count is based on the most common appearance on the different bot lists.
226-
227-
### Owners
228-
You can call `.getOwners(Long|String)` to get the owners of a Bot from all the Botlists.
229-
The info is returned as ArrayList and is based on how often the info is provided by the botlists.
230-
231-
## Exceptions
232-
When you post the guild counts could you encounter certain Exceptions.
233-
You can receive the following exceptions:
234-
- `IOException`
235-
The Request couldn't be performed properly. This can be f.e. the case when BotBlock.org denies access (403).
236-
- `RatelimitedException`
237-
When we exceed the ratelimit of BotBlock.org
238-
This is usually not the case when using the auto-post method because of the minimal delay being 2 minutes.
239-
The GET method would also not call this as the result is cached for 2 minutes (unless disabled).
240-
- `NullPointerException`
241-
Thrown when BotBlock.org sends an empty response, meaning something got messed up on their side.
242-
243-
# Libraries
66+
# Libraries/Dependencies
24467
JavaBotBlockAPI utilizes different APIs to provide the functionality it offers right now.
24568
We have a list of those libraries listed here.
24669
- [JDA] - Java library used for creating bots.
@@ -259,22 +82,5 @@ Here are some useful links:
25982
- [BotBlock4J] Original Wrapper from which this one originates.
26083

26184
## Contributors ✨
262-
263-
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
264-
265-
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
266-
<!-- prettier-ignore-start -->
267-
<!-- markdownlint-disable -->
268-
<table>
269-
<tr>
270-
<td align="center"><a href="https://tkachuk.tech"><img src="https://avatars1.githubusercontent.com/u/1907079?v=4" width="100px;" alt=""/><br /><sub><b>Dave</b></sub></a><br /><a href="#ideas-DavidRockin" title="Ideas, Planning, & Feedback">🤔</a></td>
271-
<td align="center"><a href="http://linkedin.dv8tion.net"><img src="https://avatars1.githubusercontent.com/u/1479909?v=4" width="100px;" alt=""/><br /><sub><b>Austin Keener</b></sub></a><br /><a href="#plugin-DV8FromTheWorld" title="Plugin/utility libraries">🔌</a></td>
272-
<td align="center"><a href="https://ci.codemc.io/"><img src="https://avatars2.githubusercontent.com/u/37156340?v=4" width="100px;" alt=""/><br /><sub><b>CodeMC</b></sub></a><br /><a href="#infra-CodeMC" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
273-
</tr>
274-
</table>
275-
276-
<!-- markdownlint-enable -->
277-
<!-- prettier-ignore-end -->
278-
<!-- ALL-CONTRIBUTORS-LIST:END -->
279-
280-
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
85+
We appreciate any contribution from others towards this project.
86+
All contributors are listed on the [contributors.md] file.

contributors.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
2+
[contributorsBadge]: https://img.shields.io/badge/Contributors_✨-3-green.svg?style=plastic
3+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
4+
15
# Contributors
6+
![contributorsBadge]
7+
28
We appreciate any kind of contribution to the JavaBotBlockAPI, as it is our goal to improve over time.
39

410
Contributions aren't just limited to PRs or code examples.
@@ -16,6 +22,8 @@ Suggesting new featires, improvements or giving general feedback.
1622
Developes a library used by this project.
1723
- 🚇 (Infra)
1824
Provides a site, service or similar that is used by the project (e.g. CI-Server).
25+
- 🚧 (Maintenance)
26+
Helps maintaining this project, being it updating dependencies, or adding new features.
1927

2028
# List of current contributors
2129
Below can you find a list of all currently aknowledged Contributors to our project.

docs/allclasses-index.html

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- NewPage -->
33
<html lang="de">
44
<head>
5-
<!-- Generated by javadoc (11.0.4) on Mon Jan 13 00:18:16 CET 2020 -->
5+
<!-- Generated by javadoc (11.0.4) on Mon Jan 13 15:43:58 CET 2020 -->
66
<title>All Classes (JavaBotBlockAPI 4.3.0 API)</title>
77
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
88
<meta name="dc.created" content="2020-01-13">
@@ -28,7 +28,7 @@
2828
catch(err) {
2929
}
3030
//-->
31-
var data = {"i0":2,"i1":2,"i2":32,"i3":2,"i4":2,"i5":2,"i6":4};
31+
var data = {"i0":2,"i1":2,"i2":32,"i3":2,"i4":2,"i5":2,"i6":4,"i7":2,"i8":2,"i9":4};
3232
var tabs = {65535:["t0","All Classes"],2:["t2","Class Summary"],4:["t3","Enum Summary"],32:["t6","Annotation Types Summary"]};
3333
var altColor = "altColor";
3434
var rowColor = "rowColor";
@@ -131,24 +131,43 @@ <h1 title="All&amp;nbsp;Classes" class="title">All&nbsp;Classes</h1>
131131
</tr>
132132
<tr id="i3" class="rowColor">
133133
<td class="colFirst"><a href="org/botblock/javabotblockapi/requests/GetAction.html" title="class in org.botblock.javabotblockapi.requests">GetAction</a></td>
134-
<th class="colLast" scope="row">
135-
<div class="block">Class to perform GET actions with.</div>
134+
<th class="colLast" scope="row">Deprecated.
135+
<div class="deprecationComment">Use <a href="org/botblock/javabotblockapi/requests/GetBotAction.html" title="class in org.botblock.javabotblockapi.requests"><code>GetBotAction</code></a> for Bot related and
136+
<a href="org/botblock/javabotblockapi/requests/GetListAction.html" title="class in org.botblock.javabotblockapi.requests"><code>GetListAction</code></a> for List related actions.</div>
136137
</th>
137138
</tr>
138139
<tr id="i4" class="altColor">
140+
<td class="colFirst"><a href="org/botblock/javabotblockapi/requests/GetBotAction.html" title="class in org.botblock.javabotblockapi.requests">GetBotAction</a></td>
141+
<th class="colLast" scope="row">
142+
<div class="block">Class used to perform GET actions on the <a href="https://botblock.org/api/docs#bots" target="_blank"><code>/bots/:id</code> endpoint</a>.</div>
143+
</th>
144+
</tr>
145+
<tr id="i5" class="rowColor">
146+
<td class="colFirst"><a href="org/botblock/javabotblockapi/requests/GetListAction.html" title="class in org.botblock.javabotblockapi.requests">GetListAction</a></td>
147+
<th class="colLast" scope="row">
148+
<div class="block">Class used to perform GET actions on the <a href="https://botblock.org/api/docs#lists" target="_blank"><code>/lists</code> endpoint</a>.</div>
149+
</th>
150+
</tr>
151+
<tr id="i6" class="altColor">
152+
<td class="colFirst"><a href="org/botblock/javabotblockapi/requests/GetListAction.ApiField.html" title="enum in org.botblock.javabotblockapi.requests">GetListAction.ApiField</a></td>
153+
<th class="colLast" scope="row">
154+
<div class="block">Enum containing the different API fields a bot list may have.</div>
155+
</th>
156+
</tr>
157+
<tr id="i7" class="rowColor">
139158
<td class="colFirst"><a href="org/botblock/javabotblockapi/requests/PostAction.html" title="class in org.botblock.javabotblockapi.requests">PostAction</a></td>
140159
<th class="colLast" scope="row">
141160
<div class="block">Class to perform post actions with.</div>
142161
</th>
143162
</tr>
144-
<tr id="i5" class="rowColor">
163+
<tr id="i8" class="altColor">
145164
<td class="colFirst"><a href="org/botblock/javabotblockapi/exceptions/RatelimitedException.html" title="class in org.botblock.javabotblockapi.exceptions">RatelimitedException</a></td>
146165
<th class="colLast" scope="row">
147166
<div class="block">Indicates that the Java-Wrapper (Bot) was rate-limited by BotBlock.org (Received error code 429)
148167
<br>The returned error message contains the route, Bot ID, IP and delay for when rate limit is removed.</div>
149168
</th>
150169
</tr>
151-
<tr id="i6" class="altColor">
170+
<tr id="i9" class="rowColor">
152171
<td class="colFirst"><a href="org/botblock/javabotblockapi/Site.html" title="enum in org.botblock.javabotblockapi">Site</a></td>
153172
<th class="colLast" scope="row">
154173
<div class="block">Enum class containing all sites currently supported by BotBlock.org.</div>

docs/allclasses.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- NewPage -->
33
<html lang="de">
44
<head>
5-
<!-- Generated by javadoc (11.0.4) on Mon Jan 13 00:18:16 CET 2020 -->
5+
<!-- Generated by javadoc (11.0.4) on Mon Jan 13 15:43:58 CET 2020 -->
66
<title>All Classes (JavaBotBlockAPI 4.3.0 API)</title>
77
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
88
<meta name="dc.created" content="2020-01-13">
@@ -26,6 +26,9 @@ <h1 class="bar">All&nbsp;Classes</h1>
2626
<li><a href="org/botblock/javabotblockapi/BotBlockAPI.Builder.html" title="class in org.botblock.javabotblockapi">BotBlockAPI.Builder</a></li>
2727
<li><a href="org/botblock/javabotblockapi/annotations/DeprecatedSince.html" title="annotation in org.botblock.javabotblockapi.annotations">DeprecatedSince</a></li>
2828
<li><a href="org/botblock/javabotblockapi/requests/GetAction.html" title="class in org.botblock.javabotblockapi.requests">GetAction</a></li>
29+
<li><a href="org/botblock/javabotblockapi/requests/GetBotAction.html" title="class in org.botblock.javabotblockapi.requests">GetBotAction</a></li>
30+
<li><a href="org/botblock/javabotblockapi/requests/GetListAction.html" title="class in org.botblock.javabotblockapi.requests">GetListAction</a></li>
31+
<li><a href="org/botblock/javabotblockapi/requests/GetListAction.ApiField.html" title="enum in org.botblock.javabotblockapi.requests">GetListAction.ApiField</a></li>
2932
<li><a href="org/botblock/javabotblockapi/requests/PostAction.html" title="class in org.botblock.javabotblockapi.requests">PostAction</a></li>
3033
<li><a href="org/botblock/javabotblockapi/exceptions/RatelimitedException.html" title="class in org.botblock.javabotblockapi.exceptions">RatelimitedException</a></li>
3134
<li><a href="org/botblock/javabotblockapi/Site.html" title="enum in org.botblock.javabotblockapi">Site</a></li>

docs/allpackages-index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- NewPage -->
33
<html lang="de">
44
<head>
5-
<!-- Generated by javadoc (11.0.4) on Mon Jan 13 00:18:16 CET 2020 -->
5+
<!-- Generated by javadoc (11.0.4) on Mon Jan 13 15:43:58 CET 2020 -->
66
<title>All Packages (JavaBotBlockAPI 4.3.0 API)</title>
77
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
88
<meta name="dc.created" content="2020-01-13">

docs/constant-values.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- NewPage -->
33
<html lang="de">
44
<head>
5-
<!-- Generated by javadoc (11.0.4) on Mon Jan 13 00:18:16 CET 2020 -->
5+
<!-- Generated by javadoc (11.0.4) on Mon Jan 13 15:43:58 CET 2020 -->
66
<title>Constant Field Values (JavaBotBlockAPI 4.3.0 API)</title>
77
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
88
<meta name="dc.created" content="2020-01-13">

0 commit comments

Comments
 (0)