essential-actions

Clone or download

Small optimisations to twitch plugin

Modified Files

--- 'a/twitch/send-channel-msg/pom.xml'
+++ b/twitch/send-channel-msg/pom.xml
@@ -11,8 +11,8 @@
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
- <streamPiActionApiVersion>1.0.0</streamPiActionApiVersion>
- <streamPiUtilVersion>1.0.0</streamPiUtilVersion>
+ <streamPiActionApiVersion>1.0.0-SNAPSHOT</streamPiActionApiVersion>
+ <streamPiUtilVersion>1.0.0-SNAPSHOT</streamPiUtilVersion>
<streamPiTwitchChatConnectVersion>1.0.0</streamPiTwitchChatConnectVersion>
<javaTwirkVersion>0.6.3</javaTwirkVersion>
</properties>
@@ -78,4 +78,4 @@
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
--- '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)
+ );
}
}