From: rnayabed Date: Mon, 01 Mar 2021 17:45:21 +0530 Subject: Small optimisations to twitch plugin --- Small optimisations to twitch plugin --- --- 'a/twitch/send-channel-msg/pom.xml' +++ b/twitch/send-channel-msg/pom.xml @@ -11,8 +11,8 @@ 11 11 - 1.0.0 - 1.0.0 + 1.0.0-SNAPSHOT + 1.0.0-SNAPSHOT 1.0.0 0.6.3 @@ -78,4 +78,4 @@ - \ No newline at end of file + --- 'a/twitch/send-channel-msg/src/main/java/sendchannelmsg/SendChannelMessageAction.java' +++ b/twitch/send-channel-msg/src/main/java/sendchannelmsg/SendChannelMessageAction.java @@ -7,6 +7,7 @@ import com.stream_pi.action_api.actionpr import com.stream_pi.action_api.normalaction.NormalAction; import com.stream_pi.util.alert.StreamPiAlert; import com.stream_pi.util.alert.StreamPiAlertType; +import com.stream_pi.util.exception.StreamPiException; import com.stream_pi.util.version.Version; import connect.chat.TwitchChatCredentials; @@ -56,12 +57,7 @@ public class SendChannelMessageAction ex TwitchChatCredentials.ChatCredentials credentials = TwitchChatCredentials.getCredentials(); if (!isChatCredentialsInitialized(credentials)) { - new StreamPiAlert( - "Twitch Chat plugin configuration uninitialized", - "Please check that the Twitch Chat plugin configuration is correct.", - StreamPiAlertType.ERROR - ).show(); - return; + throw new StreamPiException("Twitch Chat uninitialized.","Please check that the Twitch Chat plugin configuration is correct."); } final String channel = getClientProperties().getSingleProperty(TWITCH_CHANNEL_NAME_KEY).getStringValue(); @@ -78,12 +74,11 @@ public class SendChannelMessageAction ex twirk.channelMessage(message); } catch (Exception ex) { - new StreamPiAlert( + throw new StreamPiException( "Failed to send channel message", String.format("Could not send message '%s' to '%s' channel, please try again.", - channel, message), - StreamPiAlertType.ERROR - ).show(); + channel, message) + ); } }