essential-actions

Clone or download

Move config initialization check to central location

Modified Files

PK
n{gR4AW_META-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMuRp,HLHUM,KS033r*)f$ADRtR&3PK4AW_PK
n{gR META-INF/PK
n{gRconnect/PK
n{gR connect/chat/PK
n{gRMETA-INF/maven/PK
n{gRMETA-INF/maven/com.stream-pi/PK
n{gR1META-INF/maven/com.stream-pi/twitch-chat-connect/PK
n{gRn]?module-info.classUOMO1}
,*7Oij!`Zkd2vM3޼~|~ !B[iB7we/}qUKB>bt T 0!J<#8ISB
\\}e>ƫJZyqЪ'9gMN ș!6Jo2]/LF[
'%5!J+rՍ!7K3g+q;bQݩaxWq;|_yĨ]Blq%9PKn]?PK
n{gRVԱ%connect/TwitchChatConnectAction.classW [=#cy 8x#KdlA 44FcČ:3%ަK/ޤDviM'f$!`7w˻zWo8q0F.MG#@Ju炨Ƙ02AbsS,Z⑕zvN5\؀BAzxIYAxL-b;ڻA<q
OBC|X>QOSAx|Zgl럗 uXW"12+>rkXB6E39MaKXLLwHt J'v2ˬOft͎zJ7]C8)NOӹ Q'z4ime9׵L*]}0 pӐ굽s=ftJj!6ļX GŽ^52d:ܘґt Zq̀meu5t
\ooHڄ.>Ihں615'>Y_t4(}ɤ8ָnZl ']zV_$Ⱥeyd%!Jrn;IZrOzZfl;Ȫe(bSct=fMQMCFMi;GG'5uqD|¦dpV0~qrvR?nn]ĕB b:ɍ񌄚/
g|ϒmq뜖ɸƛsLtRȯ*.+YhtpӹY齔}||M^t1[s=g7,dsZ0GP~h8 <oJw1,a2Te,o)6#]&\n)ռ,qVQV]<q/Yy p9(3'y+JرF'({
⚂㺂Ǐc?AӲ\et7m:lpF W%ܽ@Xi-j*1#WJHԧ-'Ɏ1))06COzŘFmM̳bH9벼;jSSSZh{pVV*[֮_ iq"j&y&J0Uݶ-[Mkj%9թ4|x<5O鰧UmL3Vǫ^,eO2&Ũn^UzъhA2ގdSiLfs6d8ƨ1/_΀f{-|VHTspe{zzbP5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K$KIVj]2*ɦN7wq2C?8I((F'MEs=e螴PKL@r`PK
I cR^q8META-INF/maven/com.stream-pi/twitch-chat-connect/pom.xmlU]o }ϯeˤMVimWMb pie{\pA7\כ(hIk3VK|ݤ D-5P{Z`RPEO`wY, tkZ%NpjpM͓ZZlc\cd򀎣TWAhN5laXm5K T*nl(X(ҡ"EL
bZKniJjZj:jVR$oi 82ȩW\;%Fۆ=]ӟ+dK.icb7+<:З6\2Q ,2=#2oej#y|ݖ0ӋF^[VlsmD{hwFugs<93oj>c$F=PҚGЇ}iTp;d%Mx8lRrKb=ml0$"8Ӥ2t\dFxcy+T~E&GY7hCL#s0gh_nWD!_o!ω2JEmΏi1;͌6ƆvQN؍3;f͟}PK^qPK
n{gRyI#]b?META-INF/maven/com.stream-pi/twitch-chat-connect/pom.properties ; НS8`H
@x{(SAW9i8u|e)GhhJPX%H<A(rJLn-4`PKyI#]bPKn{gR4AW_META-INF/MANIFEST.MFPK
n{gR AMETA-INF/PK
n{gRAconnect/PK
n{gR Aconnect/chat/PK
n{gRAMETA-INF/maven/PK
n{gRA>META-INF/maven/com.stream-pi/PK
n{gR1AyMETA-INF/maven/com.stream-pi/twitch-chat-connect/PKn{gRn]?module-info.classPKn{gRVԱ% connect/TwitchChatConnectAction.classPKn{gRyg$(+ connect/chat/TwitchChatCredentials.classPKn{gRL@r`8 connect/chat/TwitchChatCredentials$ChatCredentials.classPKI cR^q8_META-INF/maven/com.stream-pi/twitch-chat-connect/pom.xmlPKn{gRyI#]b?6META-INF/maven/com.stream-pi/twitch-chat-connect/pom.propertiesPK 
PK
PK
,cR4AW_META-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMuRp,HLHUM,KS033r*)f$ADRtR&3PK4AW_PK
,cR4AW_META-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMuRp,HLHUM,KS033r*)f$ADRtR&3PK4AW_PK
,cR META-INF/PK
,cR META-INF/PK
,cRsendchannelmsg/PK
,cRsendchannelmsg/PK
,cRMETA-INF/maven/PK
,cRMETA-INF/maven/PK
,cRMETA-INF/maven/com.stream-pi/PK
,cRMETA-INF/maven/com.stream-pi/PK
,cR5META-INF/maven/com.stream-pi/twitch-send-channel-msg/PK
,cR5META-INF/maven/com.stream-pi/twitch-send-channel-msg/PK
,cRB module-info.classmP]O0=Ua*`t̘LL1M;Bu[ɫ?xHmzsz=7zp-z`D*Vd&Y:~2Y
,cRB module-info.classmP]O0=Ua*`t̘LL1M;Bu[ɫ?xHmzsz=7zp-z`D*Vd&Y:~2Y
ꠐ\3T|=m>aлޏ\8tqA-ù4OmD4knOU<3*ҩVEJõ2CκX֍\3CVrvQ=F 0\P[yI"7,H^@b7arV FXw]vPKB PK
ꠐ\3T|=m>aлޏ\8tqA-ù4OmD4knOU<3*ҩVEJõ2CκX֍\3CVrvQ=F 0\P[yI"7,H^@b7arV FXw]vPKB PK
,cR ')<W-sendchannelmsg/SendChannelMessageAction.classW֒B^q9B@P#7rM iȋ+ew8mMz7JOzЦLCMKMޮlFfͼffo؅wULFQˆi"0?b:(,!f"/(x:g\xQB9sҟ<#Dϊ'P>>g؄d(>ωU|!|Q/E ,WVQ| _*"Dqߕ{|_\GOGS'R f& N<68 9ӓnY1>-zVPp2@;o:d3ɂ9=gRS~6
,cR ')<W-sendchannelmsg/SendChannelMessageAction.classW֒B^q9B@P#7rM iȋ+ew8mMz7JOzЦLCMKMޮlFfͼffo؅wULFQˆi"0?b:(,!f"/(x:g\xQB9sҟ<#Dϊ'P>>g؄d(>ωU|!|Q/E ,WVQ| _*"Dqߕ{|_\GOGS'R f& N<68 9ӓnY1>-zVPp2@;o:d3ɂ9=gRS~6
B]c
B]c
©bVeL.LΨ>iF1[cc
©bVeL.LΨ>iF1[cc
] {S;v>7۶a͸d* ơgm[)Fbp<ӠpsUnX}DL܄0,ɅAU٬(-1 :x!gDb:p`ܴW`\P^>1홺ZTiIYJ\ 'r^NyZ&uMCj5fhzznzH/ L6؛H,z)Bwt%&2hq 1GKE;;Uϓ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QEbSCwpx/$Q!I]4ܗ~owfгM5o= o˒vA嬱ݡw`Wpmơ~!sybţ"9sH$-k 3~##IN{܉o]c+rⱊ0Y=Qt_~[E|较:Zڷp۰;5CxUvvݗJQ)Ȉ' a2u1vT2̈́ɛ'YJZwݟMqwpsHe_{N}`I^G(PKrѣ: PK
,cRQLbfCMETA-INF/maven/com.stream-pi/twitch-send-channel-msg/pom.properties ʱ
,cRQLbfCMETA-INF/maven/com.stream-pi/twitch-send-channel-msg/pom.properties ʱ
0 н_QpnP7q>"F[iis{Zv)HO;k)'hJ4X5nH^Q)åkYzPKQLbfPK,cR4AW_META-INF/MANIFEST.MFPK
0 н_QpnP7q>"F[iis{Zv)HO;k)'hJ4X5nH^Q)åkYzPKQLbfPK,cR4AW_META-INF/MANIFEST.MFPK
,cR AMETA-INF/PK
,cR AMETA-INF/PK
,cRAsendchannelmsg/PK
,cRAsendchannelmsg/PK
,cRAMETA-INF/maven/PK
,cRAMETA-INF/maven/PK
,cRAMETA-INF/maven/com.stream-pi/PK
,cRAMETA-INF/maven/com.stream-pi/PK
,cR5AUMETA-INF/maven/com.stream-pi/twitch-send-channel-msg/PK,cRB module-info.classPK,cR ')<W-sendchannelmsg/SendChannelMessageAction.classPKcRrѣ: < META-INF/maven/com.stream-pi/twitch-send-channel-msg/pom.xmlPK,cRQLbfCMETA-INF/maven/com.stream-pi/twitch-send-channel-msg/pom.propertiesPK
,cR5AUMETA-INF/maven/com.stream-pi/twitch-send-channel-msg/PK,cRB module-info.classPK,cR ')<W-sendchannelmsg/SendChannelMessageAction.classPKcRrѣ: < META-INF/maven/com.stream-pi/twitch-send-channel-msg/pom.xmlPK,cRQLbfCMETA-INF/maven/com.stream-pi/twitch-send-channel-msg/pom.propertiesPK
|
|
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>twitch-send-channel-msg</artifactId>
<artifactId>twitch-send-channel-msg</artifactId>
<version>1.0.0</version>
<version>1.0.0</version>
<properties>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.target>11</maven.compiler.target>
<streamPiActionApiVersion>1.0.0-SNAPSHOT</streamPiActionApiVersion>
<streamPiActionApiVersion>1.0.0</streamPiActionApiVersion>
<streamPiUtilVersion>1.0.0-SNAPSHOT</streamPiUtilVersion>
<streamPiUtilVersion>1.0.0</streamPiUtilVersion>
<streamPiTwitchChatConnectVersion>1.0.0</streamPiTwitchChatConnectVersion>
<streamPiTwitchChatConnectVersion>1.0.0</streamPiTwitchChatConnectVersion>
<javaTwirkVersion>0.6.3</javaTwirkVersion>
<javaTwirkVersion>0.6.3</javaTwirkVersion>
</properties>
</properties>
<repositories>
<repositories>
<repository>
<repository>
<id>jitpack.io</id>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
<url>https://jitpack.io</url>
</repository>
</repository>
</repositories>
</repositories>
<build>
<build>
<plugins>
<plugins>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<version>3.1.0</version>
<executions>
<executions>
<execution>
<execution>
<id>test-jar</id>
<id>test-jar</id>
<phase>package</phase>
<phase>package</phase>
<goals>
<goals>
<goal>test-jar</goal>
<goal>test-jar</goal>
</goals>
</goals>
</execution>
</execution>
</executions>
</executions>
</plugin>
</plugin>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.8.1</version>
<configuration>
<configuration>
<release>11</release>
<release>11</release>
</configuration>
</configuration>
</plugin>
</plugin>
</plugins>
</plugins>
</build>
</build>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>util</artifactId>
<artifactId>util</artifactId>
<version>${streamPiUtilVersion}</version>
<version>${streamPiUtilVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>action-api</artifactId>
<artifactId>action-api</artifactId>
<version>${streamPiActionApiVersion}</version>
<version>${streamPiActionApiVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.github.gikkman</groupId>
<groupId>com.github.gikkman</groupId>
<artifactId>Java-Twirk</artifactId>
<artifactId>Java-Twirk</artifactId>
<version>${javaTwirkVersion}</version>
<version>${javaTwirkVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>twitch-chat-connect</artifactId>
<artifactId>twitch-chat-connect</artifactId>
<version>${streamPiTwitchChatConnectVersion}</version>
<version>${streamPiTwitchChatConnectVersion}</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
module com.stream_pi.twitch.sendchannelmsgaction {
module com.stream_pi.twitch.sendchannelmsgaction {
requires com.stream_pi.util;
requires com.stream_pi.util;
requires com.stream_pi.action_api;
requires com.stream_pi.action_api;
requires com.stream_pi.twitchchatconnectaction;
requires com.stream_pi.twitchchatconnectaction;
requires Java.Twirk;
requires Java.Twirk;
provides com.stream_pi.action_api.normalaction.NormalAction with sendchannelmsg.SendChannelMessageAction;
provides com.stream_pi.action_api.normalaction.NormalAction with sendchannelmsg.SendChannelMessageAction;
}
}
package sendchannelmsg;
package sendchannelmsg;
import com.gikk.twirk.Twirk;
import com.gikk.twirk.Twirk;
import com.gikk.twirk.TwirkBuilder;
import com.gikk.twirk.TwirkBuilder;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.normalaction.NormalAction;
import com.stream_pi.action_api.normalaction.NormalAction;
import com.stream_pi.util.exception.StreamPiException;
import com.stream_pi.util.exception.StreamPiException;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
import connect.chat.TwitchChatCredentials;
import static connect.chat.TwitchChatCredentials.DEFAULT_TWITCH_NICKNAME;
import java.util.UUID;
import static connect.chat.TwitchChatCredentials.DEFAULT_TWITCH_TOKEN;
public class SendChannelMessageAction extends NormalAction
public class SendChannelMessageAction extends NormalAction
{
{
private static final String TWITCH_CHANNEL_NAME_KEY = "twitch_channel_name";
private static final String CHANNEL_NAME_KEY = UUID.randomUUID().toString();
private static final String TWITCH_CHANNEL_MSG_KEY = "twitch_channel_msg";
private static final String CHANNEL_MSG_KEY = UUID.randomUUID().toString();
private Twirk twirk;
private Twirk twirk;
public SendChannelMessageAction()
public SendChannelMessageAction()
{
{
setName("Send Channel Message");
setName("Send Channel Message");
setCategory("Twitch Chat");
setCategory("Twitch Chat");
setVisibilityInServerSettingsPane(false);
setVisibilityInServerSettingsPane(false);
setAuthor("j4ckofalltrades");
setAuthor("j4ckofalltrades");
setVersion(new Version(1, 0, 0));
setVersion(new Version(1, 0, 0));
setHelpLink("https://github.com/stream-pi/essentialactions");
setHelpLink("https://github.com/stream-pi/essentialactions#twitch-chat-integration");
}
}
@Override
@Override
public void initProperties() throws Exception
public void initProperties() throws Exception
{
{
Property channelName = new Property(TWITCH_CHANNEL_NAME_KEY, Type.STRING);
Property channelName = new Property(CHANNEL_NAME_KEY, Type.STRING);
channelName.setDisplayName("Channel Name");
channelName.setDisplayName("Channel Name");
channelName.setDefaultValueStr("channel_name");
channelName.setDefaultValueStr("channel_name");
channelName.setCanBeBlank(false);
channelName.setCanBeBlank(false);
Property channelMessage = new Property(TWITCH_CHANNEL_MSG_KEY, Type.STRING);
Property channelMessage = new Property(CHANNEL_MSG_KEY, Type.STRING);
channelMessage.setDisplayName("Message");
channelMessage.setDisplayName("Message");
channelMessage.setDefaultValueStr("channel_msg");
channelMessage.setDefaultValueStr("channel_msg");
channelMessage.setCanBeBlank(false);
channelMessage.setCanBeBlank(false);
addClientProperties(channelName, channelMessage);
addClientProperties(channelName, channelMessage);
}
}
@Override
@Override
public void initAction() throws Exception
public void initAction() throws Exception
{
{
}
}
@Override
@Override
public void onActionClicked() throws Exception
public void onActionClicked() throws Exception
{
{
TwitchChatCredentials.ChatCredentials credentials = TwitchChatCredentials.getCredentials();
final TwitchChatCredentials.ChatCredentials credentials = TwitchChatCredentials.getCredentials();
if (!isChatCredentialsInitialized(credentials))
credentials.ensureCredentialsInitialized();
{
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();
final String channel = getClientProperties().getSingleProperty(CHANNEL_NAME_KEY).getStringValue();
final String message = getClientProperties().getSingleProperty(TWITCH_CHANNEL_MSG_KEY).getStringValue();
final String message = getClientProperties().getSingleProperty(CHANNEL_MSG_KEY).getStringValue();
try
try
{
{
twirk = new TwirkBuilder(
twirk = new TwirkBuilder(channel, credentials.getNickname(), credentials.getOauthToken()).build();
getClientProperties().getSingleProperty(TWITCH_CHANNEL_NAME_KEY).getStringValue(),
credentials.getNickname(),
credentials.getOauthToken())
.build();
twirk.connect();
twirk.connect();
twirk.channelMessage(message);
twirk.channelMessage(message);
} catch (Exception ex)
} catch (Exception ex)
{
{
throw new StreamPiException(
throw new StreamPiException(
"Failed to send channel message",
"Failed to send channel message",
String.format("Could not send message '%s' to '%s' channel, please try again.",
String.format("Could not send message '%s' to '%s' channel, please try again.",
channel, message)
channel, message)
);
);
}
}
}
}
private boolean isChatCredentialsInitialized(TwitchChatCredentials.ChatCredentials credentials)
{
if (credentials == null)
{
return false;
}
final String twitchNickname = credentials.getNickname();
boolean isNicknameInitialized = twitchNickname != null &&
!twitchNickname.isEmpty() &&
!twitchNickname.equalsIgnoreCase(DEFAULT_TWITCH_NICKNAME);
final String twitchChatOauthToken = credentials.getOauthToken();
boolean isTokenInitialized = twitchChatOauthToken != null &&
!twitchChatOauthToken.isEmpty() &&
!twitchChatOauthToken.equalsIgnoreCase(DEFAULT_TWITCH_TOKEN);
return isNicknameInitialized && isTokenInitialized;
}
@Override
@Override
public void onShutDown() throws Exception
public void onShutDown() throws Exception
{
{
twirk.close();
twirk.close();
}
}
}
}
package connect;
package connect;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.normalaction.NormalAction;
import com.stream_pi.action_api.normalaction.NormalAction;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
import connect.chat.TwitchChatCredentials;
import javafx.scene.control.Button;
import javafx.scene.control.Button;
public class TwitchChatConnectAction extends NormalAction
public class TwitchChatConnectAction extends NormalAction
{
{
private static final String TWITCH_ACCESS_TOKEN_KEY = "twitch_access_token";
private static final String ACCESS_TOKEN_KEY = "twitch_chat_access_token";
private static final String TWITCH_NICKNAME_KEY = "twitch_nickname";
private static final String NICKNAME_KEY = "twitch_chat_nickname";
private final Button clearCredentialsBtn;
private final Button clearCredentialsBtn;
public TwitchChatConnectAction()
public TwitchChatConnectAction()
{
{
setName("Twitch Chat Plugin");
setName("Twitch Chat Plugin");
setCategory("Twitch Chat");
setCategory("Twitch Chat");
setVisibilityInPluginsPane(false);
setVisibilityInPluginsPane(false);
setAuthor("j4ckofalltrades");
setAuthor("j4ckofalltrades");
setVersion(new Version(1, 0, 0));
setVersion(new Version(1, 0, 0));
setHelpLink("https://github.com/Stream-Pi/essentialactions");
setHelpLink("https://github.com/stream-pi/essentialactions#twitch-chat-integration");
clearCredentialsBtn = new Button("Clear Twitch chat credentials");
clearCredentialsBtn = new Button("Clear Twitch chat credentials");
onClearCredentials();
onClearCredentials();
setButtonBar(clearCredentialsBtn);
setButtonBar(clearCredentialsBtn);
}
}
@Override
@Override
public void initProperties()
public void initProperties()
{
{
Property twitchNicknameProp = new Property(TWITCH_NICKNAME_KEY, Type.STRING);
Property twitchNicknameProp = new Property(NICKNAME_KEY, Type.STRING);
twitchNicknameProp.setDisplayName("Twitch Username");
twitchNicknameProp.setDisplayName("Twitch Username");
Property twitchAccessTokenProp = new Property(TWITCH_ACCESS_TOKEN_KEY, Type.STRING);
Property twitchAccessTokenProp = new Property(ACCESS_TOKEN_KEY, Type.STRING);
twitchAccessTokenProp.setDisplayName("Access Token");
twitchAccessTokenProp.setDisplayName("Access Token");
addServerProperties(twitchNicknameProp, twitchAccessTokenProp);
addServerProperties(twitchNicknameProp, twitchAccessTokenProp);
}
}
@Override
@Override
public void initAction() throws MinorException
public void initAction() throws MinorException
{
{
clearCredentialsBtn.setDisable(isEmptyCredentials());
clearCredentialsBtn.setDisable(isEmptyCredentials());
TwitchChatCredentials.setCredentials(
TwitchChatCredentials.setCredentials(
new TwitchChatCredentials.ChatCredentials()
new TwitchChatCredentials.ChatCredentials()
.setOauthToken(getServerProperties().getSingleProperty(TWITCH_ACCESS_TOKEN_KEY).getStringValue())
.setOauthToken(getServerProperties().getSingleProperty(ACCESS_TOKEN_KEY).getStringValue())
.setNickname(getServerProperties().getSingleProperty(TWITCH_NICKNAME_KEY).getStringValue()));
.setNickname(getServerProperties().getSingleProperty(NICKNAME_KEY).getStringValue()));
}
}
private boolean isEmptyCredentials() throws MinorException {
private boolean isEmptyCredentials() throws MinorException {
final String twitchNickname = getServerProperties().getSingleProperty(TWITCH_NICKNAME_KEY).getStringValue();
final String twitchNickname = getServerProperties().getSingleProperty(NICKNAME_KEY).getStringValue();
final String twitchChatOauthToken = getServerProperties().getSingleProperty(TWITCH_ACCESS_TOKEN_KEY).getStringValue();
final String twitchChatOauthToken = getServerProperties().getSingleProperty(ACCESS_TOKEN_KEY).getStringValue();
return (twitchNickname == null || twitchNickname.isEmpty()) &&
return (twitchNickname == null || twitchNickname.isEmpty()) &&
(twitchChatOauthToken == null || twitchChatOauthToken.isEmpty());
(twitchChatOauthToken == null || twitchChatOauthToken.isEmpty());
}
}
private void onClearCredentials()
private void onClearCredentials()
{
{
clearCredentialsBtn.setOnAction(action ->
clearCredentialsBtn.setOnAction(action ->
{
{
try
try
{
{
getServerProperties().getSingleProperty(TWITCH_ACCESS_TOKEN_KEY).setStringValue("");
getServerProperties().getSingleProperty(ACCESS_TOKEN_KEY).setStringValue("");
getServerProperties().getSingleProperty(TWITCH_NICKNAME_KEY).setStringValue("");
getServerProperties().getSingleProperty(NICKNAME_KEY).setStringValue("");
saveServerProperties();
saveServerProperties();
new StreamPiAlert(
new StreamPiAlert(
"Twitch chat credentials cleared",
"Twitch chat credentials cleared",
"To revoke token access, disconnect \"Twitch Chat OAuth Token Generator\" from your Twitch settings (https://www.twitch.tv/settings/connections).",
"To revoke token access, disconnect \"Twitch Chat OAuth Token Generator\" from your Twitch settings (https://www.twitch.tv/settings/connections).",
StreamPiAlertType.INFORMATION)
StreamPiAlertType.INFORMATION)
.show();
.show();
} catch (Exception e)
} catch (Exception e)
{
{
new StreamPiAlert(
new StreamPiAlert(
"Failed to save chat credentials",
"Failed to save chat credentials",
"An error has occurred while clearing chat credentials, please try again.",
"An error has occurred while clearing chat credentials, please try again.",
StreamPiAlertType.WARNING)
StreamPiAlertType.WARNING)
.show();
.show();
}
}
});
});
}
}
@Override
@Override
public void onActionClicked() throws Exception
public void onActionClicked() throws Exception
{
{
}
}
@Override
@Override
public void onShutDown() throws Exception
public void onShutDown() throws Exception
{
{
}
}
}
}
package connect.chat;
package connect.chat;
import com.stream_pi.util.exception.StreamPiException;
public final class TwitchChatCredentials
public final class TwitchChatCredentials
{
{
public static final String DEFAULT_TWITCH_NICKNAME = "twitch_username";
public static final String DEFAULT_TWITCH_TOKEN = "twitch_token";
private static ChatCredentials credentials;
private static ChatCredentials credentials;
public static ChatCredentials getCredentials()
public static ChatCredentials getCredentials()
{
{
return credentials;
return credentials;
}
}
public static void setCredentials(ChatCredentials chatCredentials)
public static void setCredentials(ChatCredentials chatCredentials)
{
{
credentials = chatCredentials;
credentials = chatCredentials;
}
}
public static class ChatCredentials
public static class ChatCredentials
{
{
String nickname;
String nickname;
String oauthToken;
String oauthToken;
public void ensureCredentialsInitialized() throws Exception {
final String twitchNickname = nickname;
boolean isNicknameInitialized = twitchNickname != null && !twitchNickname.isEmpty();
final String twitchChatOauthToken = oauthToken;
boolean isTokenInitialized = twitchChatOauthToken != null && !twitchChatOauthToken.isEmpty();
if (!isNicknameInitialized && !isTokenInitialized) {
throw new StreamPiException(
"Twitch Chat config uninitialized.",
"Please check that the Twitch Chat plugin configuration is correct.");
}
}
public String getNickname()
public String getNickname()
{
{
return nickname;
return nickname;
}
}
public ChatCredentials setNickname(String nickname)
public ChatCredentials setNickname(String nickname)
{
{
this.nickname = nickname;
this.nickname = nickname;
return this;
return this;
}
}
public String getOauthToken()
public String getOauthToken()
{
{
return oauthToken;
return oauthToken;
}
}
public ChatCredentials setOauthToken(String oauthToken)
public ChatCredentials setOauthToken(String oauthToken)
{
{
this.oauthToken = oauthToken;
this.oauthToken = oauthToken;
return this;
return this;
}
}
}
}
}
}
module com.stream_pi.twitchchatconnectaction {
module com.stream_pi.twitchchatconnectaction {
requires com.stream_pi.action_api;
requires com.stream_pi.action_api;
requires com.stream_pi.util;
requires com.stream_pi.util;
requires Java.Twirk;
requires Java.Twirk;
exports connect.chat;
exports connect.chat;
provides com.stream_pi.action_api.normalaction.NormalAction with connect.TwitchChatConnectAction;
provides com.stream_pi.action_api.normalaction.NormalAction with connect.TwitchChatConnectAction;
}
}