essential-actions

Clone or download

Implement Twitch clear chat action

Modified Files

PK
p{gR4AW_META-INF/MANIFEST.MFMLK-. K-*ϳR03r.JM,IMuRp,HLHUM,KS033r*)f$ADRtR&3PK4AW_PK
p{gR META-INF/PK
p{gR
clearchat/PK
p{gRMETA-INF/maven/PK
p{gRMETA-INF/maven/com.stream-pi/PK
p{gR/META-INF/maven/com.stream-pi/twitch-clear-chat/PK
p{gRjImodule-info.classmNN0ДGy;qUWUWG!R*K "{[R]k>F1mbZ)!!JC"F8"tNJdnpi(D8!95iC6kXL5? .m+x7aW¹'% )Y%-2aFrWW?
(d#ճ7k\dž/_TU\a-,7PKjIPK
p{gRĖ\`3clearchat/ClearChatAction.classWk{~2z !0 $ ڲ jdAqjh뮥xפz$kӟYY2Fy9s{.sfqxd`E <c:fLtO.8Od|
.(3LyX`E8%&񪯣Ox!L\5יx^g |t|D_0ч/ &^ėxrgGʼnlqtrb umo![-h$9B_.8KKYNHO9#OkHOkhakD<'){/8<3j[(ʋ+G_eYb*7'EWy«NRy-ˤ}Dae ٪ԬJW2b9)/6q]uQjaӁO:g'rM+O؂k!q,q
,/ntpÜ u5l)I4iWU4u|{ŚQ4Seׂ8pwl{dIPx79,| /Wyue`WDh,{gkqWEtLw,|0(e5<ҒA-(R8_ rOJη'!?Cҕj`Ճ?)O9?~Wtj_a¯;kxʼ9nE޲' _e)WFEjj}̧;6;cSMTRO)L9VR/25Caߚ@JH`%e/؎7D *s  1 "-@ÓWת#[Tut:ntB!~3}wI9V4ٴ:sȕWIHIy㾗;Ht&4y|P4 
J> S+U4u!_|ZN@"J"Ɲ+qv͕Ӷ[dZJ7&,ݮToS^_O/+Qq'X} kXS?'<v6t{rnyAjFxJoWMùV]X?gpK'Tl9۔$dhU*4M[z[<vz.]"_tn:{<71ƞ:{MyRvvU\.^̏S
l/ǓZdĐ~5רfh8ͲD52n(u!c$V,"ôMmrd[D&D͙FL{"
3Bg&iEҴtw=d۰5OMuۧNT$lm,u]37&ZŶB2a{rG;H"j! v(҄B#"\(_e?0 \݅{2zSMR@ #{tEoF8m$Ä:3(B*uuQP SLMi%TqBxȃ{!1v㤅k4&W6Q*6<G(qgt'xlQlDXرfMqĺw@QJPzCaNsyUV4oitPKĖ\`3PK
ڊfRi0" 6META-INF/maven/com.stream-pi/twitch-clear-chat/pom.xmlV]o }ϯeqUU*J1uHlcN2Mﻀ?k7yùp9.y63(֋-sVP"]/xRls`jh]^b=+) 0$dOh {yTtXY2?n@jN^(M
l·m ;|qTC/bX%E²'؎E +*&19RZ2%p
!&#2#r-uZ rɀΔf`gL"%*IYDLe#.m_SuɟN5&2~҃E>aے=5}FWBq-d r@<\vd*pO1ⶈgQU)܋v7MyxwufϦugGw+Tzh,Baϱ-)T:5S,lrCx$epH6SRA2jԛ؆<*1#Ez`=n\sOc'BEJhhMhby?RµawJV$zt tƔhu{aw,؆C;a}JS73v9),4vyDÅ}LeއKŮgPKi0" PK
p{gR9<\`=META-INF/maven/com.stream-pi/twitch-clear-chat/pom.properties 1
0 (87T7qr1F[жĨ{A;/H7'@ $_e\:ÕhP4H>Q)8Q@57sjPK9<\`PKp{gR4AW_META-INF/MANIFEST.MFPK
p{gR AMETA-INF/PK
p{gR
Aclearchat/PK
p{gRAMETA-INF/maven/PK
p{gRAMETA-INF/maven/com.stream-pi/PK
p{gR/APMETA-INF/maven/com.stream-pi/twitch-clear-chat/PKp{gRjImodule-info.classPKp{gRĖ\`3clearchat/ClearChatAction.classPKڊfRi0" 6 META-INF/maven/com.stream-pi/twitch-clear-chat/pom.xmlPKp{gR9<\`= META-INF/maven/com.stream-pi/twitch-clear-chat/pom.propertiesPK

M build.sh
+4 −1
#!/bin/bash
#!/bin/bash
FOLD=../PreBuiltPlugins
FOLD=../PreBuiltPlugins
hotkey() {
hotkey() {
pushd . || exit
pushd . || exit
cd hotkeyaction && mvn clean package
cd hotkeyaction && mvn clean package
mv target/hotkeyaction-1.0.0.jar $FOLD/hotkeyaction.jar
mv target/hotkeyaction-1.0.0.jar $FOLD/hotkeyaction.jar
popd || exit
popd || exit
}
}
mediakey() {
mediakey() {
pushd . || exit
pushd . || exit
cd mediakeyaction && mvn clean package
cd mediakeyaction && mvn clean package
mv target/mediakeyaction-1.0.0.jar $FOLD/mediakeyaction.jar
mv target/mediakeyaction-1.0.0.jar $FOLD/mediakeyaction.jar
popd || exit
popd || exit
}
}
obssuite() {
obssuite() {
pushd . || exit
pushd . || exit
cd obssuite/mother && mvn clean install package
cd obssuite/mother && mvn clean install package
mv target/obssuite_motheraction-1.0.0.jar ../$FOLD/obssuite_motheraction.jar
mv target/obssuite_motheraction-1.0.0.jar ../$FOLD/obssuite_motheraction.jar
cd ../setcurrentprofile && mvn clean package
cd ../setcurrentprofile && mvn clean package
mv target/obssuite_setcurrentprofileaction-1.0.0.jar ../$FOLD/obssuite_setcurrentprofileaction.jar
mv target/obssuite_setcurrentprofileaction-1.0.0.jar ../$FOLD/obssuite_setcurrentprofileaction.jar
cd ../setcurrentscene && mvn clean package
cd ../setcurrentscene && mvn clean package
mv target/obssuite_setcurrentsceneaction-1.0.0.jar ../$FOLD/obssuite_setcurrentsceneaction.jar
mv target/obssuite_setcurrentsceneaction-1.0.0.jar ../$FOLD/obssuite_setcurrentsceneaction.jar
cd ../setcurrenttransition && mvn clean package
cd ../setcurrenttransition && mvn clean package
mv target/obssuite_setcurrenttransitionaction-1.0.0.jar ../$FOLD/obssuite_setcurrenttransitionaction.jar
mv target/obssuite_setcurrenttransitionaction-1.0.0.jar ../$FOLD/obssuite_setcurrenttransitionaction.jar
cd ../setmute && mvn clean package
cd ../setmute && mvn clean package
mv target/obssuite_setmuteaction-1.0.0.jar ../$FOLD/obssuite_setmuteaction.jar
mv target/obssuite_setmuteaction-1.0.0.jar ../$FOLD/obssuite_setmuteaction.jar
cd ../setcurrentprofile && mvn clean package
cd ../setcurrentprofile && mvn clean package
mv target/obssuite_setcurrentprofileaction-1.0.0.jar ../$FOLD/obssuite_setcurrentprofileaction.jar
mv target/obssuite_setcurrentprofileaction-1.0.0.jar ../$FOLD/obssuite_setcurrentprofileaction.jar
cd ../setpreviewscene && mvn clean package
cd ../setpreviewscene && mvn clean package
mv target/obssuite_setpreviewsceneaction-1.0.0.jar ../$FOLD/obssuite_setpreviewsceneaction.jar
mv target/obssuite_setpreviewsceneaction-1.0.0.jar ../$FOLD/obssuite_setpreviewsceneaction.jar
cd ../setrecording && mvn clean package
cd ../setrecording && mvn clean package
mv target/obssuite_setrecordingaction-1.0.0.jar ../$FOLD/obssuite_setrecordingaction.jar
mv target/obssuite_setrecordingaction-1.0.0.jar ../$FOLD/obssuite_setrecordingaction.jar
cd ../setreplaybuffer && mvn clean package
cd ../setreplaybuffer && mvn clean package
mv target/obssuite_setreplaybufferaction-1.0.0.jar ../$FOLD/obssuite_setreplaybufferaction.jar
mv target/obssuite_setreplaybufferaction-1.0.0.jar ../$FOLD/obssuite_setreplaybufferaction.jar
cd ../setstreaming && mvn clean package
cd ../setstreaming && mvn clean package
mv target/obssuite_setstreamingaction-1.0.0.jar ../$FOLD/obssuite_setstreamingaction.jar
mv target/obssuite_setstreamingaction-1.0.0.jar ../$FOLD/obssuite_setstreamingaction.jar
cd ../setstudiomode && mvn clean package
cd ../setstudiomode && mvn clean package
mv target/obssuite_setstudiomodeaction-1.0.0.jar ../$FOLD/obssuite_setstudiomodeaction.jar
mv target/obssuite_setstudiomodeaction-1.0.0.jar ../$FOLD/obssuite_setstudiomodeaction.jar
cd ../setvolume && mvn clean package
cd ../setvolume && mvn clean package
mv target/obssuite_setvolumeaction-1.0.0.jar ../$FOLD/obssuite_setvolumeaction.jar
mv target/obssuite_setvolumeaction-1.0.0.jar ../$FOLD/obssuite_setvolumeaction.jar
popd || exit
popd || exit
}
}
playaudioclip() {
playaudioclip() {
pushd . || exit
pushd . || exit
cd playaudioclipaction && mvn clean package
cd playaudioclipaction && mvn clean package
mv target/playaudioclipaction-1.0.0.jar $FOLD/playaudioclipaction.jar
mv target/playaudioclipaction-1.0.0.jar $FOLD/playaudioclipaction.jar
popd || exit
popd || exit
}
}
runcommand() {
runcommand() {
pushd . || exit
pushd . || exit
cd runcommandaction && mvn clean package
cd runcommandaction && mvn clean package
mv target/runcommandaction-1.0.0.jar $FOLD/runcommandaction.jar
mv target/runcommandaction-1.0.0.jar $FOLD/runcommandaction.jar
popd || exit
popd || exit
}
}
textblock() {
textblock() {
pushd . || exit
pushd . || exit
cd textblockaction && mvn clean package
cd textblockaction && mvn clean package
mv target/textblockaction-1.0.0.jar $FOLD/textblockaction.jar
mv target/textblockaction-1.0.0.jar $FOLD/textblockaction.jar
popd || exit
popd || exit
}
}
twitter() {
twitter() {
pushd . || exit
pushd . || exit
cd twitteraction && mvn clean package
cd twitteraction && mvn clean package
mv target/twitteraction-1.0.0.jar $FOLD/twitteraction.jar
mv target/twitteraction-1.0.0.jar $FOLD/twitteraction.jar
popd || exit
popd || exit
}
}
twitchchat() {
twitchchat() {
pushd . || exit
pushd . || exit
cd twitch/twitch-chat-connect && mvn clean install package
cd twitch/twitch-chat-connect && mvn clean install package
mv target/twitch-chat-connect-1.0.0.jar ../$FOLD/twitch-chat-connect.jar
mv target/twitch-chat-connect-1.0.0.jar ../$FOLD/twitch-chat-connect.jar
cd ../send-channel-msg && mvn clean package
cd ../send-channel-msg && mvn clean install package
mv target/twitch-send-channel-msg-1.0.0.jar ../$FOLD/twitch-send-channel-msg.jar
mv target/twitch-send-channel-msg-1.0.0.jar ../$FOLD/twitch-send-channel-msg.jar
cd ../clear-chat && mvn clean install package
mv target/twitch-clear-chat-1.0.0.jar ../$FOLD/twitch-clear-chat.jar
popd || exit
popd || exit
}
}
websiteaction() {
websiteaction() {
pushd . || exit
pushd . || exit
cd websiteaction && mvn clean package
cd websiteaction && mvn clean package
mv target/websiteaction-1.0.0.jar $FOLD/websiteaction.jar
mv target/websiteaction-1.0.0.jar $FOLD/websiteaction.jar
popd || exit
popd || exit
}
}
case "$1" in
case "$1" in
hotkey)
hotkey)
hotkey
hotkey
;;
;;
mediakey)
mediakey)
mediakey
mediakey
;;
;;
playaudioclip)
playaudioclip)
playaudioclip
playaudioclip
;;
;;
runcommand)
runcommand)
runcommand
runcommand
;;
;;
textblock)
textblock)
textblock
textblock
;;
;;
twitter)
twitter)
twitter
twitter
;;
;;
website)
website)
website
website
;;
;;
obssuite)
obssuite)
obssuite
obssuite
;;
;;
twitchchat)
twitchchat)
twitchchat
twitchchat
;;
;;
*)
*)
# build all actions as default
# build all actions as default
hotkey
hotkey
mediakey
mediakey
obssuite
obssuite
playaudioclip
playaudioclip
runcommand
runcommand
textblock
textblock
twitter
twitter
twitchchat
twitchchat
website
website
;;
;;
esac
esac
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.stream-pi</groupId>
<artifactId>twitch-clear-chat</artifactId>
<version>1.0.0</version>
<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>
<streamPiTwitchChatConnectVersion>1.0.0</streamPiTwitchChatConnectVersion>
<javaTwirkVersion>0.6.3</javaTwirkVersion>
</properties>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>test-jar</id>
<phase>package</phase>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.stream-pi</groupId>
<artifactId>util</artifactId>
<version>${streamPiUtilVersion}</version>
</dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<artifactId>action-api</artifactId>
<version>${streamPiActionApiVersion}</version>
</dependency>
<dependency>
<groupId>com.github.gikkman</groupId>
<artifactId>Java-Twirk</artifactId>
<version>${javaTwirkVersion}</version>
</dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<artifactId>twitch-chat-connect</artifactId>
<version>${streamPiTwitchChatConnectVersion}</version>
</dependency>
</dependencies>
</project>
package clearchat;
import com.gikk.twirk.Twirk;
import com.gikk.twirk.TwirkBuilder;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.normalaction.NormalAction;
import com.stream_pi.util.exception.StreamPiException;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
import java.util.UUID;
public class ClearChatAction extends NormalAction
{
private static final String CHANNEL_NAME_KEY = UUID.randomUUID().toString();
private Twirk twirk;
@Override
public void initProperties() throws Exception
{
setName("Clear Chat");
setCategory("Twitch Chat");
setVisibilityInServerSettingsPane(false);
setAuthor("j4ckofalltrades");
setVersion(new Version(1, 0, 0));
setHelpLink("https://github.com/stream-pi/essentialactions#twitch-chat-integration");
}
@Override
public void initAction() throws Exception
{
Property channelName = new Property(CHANNEL_NAME_KEY, Type.STRING);
channelName.setDisplayName("Channel Name");
channelName.setDefaultValueStr("channel_name");
channelName.setCanBeBlank(false);
addClientProperties(channelName);
}
@Override
public void onActionClicked() throws Exception
{
final TwitchChatCredentials.ChatCredentials credentials = TwitchChatCredentials.getCredentials();
credentials.ensureCredentialsInitialized();
final String channel = getClientProperties().getSingleProperty(CHANNEL_NAME_KEY).getStringValue();
try
{
twirk = new TwirkBuilder(channel, credentials.getNickname(), credentials.getOauthToken()).build();
twirk.connect();
twirk.channelMessage("/clear");
} catch (Exception ex)
{
throw new StreamPiException(
"Failed to clear channel chat",
String.format("Could not clear chat for '%s' channel, please try again.", channel)
);
}
}
@Override
public void onShutDown() throws Exception
{
twirk.close();
}
}
module com.stream_pi.twitch.clearchataction {
requires com.stream_pi.util;
requires com.stream_pi.action_api;
requires com.stream_pi.twitchchatconnectaction;
requires Java.Twirk;
provides com.stream_pi.action_api.normalaction.NormalAction with clearchat.ClearChatAction;
}