Skip to content

Commit 5a4e769

Browse files
authored
Improve readme
1 parent 3970010 commit 5a4e769

File tree

1 file changed

+127
-2
lines changed

1 file changed

+127
-2
lines changed

README.md

Lines changed: 127 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,133 @@ if you want to only download specific modules can you just use `javabotblockapi-
126126
</dependencies>
127127
```
128128

129-
# Usage
130-
Please visit the [Javadoc] for all available POST and GET methods, as the amount of GET methods alone is quite large.
129+
# Usage Examples
130+
Below can you find a few examples on how JavaBotBlockAPI can/should be used.
131+
Please make sure to also take a look at the [Javadoc] for any additional information.
132+
133+
## BotBlockAPI
134+
> **Required Modules**:
135+
> - `core`
136+
137+
If you want to POST guild counts to the various bot lists should you first create a BotBlockAPI instance.
138+
The BotBlockAPI class contains a nested Builder class which allows a more streamlined creation of a BotBlockAPI instance.
139+
140+
**Example**:
141+
```java
142+
BotBlockAPI api = new BotBlockAPI.Builder()
143+
.addAuthToken("discordextremelist.xyz", "my_s3cr3t_t0k3n")
144+
.addAuthToken(Site.BOTLIST_SPACE, "my_53cret_tok3n")
145+
.build();
146+
```
147+
148+
As you can see can you provide either a String with the id you can find [here][list] or use one of the many static [Site] instances that are offered.
149+
150+
Next would you need to choose, which type of PostAction you want to use. Depending on your selection will you need to have the right module(s) downloaded.
151+
152+
## Default PostAction
153+
> **Required Modules**:
154+
> - `request`
155+
>
156+
> *In the following examples will `botId` and `guilds` be used. Those are placeholders for your bot's ID and Guild count respectively.*
157+
158+
```java
159+
// Create PostAction instance
160+
PostAction postAction = new PostAction("botId");
161+
162+
// Post manually
163+
postAction.postGuilds("botId", guilds, api);
164+
165+
// Post automatically
166+
postAction.enableAutoPost("botId", guilds, api);
167+
168+
// Disable automatic posting
169+
postAction.disableAutoPost(); // Disable with no delay
170+
postAction.disableAutoPost(api); // Disable with BotBlockAPI#getUpdateDelay() delay
171+
postAction.disableAutoPost(1, TimeUnit.MINUTES); // Disable with 1 Minute delay.
172+
```
173+
174+
## JDA PostAction
175+
> **Required Modules**:
176+
> - `request`
177+
> - `jda`
178+
>
179+
> *In the following examples will `botId` and `guilds` be used. Those are placeholders for your bot's ID and Guild count respectively.*
180+
181+
```java
182+
/*
183+
* Get your JDA instance.
184+
* This can also be a ShardManager instance
185+
* for sharded Bots.
186+
*/
187+
JDA jda = getJDA();
188+
189+
// Create PostAction instance
190+
PostAction postAction = new PostAction(jda);
191+
192+
193+
// Post manually
194+
postAction.postGuilds(jda, api);
195+
196+
// Post automatically
197+
postAction.enableAutoPost(jda, api);
198+
199+
// Disable automatic posting
200+
postAction.disableAutoPost(); // Disable with no delay
201+
postAction.disableAutoPost(api); // Disable with BotBlockAPI#getUpdateDelay() delay
202+
postAction.disableAutoPost(1, TimeUnit.MINUTES); // Disable with 1 Minute delay.
203+
```
204+
205+
## Javacord PostAction
206+
> **Required Modules**:
207+
> - `request`
208+
> - `javacord`
209+
>
210+
> *In the following examples will `botId` and `guilds` be used. Those are placeholders for your bot's ID and Guild count respectively.*
211+
212+
```java
213+
/*
214+
* Get your DiscordApi instances.
215+
*/
216+
DiscordApi[] discordApis = getDiscordApis();
217+
218+
// Create PostAction instance
219+
PostAction postAction = new PostAction(discordApis[0]);
220+
221+
// Post manually
222+
postAction.postGuilds(api, discordApis);
223+
224+
// Post automatically
225+
postAction.enableAutoPost(api, discordApis);
226+
227+
// Disable automatic posting
228+
postAction.disableAutoPost(); // Disable with no delay
229+
postAction.disableAutoPost(api); // Disable with BotBlockAPI#getUpdateDelay() delay
230+
postAction.disableAutoPost(1, TimeUnit.MINUTES); // Disable with 1 Minute delay.
231+
```
232+
233+
----
234+
## Get Bot Information
235+
> **Required Modules**:
236+
> - `core`
237+
> - `request`
238+
239+
You can use the GetBotAction class to retrieve information about a bot on the different Bot lists.
240+
The class offers options for either getting the full information as JSONObject, or to retrieve specific information such as the authors of the bot.
241+
242+
Due to the huge amount of methods offered by this class are we not showing any examples here.
243+
A look into the [Javadoc] is highly recommendet.
244+
245+
----
246+
## Get List Information
247+
> **Required Modules**:
248+
> - `core`
249+
> - `request`
250+
251+
Similar to [Getting Bot Information](#get-bot-information) can you also retrieve information known by BotBlock about either all or specific bot lists.
252+
The GetListAction allows the retrieval of all Bot Lists and their information as a JSONObject, or a specific info such as the URL used for seeing a Bot's list entry for a specific bot list.
253+
254+
Due to the huge amount of methods offered by this class are we not showing any examples here.
255+
A look into the [Javadoc] is highly recommendet.
131256

132257
# Libraries/Dependencies
133258
JavaBotBlockAPI utilizes different APIs to provide the functionality it offers right now.

0 commit comments

Comments
 (0)