diff --git a/.github/workflows/maven-publish-snapshot-workflow.yml b/.github/workflows/maven-publish-snapshot-workflow.yml
index 48e7f0a..8eba453 100644
--- a/.github/workflows/maven-publish-snapshot-workflow.yml
+++ b/.github/workflows/maven-publish-snapshot-workflow.yml
@@ -5,6 +5,9 @@ on:
branches:
- integration
- master
+ push:
+ branches:
+ - integration
# https://stackoverflow.com/questions/61096521/how-to-use-gpg-key-in-github-actions
# https://github.com/actions/setup-java/issues/83
diff --git a/README.md b/README.md
index 779260c..38856b5 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[![wakatime](https://wakatime.com/badge/user/beeb4317-977b-4b19-878a-21e9aa8e43ed/project/da9ac356-721a-40dd-a76a-19c3ff0d57d5.svg?style=for-the-badge)](https://wakatime.com/badge/user/beeb4317-977b-4b19-878a-21e9aa8e43ed/project/da9ac356-721a-40dd-a76a-19c3ff0d57d5)
+[![wakatime](https://wakatime.com/badge/github/beanbeanjuice/Java-Cafe-API-Wrapper.svg?style=for-the-badge)](https://wakatime.com/badge/github/beanbeanjuice/Java-Cafe-API-Wrapper)
[![CodeFactor](https://www.codefactor.io/repository/github/beanbeanjuice/java-cafe-api-wrapper/badge?style=for-the-badge)](https://www.codefactor.io/repository/github/beanbeanjuice/java-cafe-api-wrapper)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/beanbeanjuice/Java-Cafe-API-Wrapper?style=for-the-badge)
@@ -60,10 +60,17 @@
# Getting Started
-To add this bot to your server, follow these steps.
+## Usage
+
+```Java
+CafeAPI cafeAPI = new CafeAPI(USERNAME_HERE, PASSWORD_HERE, RequestLocation.RELEASE);
+cafeAPI.BIRTHDAY.getUserBirthday(USER_ID_HERE);
+```
## Installation
+![Maven Central](https://img.shields.io/maven-central/v/com.beanbeanjuice/cafe-api-wrapper?color=%23CBC3E3)
+
For `Maven`, paste this into your `dependencies` section of your `pom.xml` file.
```XML
diff --git a/pom.xml b/pom.xml
index 77d21cd..79537c6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
16
UTF-8
UTF-8
- 1.3.1
+ 1.4.0
@@ -74,7 +74,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 2.22.0
+ 3.1.2
@@ -92,7 +92,7 @@
org.apache.maven.plugins
maven-source-plugin
- 2.2.1
+ 3.3.0
attach-sources
@@ -105,7 +105,7 @@
org.apache.maven.plugins
maven-javadoc-plugin
- 2.9.1
+ 3.5.0
attach-javadocs
@@ -119,7 +119,7 @@
org.apache.maven.plugins
maven-gpg-plugin
- 3.0.1
+ 3.1.0
sign-artifacts
@@ -155,14 +155,14 @@
com.beanbeanjuice
kawaii-api-wrapper
- 1.1.0
+ 1.2.0
org.apache.maven.plugins
maven-gpg-plugin
- 3.0.1
+ 3.1.0
maven-plugin
@@ -185,24 +185,24 @@
com.fasterxml.jackson.core
jackson-core
- 2.13.3
+ 2.15.2
com.fasterxml.jackson.core
jackson-databind
- 2.13.3
+ 2.15.2
com.fasterxml.jackson.core
jackson-annotations
- 2.13.3
+ 2.15.2
- org.apache.httpcomponents
- httpclient
- 4.5.13
+ org.apache.httpcomponents.client5
+ httpclient5
+ 5.2.1
@@ -222,7 +222,7 @@
org.junit.jupiter
junit-jupiter
- 5.8.2
+ 5.9.0
test
diff --git a/src/main/java/com/beanbeanjuice/cafeapi/CafeAPI.java b/src/main/java/com/beanbeanjuice/cafeapi/CafeAPI.java
index 4046561..513c7ae 100644
--- a/src/main/java/com/beanbeanjuice/cafeapi/CafeAPI.java
+++ b/src/main/java/com/beanbeanjuice/cafeapi/CafeAPI.java
@@ -1,6 +1,7 @@
package com.beanbeanjuice.cafeapi;
import com.beanbeanjuice.KawaiiAPI;
+import com.beanbeanjuice.cafeapi.cafebot.goodbyes.Goodbyes;
import com.beanbeanjuice.cafeapi.requests.*;
import com.beanbeanjuice.cafeapi.user.Users;
import com.beanbeanjuice.cafeapi.cafebot.beancoins.users.DonationUsers;
@@ -34,6 +35,7 @@ public class CafeAPI {
public Words WORD;
public Welcomes WELCOME;
+ public Goodbyes GOODBYE;
public VoiceChannelBinds VOICE_CHANNEL_BIND;
public Raffles RAFFLE;
public Polls POLL;
@@ -71,6 +73,7 @@ public CafeAPI(@NotNull String username, @NotNull String password, @NotNull Requ
// cafeBot
WORD = new Words(apiKey);
WELCOME = new Welcomes(apiKey);
+ GOODBYE = new Goodbyes(apiKey);
VOICE_CHANNEL_BIND = new VoiceChannelBinds(apiKey);
RAFFLE = new Raffles(apiKey);
POLL = new Polls(apiKey);
diff --git a/src/main/java/com/beanbeanjuice/cafeapi/cafebot/goodbyes/Goodbyes.java b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/goodbyes/Goodbyes.java
new file mode 100644
index 0000000..57ea8d5
--- /dev/null
+++ b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/goodbyes/Goodbyes.java
@@ -0,0 +1,176 @@
+package com.beanbeanjuice.cafeapi.cafebot.goodbyes;
+
+import com.beanbeanjuice.cafeapi.CafeAPI;
+import com.beanbeanjuice.cafeapi.exception.api.*;
+import com.beanbeanjuice.cafeapi.requests.Request;
+import com.beanbeanjuice.cafeapi.requests.RequestBuilder;
+import com.beanbeanjuice.cafeapi.requests.RequestRoute;
+import com.beanbeanjuice.cafeapi.requests.RequestType;
+import com.fasterxml.jackson.databind.JsonNode;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+
+/**
+ * A class used for the {@link Goodbyes} API.
+ */
+public class Goodbyes {
+
+ private String apiKey;
+
+ /**
+ * Creates a new class used for {@link Goodbyes} API requests.
+ * @param apiKey The API key used for authorization.
+ */
+ public Goodbyes(@NotNull String apiKey) {
+ this.apiKey = apiKey;
+ }
+
+ /**
+ * Retrieves an {@link ArrayList} of {@link GuildGoodbye} containing all Guild Goodbyes in the {@link CafeAPI CafeAPI}.
+ * @return The {@link ArrayList} of {@link GuildGoodbye}.
+ * @throws AuthorizationException Thrown when the api key is unauthorized.
+ * @throws ResponseException Thrown when there is a generic server-side exception.
+ */
+ @NotNull
+ public ArrayList getAllGuildGoodbyes() throws AuthorizationException, ResponseException {
+ ArrayList guildGoodbyes = new ArrayList<>();
+
+ Request request = new RequestBuilder(RequestRoute.CAFEBOT, RequestType.GET)
+ .setRoute("/goodbyes")
+ .setAuthorization(apiKey)
+ .build();
+
+ for (JsonNode guildGoodbye : request.getData().get("goodbyes")) {
+ guildGoodbyes.add(parseGuildGoodbye(guildGoodbye));
+ }
+
+ return guildGoodbyes;
+ }
+
+ /**
+ * Retrieves a {@link GuildGoodbye} from the {@link CafeAPI CafeAPI}.
+ * @param guildID The {@link String guildID} to retrieve the {@link GuildGoodbye} for.
+ * @return The {@link GuildGoodbye} retrieved.
+ * @throws AuthorizationException Thrown when the API key is invalid.
+ * @throws ResponseException Thrown when there is a generic server-side exception.
+ * @throws NotFoundException Thrown when the guild ID is not found.
+ */
+ @NotNull
+ public GuildGoodbye getGuildGoodbye(@NotNull String guildID)
+ throws AuthorizationException, ResponseException, NotFoundException {
+ Request request = new RequestBuilder(RequestRoute.CAFEBOT, RequestType.GET)
+ .setRoute("/goodbyes/" + guildID)
+ .setAuthorization(apiKey)
+ .build();
+
+ JsonNode guildGoodbye = request.getData().get("goodbye");
+
+ return parseGuildGoodbye(guildGoodbye);
+ }
+
+ /**
+ * Updates a {@link GuildGoodbye} in the {@link CafeAPI CafeAPI}.
+ * @param guildGoodbye The new {@link GuildGoodbye}.
+ * @return True, if updating the {@link GuildGoodbye} was successful.
+ * @throws AuthorizationException Thrown when the API key is invalid.
+ * @throws NotFoundException Thrown when the guild ID is not found.
+ * @throws ResponseException Thrown when there is a generic server-side exception.
+ */
+ @NotNull
+ public Boolean updateGuildGoodbye(@NotNull GuildGoodbye guildGoodbye)
+ throws AuthorizationException, NotFoundException, ResponseException {
+ Request request = new RequestBuilder(RequestRoute.CAFEBOT, RequestType.PATCH)
+ .setRoute("/goodbyes/" + guildGoodbye.getGuildID())
+ .addParameter("description", guildGoodbye.getDescription())
+ .addParameter("thumbnail_url", guildGoodbye.getThumbnailURL())
+ .addParameter("image_url", guildGoodbye.getImageURL())
+ .addParameter("message", guildGoodbye.getMessage())
+ .setAuthorization(apiKey)
+ .build();
+
+ return request.getStatusCode() == 200;
+ }
+
+ /**
+ * Creates a new {@link GuildGoodbye} for the {@link CafeAPI CafeAPI}.
+ * @param guildGoodbye The new {@link GuildGoodbye} to add.
+ * @return True if the {@link GuildGoodbye} was successfully added.
+ * @throws AuthorizationException Thrown when the API key is invalid.
+ * @throws ConflictException Thrown when the provided guild ID already exists.
+ * @throws ResponseException Thrown when there is a generic server-side exception.
+ * @throws UndefinedVariableException Thrown when a variable is undefined.
+ */
+ @NotNull
+ public Boolean createGuildGoodbye(@NotNull GuildGoodbye guildGoodbye)
+ throws AuthorizationException, ConflictException, ResponseException, UndefinedVariableException {
+ Request request = new RequestBuilder(RequestRoute.CAFEBOT, RequestType.POST)
+ .setRoute("/goodbyes/" + guildGoodbye.getGuildID())
+ .addParameter("description", guildGoodbye.getDescription())
+ .addParameter("thumbnail_url", guildGoodbye.getThumbnailURL())
+ .addParameter("image_url", guildGoodbye.getImageURL())
+ .addParameter("message", guildGoodbye.getMessage())
+ .setAuthorization(apiKey)
+ .build();
+
+ return request.getStatusCode() == 201;
+ }
+
+ /**
+ * Deletes a {@link GuildGoodbye} from the {@link CafeAPI CafeAPI}.
+ * @param guildID The {@link String} ID of the {@link GuildGoodbye} to delete.
+ * @return True if successfully deleted.
+ * @throws AuthorizationException Thrown when the API key is invalid.
+ * @throws ResponseException Thrown when there is a generic server-side exception.
+ */
+ @NotNull
+ public Boolean deleteGuildGoodbye(@NotNull String guildID)
+ throws AuthorizationException, ResponseException {
+ Request request = new RequestBuilder(RequestRoute.CAFEBOT, RequestType.DELETE)
+ .setRoute("/goodbyes/" + guildID)
+ .setAuthorization(apiKey)
+ .build();
+
+ return request.getStatusCode() == 200;
+ }
+
+ /**
+ * Parses a {@link GuildGoodbye} from the {@link JsonNode}.
+ * @param node The {@link JsonNode} to parse.
+ * @return The parsed {@link GuildGoodbye}.
+ */
+ @NotNull
+ private GuildGoodbye parseGuildGoodbye(@NotNull JsonNode node) {
+ String guildID = node.get("guild_id").asText();
+
+ String description = node.get("description").asText();
+ String thumbnailURL = node.get("thumbnail_url").asText();
+ String imageURL = node.get("image_url").asText();
+ String message = node.get("message").asText();
+
+ if (description.equals("null")) {
+ description = null;
+ }
+
+ if (thumbnailURL.equals("null")) {
+ thumbnailURL = null;
+ }
+
+ if (imageURL.equals("null")) {
+ imageURL = null;
+ }
+
+ if (message.equals("null")) {
+ message = null;
+ }
+
+ return new GuildGoodbye(
+ guildID,
+ description,
+ thumbnailURL,
+ imageURL,
+ message
+ );
+ }
+
+}
diff --git a/src/main/java/com/beanbeanjuice/cafeapi/cafebot/goodbyes/GuildGoodbye.java b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/goodbyes/GuildGoodbye.java
new file mode 100644
index 0000000..c8d9c50
--- /dev/null
+++ b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/goodbyes/GuildGoodbye.java
@@ -0,0 +1,75 @@
+package com.beanbeanjuice.cafeapi.cafebot.goodbyes;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * A class used for Goodbye Information for a Discord Guild.
+ *
+ * @author beanbeanjuice
+ */
+public class GuildGoodbye {
+
+ private final String guildID;
+ private final String description;
+ private final String thumbnailURL;
+ private final String imageURL;
+ private final String message;
+
+ /**
+ * Creates a new {@link GuildGoodbye} object.
+ * @param guildID The {@link String guildID} of the {@link GuildGoodbye}.
+ * @param description The {@link String description} of the {@link GuildGoodbye}.
+ * @param thumbnailURL The {@link String thumbnailURL} of the {@link GuildGoodbye}.
+ * @param imageURL The {@link String imageURL} of the {@link GuildGoodbye}.
+ * @param message The {@link String message} of the {@link GuildGoodbye}.
+ */
+ public GuildGoodbye(@NotNull String guildID, @Nullable String description, @Nullable String thumbnailURL,
+ @Nullable String imageURL, @Nullable String message) {
+ this.guildID = guildID;
+ this.description = description;
+ this.thumbnailURL = thumbnailURL;
+ this.imageURL = imageURL;
+ this.message = message;
+ }
+
+ /**
+ * @return The {@link String guildID} of the {@link GuildGoodbye}.
+ */
+ @NotNull
+ public String getGuildID() {
+ return guildID;
+ }
+
+ /**
+ * @return The {@link String description} of the {@link GuildGoodbye}.
+ */
+ @Nullable
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @return The {@link String thumbnailURL} of the {@link GuildGoodbye}.
+ */
+ @Nullable
+ public String getThumbnailURL() {
+ return thumbnailURL;
+ }
+
+ /**
+ * @return The {@link String imageURL} of the {@link GuildGoodbye}.
+ */
+ @Nullable
+ public String getImageURL() {
+ return imageURL;
+ }
+
+ /**
+ * @return The {@link String message} of the {@link GuildGoodbye}.
+ */
+ @Nullable
+ public String getMessage() {
+ return message;
+ }
+}
diff --git a/src/main/java/com/beanbeanjuice/cafeapi/cafebot/guilds/GuildInformation.java b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/guilds/GuildInformation.java
index 38cd6ad..b8dfc62 100644
--- a/src/main/java/com/beanbeanjuice/cafeapi/cafebot/guilds/GuildInformation.java
+++ b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/guilds/GuildInformation.java
@@ -21,6 +21,7 @@ public class GuildInformation {
private final String raffleChannelID;
private final String birthdayChannelID;
private final String welcomeChannelID;
+ private final String goodbyeChannelID;
private final String logChannelID;
private final String ventingChannelID;
private final Boolean aiResponseStatus;
@@ -40,6 +41,7 @@ public class GuildInformation {
* @param raffleChannelID The {@link String raffleChannelID} for the {@link String guildID}.
* @param birthdayChannelID The {@link String birthdayChannelID} for the {@link String guildID}.
* @param welcomeChannelID The {@link String welcomeChannelID} for the {@link String guildID}.
+ * @param goodbyeChannelID The {@link String goodbyeChannelID} for the {@link String guildID}.
* @param logChannelID The {@link String logChannelID} for the {@link String guildID}.
* @param ventingChannelID The {@link String ventingChannelID} for the {@link String guildID}.
* @param aiResponseStatus The {@link Boolean aiResponseStatus} for the {@link String guildID}.
@@ -49,8 +51,8 @@ public GuildInformation(@NotNull String prefix, @NotNull String moderatorRoleID,
@NotNull String mutedRoleID, @NotNull String liveNotificationsRoleID, @NotNull Boolean notifyOnUpdate,
@NotNull String updateChannelID, @NotNull String countingChannelID, @NotNull String pollChannelID,
@NotNull String raffleChannelID, @NotNull String birthdayChannelID, @NotNull String welcomeChannelID,
- @NotNull String logChannelID, @NotNull String ventingChannelID, @NotNull Boolean aiResponseStatus,
- @NotNull String dailyChannelID) {
+ @NotNull String goodbyeChannelID, @NotNull String logChannelID, @NotNull String ventingChannelID,
+ @NotNull Boolean aiResponseStatus, @NotNull String dailyChannelID) {
this.prefix = prefix;
this.moderatorRoleID = moderatorRoleID;
this.twitchChannelID = twitchChannelID;
@@ -63,6 +65,7 @@ public GuildInformation(@NotNull String prefix, @NotNull String moderatorRoleID,
this.raffleChannelID = raffleChannelID;
this.birthdayChannelID = birthdayChannelID;
this.welcomeChannelID = welcomeChannelID;
+ this.goodbyeChannelID = goodbyeChannelID;
this.logChannelID = logChannelID;
this.ventingChannelID = ventingChannelID;
this.aiResponseStatus = aiResponseStatus;
@@ -165,6 +168,14 @@ public String getWelcomeChannelID() {
return welcomeChannelID;
}
+ /**
+ * @return The {@link String goodbyeChannelID} for the {@link GuildInformation}.
+ */
+ @NotNull
+ public String getGoodbyeChannelID() {
+ return goodbyeChannelID;
+ }
+
/**
* @return The {@link String logChannelID} for the {@link GuildInformation}.
*/
diff --git a/src/main/java/com/beanbeanjuice/cafeapi/cafebot/guilds/GuildInformationType.java b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/guilds/GuildInformationType.java
index 372de9f..a7691bf 100644
--- a/src/main/java/com/beanbeanjuice/cafeapi/cafebot/guilds/GuildInformationType.java
+++ b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/guilds/GuildInformationType.java
@@ -21,6 +21,7 @@ public enum GuildInformationType {
RAFFLE_CHANNEL_ID ("raffle_channel_id"),
BIRTHDAY_CHANNEL_ID ("birthday_channel_id"),
WELCOME_CHANNEL_ID ("welcome_channel_id"),
+ GOODBYE_CHANNEL_ID ("goodbye_channel_id"),
LOG_CHANNEL_ID ("log_channel_id"),
VENTING_CHANNEL_ID ("venting_channel_id"),
AI_RESPONSE ("ai_response"),
diff --git a/src/main/java/com/beanbeanjuice/cafeapi/cafebot/guilds/GuildInformations.java b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/guilds/GuildInformations.java
index 3c6c4bb..573b8c9 100644
--- a/src/main/java/com/beanbeanjuice/cafeapi/cafebot/guilds/GuildInformations.java
+++ b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/guilds/GuildInformations.java
@@ -166,30 +166,31 @@ public Boolean deleteGuildInformation(@NotNull String guildID)
*/
@NotNull
private GuildInformation parseGuildInformation(@NotNull JsonNode guild) {
- String prefix = guild.get("prefix").asText();
- String moderatorRoleID = guild.get("moderator_role_id").asText();
- String twitchChannelID = guild.get("twitch_channel_id").asText();
- String mutedRoleID = guild.get("muted_role_id").asText();
- String liveNotificationsRoleID = guild.get("live_notifications_role_id").asText();
- Boolean notifyOnUpdate = convertToBoolean(guild.get("notify_on_update").asText());
- String updateChannelID = guild.get("update_channel_id").asText();
- String countingChannelID = guild.get("counting_channel_id").asText();
- String pollChannelID = guild.get("poll_channel_id").asText();
- String raffleChannelID = guild.get("raffle_channel_id").asText();
- String birthdayChannelID = guild.get("birthday_channel_id").asText();
- String welcomeChannelID = guild.get("welcome_channel_id").asText();
- String logChannelID = guild.get("log_channel_id").asText();
- String ventingChannelID = guild.get("venting_channel_id").asText();
- Boolean aiResponseStatus = convertToBoolean(guild.get("ai_response").asText());
- String dailyChannelID = guild.get("daily_channel_id").asText();
+ String prefix = guild.get(GuildInformationType.PREFIX.getType()).asText();
+ String moderatorRoleID = guild.get(GuildInformationType.MODERATOR_ROLE_ID.getType()).asText();
+ String twitchChannelID = guild.get(GuildInformationType.TWITCH_CHANNEL_ID.getType()).asText();
+ String mutedRoleID = guild.get(GuildInformationType.MUTED_ROLE_ID.getType()).asText();
+ String liveNotificationsRoleID = guild.get(GuildInformationType.LIVE_NOTIFICATIONS_ROLE_ID.getType()).asText();
+ Boolean notifyOnUpdate = convertToBoolean(guild.get(GuildInformationType.NOTIFY_ON_UPDATE.getType()).asText());
+ String updateChannelID = guild.get(GuildInformationType.UPDATE_CHANNEL_ID.getType()).asText();
+ String countingChannelID = guild.get(GuildInformationType.COUNTING_CHANNEL_ID.getType()).asText();
+ String pollChannelID = guild.get(GuildInformationType.POLL_CHANNEL_ID.getType()).asText();
+ String raffleChannelID = guild.get(GuildInformationType.RAFFLE_CHANNEL_ID.getType()).asText();
+ String birthdayChannelID = guild.get(GuildInformationType.BIRTHDAY_CHANNEL_ID.getType()).asText();
+ String welcomeChannelID = guild.get(GuildInformationType.WELCOME_CHANNEL_ID.getType()).asText();
+ String goodbyeChannelID = guild.get(GuildInformationType.GOODBYE_CHANNEL_ID.getType()).asText();
+ String logChannelID = guild.get(GuildInformationType.LOG_CHANNEL_ID.getType()).asText();
+ String ventingChannelID = guild.get(GuildInformationType.VENTING_CHANNEL_ID.getType()).asText();
+ Boolean aiResponseStatus = convertToBoolean(guild.get(GuildInformationType.AI_RESPONSE.getType()).asText());
+ String dailyChannelID = guild.get(GuildInformationType.DAILY_CHANNEL_ID.getType()).asText();
return new GuildInformation(
prefix, moderatorRoleID, twitchChannelID,
mutedRoleID, liveNotificationsRoleID, notifyOnUpdate,
updateChannelID, countingChannelID, pollChannelID,
raffleChannelID, birthdayChannelID, welcomeChannelID,
- logChannelID, ventingChannelID, aiResponseStatus,
- dailyChannelID
+ goodbyeChannelID, logChannelID, ventingChannelID,
+ aiResponseStatus, dailyChannelID
);
}
diff --git a/src/main/java/com/beanbeanjuice/cafeapi/cafebot/interactions/InteractionType.java b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/interactions/InteractionType.java
index f534b12..1028231 100644
--- a/src/main/java/com/beanbeanjuice/cafeapi/cafebot/interactions/InteractionType.java
+++ b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/interactions/InteractionType.java
@@ -39,7 +39,17 @@ public enum InteractionType {
DIE ("die_amount", false, null),
WELCOME ("welcome_amount", false, null),
LICK ("lick_amount", true, "lick"),
- SHUSH ("shush_amount", false, null);
+ SHUSH ("shush_amount", false, null),
+ WAVE ("wave_amount", true, "wave"),
+ SHOOT ("shoot_amount", true, "shoot"),
+ AMAZED ("amazed_amount", true, "amazing"),
+ ASK ("ask_amount", true, "ask"),
+ BOOP ("boop_amount", true, "boop"),
+ LOVE ("love_amount", true, "love"),
+ NOSEBLEED ("nosebleed_amount", true, "nosebleed"),
+ OK ("ok_amount", true, "ok"),
+ UWU ("uwu_amount", true, "uwu"),
+ WINK ("wink_amount", true, "wink");
private final String type;
private final Boolean isKawaiiAPI;
diff --git a/src/main/java/com/beanbeanjuice/cafeapi/cafebot/interactions/Interactions.java b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/interactions/Interactions.java
index 59e841b..b1036a4 100644
--- a/src/main/java/com/beanbeanjuice/cafeapi/cafebot/interactions/Interactions.java
+++ b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/interactions/Interactions.java
@@ -292,34 +292,44 @@ public Boolean deleteUserInteractionsReceived(@NotNull String userID)
*/
@NotNull
private Interaction parseInteraction(@NotNull JsonNode jsonNode) {
- Integer hugAmount = jsonNode.get("hug_amount").asInt();
- Integer punchAmount = jsonNode.get("punch_amount").asInt();
- Integer kissAmount = jsonNode.get("kiss_amount").asInt();
- Integer biteAmount = jsonNode.get("bite_amount").asInt();
- Integer blushAmount = jsonNode.get("blush_amount").asInt();
- Integer cuddleAmount = jsonNode.get("cuddle_amount").asInt();
- Integer nomAmount = jsonNode.get("nom_amount").asInt();
- Integer pokeAmount = jsonNode.get("poke_amount").asInt();
- Integer slapAmount = jsonNode.get("slap_amount").asInt();
- Integer stabAmount = jsonNode.get("stab_amount").asInt();
- Integer hmphAmount = jsonNode.get("hmph_amount").asInt();
- Integer poutAmount = jsonNode.get("pout_amount").asInt();
- Integer throwAmount = jsonNode.get("throw_amount").asInt();
- Integer smileAmount = jsonNode.get("smile_amount").asInt();
- Integer stareAmount = jsonNode.get("stare_amount").asInt();
- Integer tickleAmount = jsonNode.get("tickle_amount").asInt();
- Integer rageAmount = jsonNode.get("rage_amount").asInt();
- Integer yellAmount = jsonNode.get("yell_amount").asInt();
- Integer headpatAmount = jsonNode.get("headpat_amount").asInt();
- Integer cryAmount = jsonNode.get("cry_amount").asInt();
- Integer danceAmount = jsonNode.get("dance_amount").asInt();
- Integer dabAmount = jsonNode.get("dab_amount").asInt();
- Integer bonkAmount = jsonNode.get("bonk_amount").asInt();
- Integer sleepAmount = jsonNode.get("sleep_amount").asInt();
- Integer dieAmount = jsonNode.get("die_amount").asInt();
- Integer welcomeAmount = jsonNode.get("welcome_amount").asInt();
- Integer lickAmount = jsonNode.get("lick_amount").asInt();
- Integer shushAmount = jsonNode.get("shush_amount").asInt();
+ Integer hugAmount = jsonNode.get(InteractionType.HUG.getType()).asInt();
+ Integer punchAmount = jsonNode.get(InteractionType.PUNCH.getType()).asInt();
+ Integer kissAmount = jsonNode.get(InteractionType.KISS.getType()).asInt();
+ Integer biteAmount = jsonNode.get(InteractionType.BITE.getType()).asInt();
+ Integer blushAmount = jsonNode.get(InteractionType.BLUSH.getType()).asInt();
+ Integer cuddleAmount = jsonNode.get(InteractionType.CUDDLE.getType()).asInt();
+ Integer nomAmount = jsonNode.get(InteractionType.NOM.getType()).asInt();
+ Integer pokeAmount = jsonNode.get(InteractionType.POKE.getType()).asInt();
+ Integer slapAmount = jsonNode.get(InteractionType.SLAP.getType()).asInt();
+ Integer stabAmount = jsonNode.get(InteractionType.STAB.getType()).asInt();
+ Integer hmphAmount = jsonNode.get(InteractionType.HMPH.getType()).asInt();
+ Integer poutAmount = jsonNode.get(InteractionType.POUT.getType()).asInt();
+ Integer throwAmount = jsonNode.get(InteractionType.THROW.getType()).asInt();
+ Integer smileAmount = jsonNode.get(InteractionType.SMILE.getType()).asInt();
+ Integer stareAmount = jsonNode.get(InteractionType.STARE.getType()).asInt();
+ Integer tickleAmount = jsonNode.get(InteractionType.TICKLE.getType()).asInt();
+ Integer rageAmount = jsonNode.get(InteractionType.RAGE.getType()).asInt();
+ Integer yellAmount = jsonNode.get(InteractionType.YELL.getType()).asInt();
+ Integer headpatAmount = jsonNode.get(InteractionType.HEADPAT.getType()).asInt();
+ Integer cryAmount = jsonNode.get(InteractionType.CRY.getType()).asInt();
+ Integer danceAmount = jsonNode.get(InteractionType.DANCE.getType()).asInt();
+ Integer dabAmount = jsonNode.get(InteractionType.DAB.getType()).asInt();
+ Integer bonkAmount = jsonNode.get(InteractionType.BONK.getType()).asInt();
+ Integer sleepAmount = jsonNode.get(InteractionType.SLEEP.getType()).asInt();
+ Integer dieAmount = jsonNode.get(InteractionType.DIE.getType()).asInt();
+ Integer welcomeAmount = jsonNode.get(InteractionType.WELCOME.getType()).asInt();
+ Integer lickAmount = jsonNode.get(InteractionType.LICK.getType()).asInt();
+ Integer shushAmount = jsonNode.get(InteractionType.SHUSH.getType()).asInt();
+ Integer waveAmount = jsonNode.get(InteractionType.WAVE.getType()).asInt();
+ Integer shootAmount = jsonNode.get(InteractionType.SHOOT.getType()).asInt();
+ Integer amazedAmount = jsonNode.get(InteractionType.AMAZED.getType()).asInt();
+ Integer askAmount = jsonNode.get(InteractionType.ASK.getType()).asInt();
+ Integer boopAmount = jsonNode.get(InteractionType.BOOP.getType()).asInt();
+ Integer loveAmount = jsonNode.get(InteractionType.LOVE.getType()).asInt();
+ Integer nosebleedAmount = jsonNode.get(InteractionType.NOSEBLEED.getType()).asInt();
+ Integer okAmount = jsonNode.get(InteractionType.OK.getType()).asInt();
+ Integer uwuAmount = jsonNode.get(InteractionType.UWU.getType()).asInt();
+ Integer winkAmount = jsonNode.get(InteractionType.WINK.getType()).asInt();
return new Interaction(
hugAmount, punchAmount, kissAmount,
@@ -331,7 +341,10 @@ private Interaction parseInteraction(@NotNull JsonNode jsonNode) {
headpatAmount, cryAmount, danceAmount,
dabAmount, bonkAmount, sleepAmount,
dieAmount, welcomeAmount, lickAmount,
- shushAmount
+ shushAmount, waveAmount, shootAmount,
+ amazedAmount, askAmount, boopAmount,
+ loveAmount, nosebleedAmount, okAmount,
+ uwuAmount, winkAmount
);
}
diff --git a/src/main/java/com/beanbeanjuice/cafeapi/cafebot/interactions/users/Interaction.java b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/interactions/users/Interaction.java
index c1e9a86..0ac091d 100644
--- a/src/main/java/com/beanbeanjuice/cafeapi/cafebot/interactions/users/Interaction.java
+++ b/src/main/java/com/beanbeanjuice/cafeapi/cafebot/interactions/users/Interaction.java
@@ -37,6 +37,16 @@ public class Interaction {
private final Integer welcomeAmount;
private final Integer lickAmount;
private final Integer shushAmount;
+ private final Integer waveAmount;
+ private final Integer shootAmount;
+ private final Integer amazedAmount;
+ private final Integer askAmount;
+ private final Integer boopAmount;
+ private final Integer loveAmount;
+ private final Integer nosebleedAmount;
+ private final Integer okAmount;
+ private final Integer uwuAmount;
+ private final Integer winkAmount;
/**
* Creates a new {@link Interaction object.}
@@ -68,6 +78,16 @@ public class Interaction {
* @param welcomeAmount The {@link Integer welcomeAmount}.
* @param lickAmount The {@link Integer lickAmount}.
* @param shushAmount The {@link Integer shushAmount}.
+ * @param waveAmount The {@link Integer waveAmount}.
+ * @param shootAmount The {@link Integer shootAmount}.
+ * @param amazedAmount The {@link Integer amazedAmount}.
+ * @param askAmount The {@link Integer askAmount}.
+ * @param boopAmount The {@link Integer boopAmount}.
+ * @param loveAmount The {@link Integer loveAmount}.
+ * @param nosebleedAmount The {@link Integer nosebleedAmount}.
+ * @param okAmount The {@link Integer okAmount}.
+ * @param uwuAmount The {@link Integer uwuAmount}.
+ * @param winkAmount The {@link Integer winkAmount}.
*/
public Interaction(Integer hugAmount, Integer punchAmount, Integer kissAmount,
Integer biteAmount, Integer blushAmount, Integer cuddleAmount,
@@ -78,7 +98,10 @@ public Interaction(Integer hugAmount, Integer punchAmount, Integer kissAmount,
Integer headpatAmount, Integer cryAmount, Integer danceAmount,
Integer dabAmount, Integer bonkAmount, Integer sleepAmount,
Integer dieAmount, Integer welcomeAmount, Integer lickAmount,
- Integer shushAmount) {
+ Integer shushAmount, Integer waveAmount, Integer shootAmount,
+ Integer amazedAmount, Integer askAmount, Integer boopAmount,
+ Integer loveAmount, Integer nosebleedAmount, Integer okAmount,
+ Integer uwuAmount, Integer winkAmount) {
this.hugAmount = hugAmount;
this.punchAmount = punchAmount;
this.kissAmount = kissAmount;
@@ -107,6 +130,16 @@ public Interaction(Integer hugAmount, Integer punchAmount, Integer kissAmount,
this.welcomeAmount = welcomeAmount;
this.lickAmount = lickAmount;
this.shushAmount = shushAmount;
+ this.waveAmount = waveAmount;
+ this.shootAmount = shootAmount;
+ this.amazedAmount = amazedAmount;
+ this.askAmount = askAmount;
+ this.boopAmount = boopAmount;
+ this.loveAmount = loveAmount;
+ this.nosebleedAmount = nosebleedAmount;
+ this.okAmount = okAmount;
+ this.uwuAmount = uwuAmount;
+ this.winkAmount = winkAmount;
}
/**
@@ -332,4 +365,84 @@ public Integer getLickAmount() {
public Integer getShushAmount() {
return shushAmount;
}
+
+ /**
+ * @return The {@link Interaction} {@link Integer waveAmount}.
+ */
+ @NotNull
+ public Integer getWaveAmount() {
+ return waveAmount;
+ }
+
+ /**
+ * @return The {@link Interaction} {@link Integer shootAmount}.
+ */
+ @NotNull
+ public Integer getShootAmount() {
+ return shootAmount;
+ }
+
+ /**
+ * @return The {@link Interaction} {@link Integer amazedAmount}.
+ */
+ @NotNull
+ public Integer getAmazedAmount() {
+ return amazedAmount;
+ }
+
+ /**
+ * @return The {@link Interaction} {@link Integer askAmount}.
+ */
+ @NotNull
+ public Integer getAskAmount() {
+ return askAmount;
+ }
+
+ /**
+ * @return The {@link Interaction} {@link Integer boopAmount}.
+ */
+ @NotNull
+ public Integer getBoopAmount() {
+ return boopAmount;
+ }
+
+ /**
+ * @return The {@link Interaction} {@link Integer loveAmount}.
+ */
+ @NotNull
+ public Integer getLoveAmount() {
+ return loveAmount;
+ }
+
+ /**
+ * @return The {@link Interaction} {@link Integer nosebleedAmount}.
+ */
+ @NotNull
+ public Integer getNosebleedAmount() {
+ return nosebleedAmount;
+ }
+
+ /**
+ * @return The {@link Interaction} {@link Integer okAmount}.
+ */
+ @NotNull
+ public Integer getOKAmount() {
+ return okAmount;
+ }
+
+ /**
+ * @return The {@link Interaction} {@link Integer uwuAmount}.
+ */
+ @NotNull
+ public Integer getUWUAmount() {
+ return uwuAmount;
+ }
+
+ /**
+ * @return The {@link Interaction} {@link Integer winkAmount}.
+ */
+ @NotNull
+ public Integer getWinkAmount() {
+ return winkAmount;
+ }
}
diff --git a/src/test/java/com/beanbeanjuice/cafeapi/beta/GuildGoodbyeTest.java b/src/test/java/com/beanbeanjuice/cafeapi/beta/GuildGoodbyeTest.java
new file mode 100644
index 0000000..eb63180
--- /dev/null
+++ b/src/test/java/com/beanbeanjuice/cafeapi/beta/GuildGoodbyeTest.java
@@ -0,0 +1,94 @@
+package com.beanbeanjuice.cafeapi.beta;
+
+import com.beanbeanjuice.cafeapi.CafeAPI;
+import com.beanbeanjuice.cafeapi.cafebot.goodbyes.GuildGoodbye;
+import com.beanbeanjuice.cafeapi.exception.api.ConflictException;
+import com.beanbeanjuice.cafeapi.exception.api.NotFoundException;
+import com.beanbeanjuice.cafeapi.requests.RequestLocation;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+/**
+ * A test class used to test all aspects of the {@link com.beanbeanjuice.cafeapi.cafebot.goodbyes.Goodbyes} module.
+ *
+ * @author beanbeanjuice
+ */
+public class GuildGoodbyeTest {
+
+ @Test
+ @DisplayName("Test Guild Goodbyes API")
+ public void guildGoodbyesAPITest() {
+ CafeAPI cafeAPI = new CafeAPI("beanbeanjuice", System.getenv("API_PASSWORD"), RequestLocation.BETA);
+
+ // Makes sure that the amount of guilds in the guild's goodbye is more than 0.
+ Assertions.assertTrue(cafeAPI.GOODBYE.getAllGuildGoodbyes().size() > 0);
+
+ // Makes sure that the current goodbye is set properly.
+ Assertions.assertTrue(cafeAPI.GOODBYE.updateGuildGoodbye(new GuildGoodbye(
+ "798830792938881024",
+ "Goodbye... {user}... thanks for joining!",
+ "https://i.pinimg.com/originals/3f/33/75/3f3375eaef9ed7529d0e1bb5b63a814a.gif",
+ "https://i.pinimg.com/originals/3f/33/75/3f3375eaef9ed7529d0e1bb5b63a814a.gif",
+ null
+ )));
+
+ // Makes sure that the first guild is equal to the home guild ID.
+ Assertions.assertEquals("798830792938881024", cafeAPI.GOODBYE.getAllGuildGoodbyes().get(0).getGuildID());
+
+ // Makes sure that the description of the retrieved guild is "test description"
+ Assertions.assertEquals(
+ "Goodbye... {user}... thanks for joining!",
+ cafeAPI.GOODBYE.getGuildGoodbye("798830792938881024").getDescription());
+
+ // Makes sure that this throws a NotFoundException as the guild "bruhmoment" does not exist.
+ Assertions.assertThrows(NotFoundException.class, () -> {
+ cafeAPI.GOODBYE.getGuildGoodbye("bruhmoment");
+ });
+
+ // Makes sure that the guild can be updated.
+ Assertions.assertTrue(() -> {
+ GuildGoodbye currentGuildGoodbye = cafeAPI.GOODBYE.getGuildGoodbye("798830792938881024");
+
+ GuildGoodbye newGuildGoodbye = new GuildGoodbye(
+ currentGuildGoodbye.getGuildID(),
+ currentGuildGoodbye.getDescription(),
+ currentGuildGoodbye.getThumbnailURL(),
+ currentGuildGoodbye.getImageURL(),
+ "cool message!!!!"
+ );
+
+ return cafeAPI.GOODBYE.updateGuildGoodbye(newGuildGoodbye);
+ });
+
+ // Throws a conflict exception because the guild goodbye cannot be created because it already exists.
+ Assertions.assertThrows(ConflictException.class, () -> {
+ GuildGoodbye guildGoodbye = new GuildGoodbye(
+ "798830792938881024",
+ "COOL desc",
+ "cool url",
+ "cool image",
+ null
+ );
+
+ cafeAPI.GOODBYE.createGuildGoodbye(guildGoodbye);
+ });
+
+ // Makes sure that a guild can be created.
+ Assertions.assertTrue(() -> {
+ GuildGoodbye guildGoodbye = new GuildGoodbye(
+ "236331890964037632",
+ "COOL desc",
+ "cool url",
+ "cool image",
+ null
+ );
+
+ return cafeAPI.GOODBYE.createGuildGoodbye(guildGoodbye);
+ });
+
+ // Is true when a guild goodbye is successfully deleted.
+ Assertions.assertTrue(cafeAPI.GOODBYE.deleteGuildGoodbye("236331890964037632"));
+ }
+
+}
diff --git a/src/test/java/com/beanbeanjuice/cafeapi/beta/GuildInformationTest.java b/src/test/java/com/beanbeanjuice/cafeapi/beta/GuildInformationTest.java
index e7be522..7445cd5 100644
--- a/src/test/java/com/beanbeanjuice/cafeapi/beta/GuildInformationTest.java
+++ b/src/test/java/com/beanbeanjuice/cafeapi/beta/GuildInformationTest.java
@@ -88,6 +88,11 @@ public void testGuildInformationAPI() {
Assertions.assertTrue(cafeAPI.GUILD.updateGuildInformation("816880157490675732", GuildInformationType.WELCOME_CHANNEL_ID, "877240864240443412"));
Assertions.assertEquals("877240864240443412", cafeAPI.GUILD.getGuildInformation("816880157490675732").getWelcomeChannelID());
+ // Makes sure the goodbye channel ID is default and can be changed.
+ Assertions.assertEquals("0", cafeAPI.GUILD.getAllGuildInformation().get("816880157490675732").getGoodbyeChannelID());
+ Assertions.assertTrue(cafeAPI.GUILD.updateGuildInformation("816880157490675732", GuildInformationType.GOODBYE_CHANNEL_ID, "877240864240443412"));
+ Assertions.assertEquals("877240864240443412", cafeAPI.GUILD.getGuildInformation("816880157490675732").getGoodbyeChannelID());
+
// Makes sure the log channel ID is default and can be changed.
Assertions.assertEquals("0", cafeAPI.GUILD.getAllGuildInformation().get("816880157490675732").getLogChannelID());
Assertions.assertTrue(cafeAPI.GUILD.updateGuildInformation("816880157490675732", GuildInformationType.LOG_CHANNEL_ID, "857024885968732181"));
diff --git a/src/test/java/com/beanbeanjuice/cafeapi/beta/InteractionTest.java b/src/test/java/com/beanbeanjuice/cafeapi/beta/InteractionTest.java
index 4d87b49..a698480 100644
--- a/src/test/java/com/beanbeanjuice/cafeapi/beta/InteractionTest.java
+++ b/src/test/java/com/beanbeanjuice/cafeapi/beta/InteractionTest.java
@@ -112,6 +112,36 @@ public void interactionSendersAPITest() {
Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionSentAmount("879761226761109544", InteractionType.SHUSH, 37));
Assertions.assertEquals(37, cafeAPI.INTERACTION.getAllInteractionSenders().get("879761226761109544").getShushAmount());
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionSentAmount("879761226761109544", InteractionType.WAVE, 38));
+ Assertions.assertEquals(38, cafeAPI.INTERACTION.getAllInteractionSenders().get("879761226761109544").getWaveAmount());
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionSentAmount("879761226761109544", InteractionType.SHOOT, 39));
+ Assertions.assertEquals(39, cafeAPI.INTERACTION.getSpecificUserInteractionSentAmount("879761226761109544", InteractionType.SHOOT));
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionSentAmount("879761226761109544", InteractionType.AMAZED, 40));
+ Assertions.assertEquals(40, cafeAPI.INTERACTION.getAllInteractionSenders().get("879761226761109544").getAmazedAmount());
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionSentAmount("879761226761109544", InteractionType.ASK, 41));
+ Assertions.assertEquals(41, cafeAPI.INTERACTION.getAllInteractionSenders().get("879761226761109544").getAskAmount());
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionSentAmount("879761226761109544", InteractionType.BOOP, 42));
+ Assertions.assertEquals(42, cafeAPI.INTERACTION.getSpecificUserInteractionSentAmount("879761226761109544", InteractionType.BOOP));
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionSentAmount("879761226761109544", InteractionType.LOVE, 43));
+ Assertions.assertEquals(43, cafeAPI.INTERACTION.getAllInteractionSenders().get("879761226761109544").getLoveAmount());
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionSentAmount("879761226761109544", InteractionType.NOSEBLEED, 44));
+ Assertions.assertEquals(44, cafeAPI.INTERACTION.getAllInteractionSenders().get("879761226761109544").getNosebleedAmount());
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionSentAmount("879761226761109544", InteractionType.OK, 45));
+ Assertions.assertEquals(45, cafeAPI.INTERACTION.getSpecificUserInteractionSentAmount("879761226761109544", InteractionType.OK));
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionSentAmount("879761226761109544", InteractionType.UWU, 46));
+ Assertions.assertEquals(46, cafeAPI.INTERACTION.getAllInteractionSenders().get("879761226761109544").getUWUAmount());
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionSentAmount("879761226761109544", InteractionType.WINK, 47));
+ Assertions.assertEquals(47, cafeAPI.INTERACTION.getAllInteractionSenders().get("879761226761109544").getWinkAmount());
+
// Deletes the user from the database.
Assertions.assertTrue(cafeAPI.INTERACTION.deleteUserInteractionsSent("879761226761109544"));
}
@@ -217,6 +247,36 @@ public void interactionReceiversAPITest() {
Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionReceivedAmount("879761226761109544", InteractionType.SHUSH, 77));
Assertions.assertEquals(77, cafeAPI.INTERACTION.getAllInteractionReceivers().get("879761226761109544").getShushAmount());
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionReceivedAmount("879761226761109544", InteractionType.WAVE, 78));
+ Assertions.assertEquals(78, cafeAPI.INTERACTION.getAllInteractionReceivers().get("879761226761109544").getWaveAmount());
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionReceivedAmount("879761226761109544", InteractionType.SHOOT, 79));
+ Assertions.assertEquals(79, cafeAPI.INTERACTION.getSpecificUserInteractionReceivedAmount("879761226761109544", InteractionType.SHOOT));
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionReceivedAmount("879761226761109544", InteractionType.AMAZED, 60));
+ Assertions.assertEquals(60, cafeAPI.INTERACTION.getAllInteractionReceivers().get("879761226761109544").getAmazedAmount());
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionReceivedAmount("879761226761109544", InteractionType.ASK, 61));
+ Assertions.assertEquals(61, cafeAPI.INTERACTION.getAllInteractionReceivers().get("879761226761109544").getAskAmount());
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionReceivedAmount("879761226761109544", InteractionType.BOOP, 62));
+ Assertions.assertEquals(62, cafeAPI.INTERACTION.getSpecificUserInteractionReceivedAmount("879761226761109544", InteractionType.BOOP));
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionReceivedAmount("879761226761109544", InteractionType.LOVE, 63));
+ Assertions.assertEquals(63, cafeAPI.INTERACTION.getAllInteractionReceivers().get("879761226761109544").getLoveAmount());
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionReceivedAmount("879761226761109544", InteractionType.NOSEBLEED, 64));
+ Assertions.assertEquals(64, cafeAPI.INTERACTION.getAllInteractionReceivers().get("879761226761109544").getNosebleedAmount());
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionReceivedAmount("879761226761109544", InteractionType.OK, 65));
+ Assertions.assertEquals(65, cafeAPI.INTERACTION.getSpecificUserInteractionReceivedAmount("879761226761109544", InteractionType.OK));
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionReceivedAmount("879761226761109544", InteractionType.UWU, 66));
+ Assertions.assertEquals(66, cafeAPI.INTERACTION.getAllInteractionReceivers().get("879761226761109544").getUWUAmount());
+
+ Assertions.assertTrue(cafeAPI.INTERACTION.updateSpecificUserInteractionReceivedAmount("879761226761109544", InteractionType.WINK, 67));
+ Assertions.assertEquals(67, cafeAPI.INTERACTION.getAllInteractionReceivers().get("879761226761109544").getWinkAmount());
+
// Deletes the user from the database.
Assertions.assertTrue(cafeAPI.INTERACTION.deleteUserInteractionsReceived("879761226761109544"));
}
diff --git a/src/test/java/com/beanbeanjuice/cafeapi/beta/VoiceChannelBindTest.java b/src/test/java/com/beanbeanjuice/cafeapi/beta/VoiceChannelBindTest.java
index 0326add..63cef74 100644
--- a/src/test/java/com/beanbeanjuice/cafeapi/beta/VoiceChannelBindTest.java
+++ b/src/test/java/com/beanbeanjuice/cafeapi/beta/VoiceChannelBindTest.java
@@ -25,14 +25,14 @@ public void voiceChannelBindsAPITest() {
Assertions.assertTrue(cafeAPI.VOICE_CHANNEL_BIND.getAllVoiceChannelBinds().containsKey("798830792938881024"));
// Makes sure that the amount of binds in the home guild is 3.
- Assertions.assertTrue(() -> cafeAPI.VOICE_CHANNEL_BIND.getAllVoiceChannelBinds().get("798830792938881024").size() >= 3);
+ Assertions.assertTrue(() -> cafeAPI.VOICE_CHANNEL_BIND.getAllVoiceChannelBinds().get("798830792938881024").size() >= 1);
// Makes sure that the role ID specified is contained in the 2nd bind of voice channel binds in the home guild.
- Assertions.assertEquals("854169730370109491", cafeAPI.VOICE_CHANNEL_BIND.getAllVoiceChannelBinds().get("798830792938881024").get(1).getRoleID());
+ Assertions.assertEquals("854163089590059048", cafeAPI.VOICE_CHANNEL_BIND.getAllVoiceChannelBinds().get("798830792938881024").get(0).getRoleID());
// Makes sure that a ConflictException is thrown when trying to add a voice bind that already exists.
Assertions.assertThrows(ConflictException.class, () -> {
- cafeAPI.VOICE_CHANNEL_BIND.addVoiceChannelBind("798830792938881024", new VoiceChannelBind("798830793380069378", "854163089590059048"));
+ cafeAPI.VOICE_CHANNEL_BIND.addVoiceChannelBind("798830792938881024", new VoiceChannelBind("995371471230734417", "854163089590059048"));
});
// Makes sure that adding a voice bind works.
diff --git a/src/test/java/com/beanbeanjuice/cafeapi/utility/TimeTest.java b/src/test/java/com/beanbeanjuice/cafeapi/utility/TimeTest.java
index 78accfe..50c8514 100644
--- a/src/test/java/com/beanbeanjuice/cafeapi/utility/TimeTest.java
+++ b/src/test/java/com/beanbeanjuice/cafeapi/utility/TimeTest.java
@@ -60,7 +60,7 @@ public void testDatePassing() throws ParseException {
assertTrue(Time.isSameDay(new Date()));
assertFalse(Time.dateHasPassed(new Date(System.currentTimeMillis() + 120)));
- Date birthday = Time.getFullDate("07-11-2020", TimeZone.getTimeZone("EST"));
+ Date birthday = Time.getFullDate("07-6-2020", TimeZone.getTimeZone("EST"));
assertTrue(Time.dateHasPassed(birthday));
assertFalse(Time.dateHasPassed(new Date()));