You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 26, 2019. It is now read-only.
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.
9
+
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.
3
10
This wrapper is a fork of [BotBlock4J] and was updated and improved to make it as userfriendly as possible.
4
11
5
12
## Installation
6
-
You can install JavaBotBlockAPI through the following methods.
13
+
You can install JavaBotBlockAPI through the following methods.
7
14
Make sure to replace `{version}` with the above shown version.
8
15
9
16
### Gradle
10
-
Put this code into your `build.gradle`:
17
+
Put this code into your `build.gradle`:
11
18
```gradle
12
19
repositories{
13
20
jcenter()
@@ -19,7 +26,7 @@ dependencies{
19
26
```
20
27
21
28
### Maven
22
-
For maven use this code snipped:
29
+
For maven use this code snipped:
23
30
```xml
24
31
<repositories>
25
32
<repository>
@@ -41,14 +48,14 @@ For maven use this code snipped:
41
48
To use the Wrapper you have to follow these steps.
42
49
43
50
### Notes
44
-
In the below examples do I use a JDA instance called `jda`.
51
+
In the below examples do I use a JDA instance called `jda`.
45
52
This will also work with ShardManager.
46
53
47
54
### Creating a BotBlockAPI instance
48
-
You first need to create an instance of the BotBlockAPI class.
55
+
You first need to create an instance of the BotBlockAPI class.
49
56
This class is the center of everything, including on what sites you want to post your guild counts.
50
57
51
-
You can use the internal Builder class of BotBlockAPI to create an instance. It would look something like this:
58
+
You can use the internal Builder class of BotBlockAPI to create an instance. It would look something like this:
52
59
```java
53
60
// Creating an instance of BotBlockAPI using BotBlockAPI.Builder
54
61
BotBlockAPI api =newBotBlockAPI.Builder(jda) // We can provide either a instance of JDA or ShardManager
@@ -58,16 +65,16 @@ BotBlockAPI api = new BotBlockAPI.Builder(jda) // We can provide either a instan
58
65
```
59
66
60
67
#### Notes
61
-
`new BotBlockAPI.Builder()` allows you to provide either a JDA instance, a ShardManager instance or none at all.
68
+
`new BotBlockAPI.Builder()` allows you to provide either a JDA instance, a ShardManager instance or none at all.
62
69
You can define a JDA or ShardManager instance at a later point with `.setJDA(JDA)` or `.setShardManager(ShardManager)` respectively.
63
70
64
-
Also note that when you don't provide any instance, that you have to use `disableJDA(true)` or else you'll receive an NullPointerException.
65
-
There are also a lot of other methods that you can use. Head over to the [wiki] for more information.
71
+
Also note that when you don't provide any instance, that you have to use `disableJDA(true)` or else you'll receive an NullPointerException.
72
+
There are also a lot of other methods that you can use. Head over to the [Wiki] for more information.
66
73
67
74
### Creating a RequestHandler instance
68
75
The next step after creating an instance of the BotBlockAPI is to create an instance of the Request Handler.
69
76
70
-
This example shows the easiest one to use, but there are much more ways you can set it. Check the [Wiki] for examples.
77
+
This example shows the easiest one to use, but there are much more ways you can set it. Check the [Wiki] for examples.
71
78
```java
72
79
// We previously created a BotBlockAPI instance called api which we now use here.
73
80
RequestHandler handler =newRequestHandler(api);
@@ -79,47 +86,47 @@ This step depends on what You previously set for the BotBlockAPI and the Request
79
86
**All methods require BotBlockAPI to be setup, meaning you have AT LEAST added one site and token!**
80
87
81
88
#### Auto-posting
82
-
The Wrapper comes with an inbuilt auto-post that allows you to easily post the guild counts without worrying too much.
89
+
The Wrapper comes with an inbuilt auto-post that allows you to easily post the guild counts without worrying too much.
83
90
However, this method is limited to JDA and ShardManager only so you have to define them for using this.
84
91
85
-
To auto-post guild counts you just need to call `RequestHandler#startAutoPosting();`
86
-
This would look like this:
92
+
To auto-post guild counts you just need to call `RequestHandler#startAutoPosting();`.
93
+
This would look like this:
87
94
```java
88
95
// We previously defined a RequestHandler called handler
89
96
handler.startAutoPosting();
90
97
```
91
98
92
-
Easy right? But what if you want to stop the auto-posting?
93
-
For that simply use `Request#stopAutoPosting();`. Here is another example:
99
+
Easy right? But what if you want to stop the auto-posting?
100
+
For that simply use `Request#stopAutoPosting();`. Here is another example:
94
101
```java
95
102
// We previously defined a RequestHandler called handler
96
103
handler.stopAutoPosting();
97
104
```
98
105
99
-
Note thet the delay in which you post to the API is defined through the BotBlockAPI.
106
+
Note thet the delay in which you post to the API is defined through the BotBlockAPI.
100
107
Use `BotBlockAPI.Builder#setUpdateInterval(Integer)` to define a delay. It is counted in minutes and default is 30.
101
108
102
109
#### Manual posting
103
-
If you want to post the guild counts manually you can use the following method:
110
+
If you want to post the guild counts manually you can use the following method:
104
111
```java
105
112
// We previously defined a RequestHandler called handler
106
113
handler.postGuilds();
107
114
```
108
115
109
116
### Exceptions
110
-
When you post the guild counts you could encounter certain Exceptions.
117
+
When you post the guild counts you could encounter certain Exceptions.
111
118
You can receive the following exceptions:
112
-
-`IOException`
119
+
-`IOException`
113
120
The Request couldn't be performed properly. This can be f.e. the case when BotBlock.org denies access (403).
114
-
-`RatelimitedException`
115
-
When we exceed the ratelimit of BotBlock.org
121
+
-`RatelimitedException`
122
+
When we exceed the ratelimit of BotBlock.org
116
123
This shouldn't be the case with auto-posting since it has a minimum delay of 1 minute.
117
-
-`NullPointerException`
124
+
-`NullPointerException`
118
125
Thrown when BotBlock.org sends an empty response, meaning something got messed up on their side.
119
126
120
127
## Links
121
128
Here are some useful links:
122
129
-[BotBlock.org] Site for which this wrapper was made.
123
130
-[API] API documentation.
124
131
-[Wiki] Contains additional information on how you can use JavaBotBlockAPI.
125
-
-[BotBlock4J] Original Wrapper from which this one originates.
132
+
-[BotBlock4J] Original Wrapper from which this one originates.
0 commit comments