Skip to content

Commit

Permalink
no return
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkGoosik committed May 25, 2024
1 parent 86661b3 commit d594aa7
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
import ru.pinkgoosik.kitsun.util.ChannelUtils;
import ru.pinkgoosik.kitsun.util.ServerUtils;

import java.util.ArrayList;

public class ModUpdateWebhook extends KitsunHttpHandler {

public static ArrayList<String> publishedVersions = new ArrayList<>();

@Override
public void handle(HttpExchange exchange) {
var map = parseParams(exchange);
Expand All @@ -34,7 +38,8 @@ public void handle(HttpExchange exchange) {
var project = Modrinth.getProject(map.get("project"));
var versions = Modrinth.getVersions(map.get("project"));

if(project.isPresent() && versions.isPresent() && Bot.jda.getGuildChannelById(map.get("channel")) instanceof StandardGuildMessageChannel messageChannel) {
if(project.isPresent() && versions.isPresent() && !publishedVersions.contains(versions.get().get(0).getId()) && Bot.jda.getGuildChannelById(map.get("channel")) instanceof StandardGuildMessageChannel messageChannel) {
publishedVersions.add(versions.get().get(0).getId());
messageChannel.sendMessageEmbeds(ModUpdatesPublisher.createEmbed(project.get(), versions.get().get(0))).queue(message -> {}, throwable -> {
KitsunDebugger.ping("Failed to send update message of the " + project.get() + " project due to an exception:\n" + throwable);
});
Expand Down

0 comments on commit d594aa7

Please sign in to comment.