From 01219ebf6515644bbe601ec84e452f08889d943b Mon Sep 17 00:00:00 2001 From: PinkGoosik Date: Mon, 6 May 2024 01:37:31 +0500 Subject: [PATCH] update production deployment --- .github/workflows/build.yml | 6 ++++++ .../java/ru/pinkgoosik/kitsun/feature/KitsunDebugger.java | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a03d1f5..e2565ab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,3 +30,9 @@ jobs: with: name: Artifacts path: build/libs/kitsun.jar + - name: Deploy Stage + uses: fjogeleit/http-request-action@v1 + with: + url: ${{ secrets.RESTART_URL }} + method: 'GET' + preventFailureOnNoResponse: 'true' diff --git a/src/main/java/ru/pinkgoosik/kitsun/feature/KitsunDebugger.java b/src/main/java/ru/pinkgoosik/kitsun/feature/KitsunDebugger.java index dbd1fbd..c78fede 100644 --- a/src/main/java/ru/pinkgoosik/kitsun/feature/KitsunDebugger.java +++ b/src/main/java/ru/pinkgoosik/kitsun/feature/KitsunDebugger.java @@ -1,11 +1,10 @@ package ru.pinkgoosik.kitsun.feature; -import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.session.ReadyEvent; import ru.pinkgoosik.kitsun.Bot; import java.util.ArrayList; -import java.util.Objects; public class KitsunDebugger { private static String debugChannel = "967506328190877726"; @@ -34,7 +33,9 @@ private static void sendMessage(String text) { if(reported.equals(text)) return; } try { - Objects.requireNonNull(Bot.jda.getChannelById(MessageChannelUnion.class, debugChannel)).sendMessage(text).queue(); + if(Bot.jda.getGuildChannelById(debugChannel) instanceof TextChannel textChannel) { + textChannel.sendMessage(text).queue(); + } CACHE.add(text); } catch(Exception e) {