From b06a4a0449157a107e82cdbbec2d110f6e90177a Mon Sep 17 00:00:00 2001 From: Andre601 <11576465+Andre601@users.noreply.github.com> Date: Fri, 16 Jul 2021 22:19:26 +0200 Subject: [PATCH] Add check for discordlist.space tokens --- build.gradle | 2 +- .../org/botblock/javabotblockapi/core/BotBlockAPI.java | 8 ++++++++ .../main/java/org/botblock/javabotblockapi/core/Info.java | 4 ++-- .../main/java/org/botblock/javabotblockapi/core/Site.java | 3 --- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 0573b97f..568e8d15 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins{ id 'com.github.johnrengelman.shadow' version '5.2.0' } -def ver = new Version(major: 6, minor: 7, patch: 0) +def ver = new Version(major: 6, minor: 7, patch: 1) allprojects { apply plugin: 'maven-publish' diff --git a/core/src/main/java/org/botblock/javabotblockapi/core/BotBlockAPI.java b/core/src/main/java/org/botblock/javabotblockapi/core/BotBlockAPI.java index 31068482..d460f704 100644 --- a/core/src/main/java/org/botblock/javabotblockapi/core/BotBlockAPI.java +++ b/core/src/main/java/org/botblock/javabotblockapi/core/BotBlockAPI.java @@ -88,6 +88,10 @@ public Builder addAuthToken(@Nonnull Site site, @Nonnull String token){ CheckUtil.notEmpty(token, "Token"); CheckUtil.condition(!site.supportsPost(), site.getName() + " does not support POST requests!"); + // Discordlist.space requires the token to start with "Bot " + if(site.getName().equals("discordlist.space") && !token.startsWith("Bot ")) + token = "Bot " + token; + tokens.put(site.getName(), token); return this; } @@ -113,6 +117,10 @@ public Builder addAuthToken(@Nonnull Site site, @Nonnull String token){ public Builder addAuthToken(@Nonnull String site, @Nonnull String token){ CheckUtil.notEmpty(site, "Site"); CheckUtil.notEmpty(token, "Token"); + + // Discordlist.space requires the token to start with "Bot " + if(site.equals("discordlist.space") && !token.startsWith("Bot ")) + token = "Bot " + token; tokens.put(site, token); return this; diff --git a/core/src/main/java/org/botblock/javabotblockapi/core/Info.java b/core/src/main/java/org/botblock/javabotblockapi/core/Info.java index d9a1bde4..17d26ff9 100644 --- a/core/src/main/java/org/botblock/javabotblockapi/core/Info.java +++ b/core/src/main/java/org/botblock/javabotblockapi/core/Info.java @@ -35,11 +35,11 @@ public class Info{ /** * Minor version of the Wrapper. */ - public static final int MINOR = 6; + public static final int MINOR = 7; /** * Patch version of the Wrapper. */ - public static final int PATCH = 6; + public static final int PATCH = 1; /** * Full version in the format {@code major.minor.patch}. diff --git a/core/src/main/java/org/botblock/javabotblockapi/core/Site.java b/core/src/main/java/org/botblock/javabotblockapi/core/Site.java index b01042d1..2e392372 100644 --- a/core/src/main/java/org/botblock/javabotblockapi/core/Site.java +++ b/core/src/main/java/org/botblock/javabotblockapi/core/Site.java @@ -18,9 +18,6 @@ package org.botblock.javabotblockapi.core; -import org.botblock.javabotblockapi.core.annotations.DeprecatedSince; -import org.botblock.javabotblockapi.core.annotations.PlannedRemoval; - import java.util.ArrayList; import java.util.Arrays; import java.util.List;