2626import org .botblock .javabotblockapi .requests .handler .RequestHandler ;
2727import org .json .JSONArray ;
2828import org .json .JSONObject ;
29+ import org .slf4j .Logger ;
30+ import org .slf4j .LoggerFactory ;
2931
3032import javax .annotation .Nonnull ;
3133import javax .annotation .Nullable ;
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}.
4951 * <p>If you want to post without using either instance, use the {@link org.botblock.javabotblockapi.requests.PostAction normal PostAction}.
5052 */
5153public 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