Skip to content

Commit 9c00593

Browse files
committed
Fix javadocs
1 parent 9b4fc4e commit 9c00593

File tree

5 files changed

+86
-71
lines changed

5 files changed

+86
-71
lines changed

javacord/src/main/java/org/botblock/javabotblockapi/javacord/PostAction.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
import org.javacord.api.DiscordApi;
2626
import org.json.JSONArray;
2727
import org.json.JSONObject;
28+
import org.slf4j.Logger;
29+
import org.slf4j.LoggerFactory;
2830

2931
import javax.annotation.Nonnull;
3032
import javax.annotation.Nullable;
@@ -38,11 +40,16 @@
3840

3941
/**
4042
* Class used to perform POST requests towards the <a href="https://botblock.org/api/docs#count" target="_blank">/api/count</a>
41-
* endpoint of BotBlock.
43+
* endpoint of BotBlock using the Javacord Library.
4244
*
43-
* <p>The class offers options to post either
45+
* <p>The class offers options to post either {@link #postGuilds(BotBlockAPI, DiscordApi...) manually} or
46+
* {@link #enableAutoPost(BotBlockAPI, DiscordApi...) automatically}.
47+
*
48+
* <p>If you want to post without using Javacord, use the {@link org.botblock.javabotblockapi.requests.PostAction normal PostAction}.
4449
*/
4550
public class PostAction{
51+
private final Logger LOG = LoggerFactory.getLogger("JavaBotBlockAPI - PostAction (Javacord)");
52+
4653
private final RequestHandler requestHandler;
4754
private final ScheduledExecutorService scheduler;
4855

@@ -133,7 +140,7 @@ public void disableAutoPost(long time, @Nonnull TimeUnit timeUnit){
133140
scheduler.shutdown();
134141
scheduler.awaitTermination(time, timeUnit);
135142
}catch(InterruptedException ex){
136-
ex.printStackTrace();
143+
LOG.warn("Got interrupted while shutting down the Scheduler!", ex);
137144
}
138145
}
139146

@@ -165,7 +172,7 @@ public void enableAutoPost(@Nonnull BotBlockAPI botBlockAPI, @Nonnull DiscordApi
165172
try{
166173
postGuilds(botBlockAPI, discordApis);
167174
}catch(IOException | RateLimitedException ex){
168-
ex.printStackTrace();
175+
LOG.warn("Got an exception while performing a auto-post task!", ex);
169176
}
170177
}, 1, botBlockAPI.getUpdateDelay(), TimeUnit.MINUTES);
171178
}

jda/src/main/java/org/botblock/javabotblockapi/jda/PostAction.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import org.botblock.javabotblockapi.requests.handler.RequestHandler;
2727
import org.json.JSONArray;
2828
import org.json.JSONObject;
29+
import org.slf4j.Logger;
30+
import org.slf4j.LoggerFactory;
2931

3032
import javax.annotation.Nonnull;
3133
import javax.annotation.Nullable;
@@ -39,7 +41,7 @@
3941

4042
/**
4143
* Class used to perform POST requests towards the <a href="https://botblock.org/api/docs#count" target="_blank">/api/count</a>
42-
* endpoint of BotBlock.
44+
* endpoint of BotBlock using the JDA Library.
4345
*
4446
* <p>The class offers options to post either {@link #postGuilds(JDA, BotBlockAPI) manually} or
4547
* {@link #enableAutoPost(JDA, BotBlockAPI) automatically}.
@@ -49,6 +51,8 @@
4951
* <p>If you want to post without using either instance, use the {@link org.botblock.javabotblockapi.requests.PostAction normal PostAction}.
5052
*/
5153
public class PostAction{
54+
private final Logger LOG = LoggerFactory.getLogger("JavaBotBlockAPI - PostAction (JDA)");
55+
5256
private final RequestHandler requestHandler;
5357
private final ScheduledExecutorService scheduler;
5458

@@ -155,7 +159,7 @@ public void disableAutoPost(long time, @Nonnull TimeUnit timeUnit){
155159
scheduler.shutdown();
156160
scheduler.awaitTermination(time, timeUnit);
157161
}catch(InterruptedException ex){
158-
ex.printStackTrace();
162+
LOG.warn("Got interrupted while shutting down the Scheduler!", ex);
159163
}
160164
}
161165

@@ -182,7 +186,7 @@ public void enableAutoPost(@Nonnull JDA jda, @Nonnull BotBlockAPI botBlockAPI){
182186
try{
183187
postGuilds(jda, botBlockAPI);
184188
}catch(IOException | RateLimitedException ex){
185-
ex.printStackTrace();
189+
LOG.warn("Got an exception while performing a auto-post task!", ex);
186190
}
187191
}, 1, botBlockAPI.getUpdateDelay(), TimeUnit.MINUTES);
188192
}
@@ -208,7 +212,7 @@ public void enableAutoPost(@Nonnull ShardManager shardManager, @Nonnull BotBlock
208212
try{
209213
postGuilds(shardManager, botBlockAPI);
210214
}catch(IOException | RateLimitedException ex){
211-
ex.printStackTrace();
215+
LOG.warn("Got an exception while performing a auto-post task!", ex);
212216
}
213217
}, botBlockAPI.getUpdateDelay(), botBlockAPI.getUpdateDelay(), TimeUnit.MINUTES);
214218
}

0 commit comments

Comments
 (0)