Skip to content

Commit

Permalink
fix: remove control character suffix in action event message (#526)
Browse files Browse the repository at this point in the history
* fix: remove control character suffix in action event message

* chore: deprecate crowd chant due to twitch announcement
  • Loading branch information
iProdigy committed Feb 1, 2022
1 parent c2c763a commit dd80aae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Expand Up @@ -92,14 +92,15 @@ public void onChannelMessage(IRCMessageEvent event) {
// Load Info
EventChannel channel = event.getChannel();
EventUser user = event.getUser();
String message = event.getMessage().get();

// Dispatch Event
if(event.getMessage().get().startsWith("\u0001ACTION ")) {
if (message.startsWith("\u0001ACTION ") && message.endsWith("\u0001")) {
// Action
eventManager.publish(new ChannelMessageActionEvent(channel, event, user, event.getMessage().get().substring(8), event.getClientPermissions()));
eventManager.publish(new ChannelMessageActionEvent(channel, event, user, message.substring(8, message.length() - 1), event.getClientPermissions()));
} else {
// Regular Message
eventManager.publish(new ChannelMessageEvent(channel, event, user, event.getMessage().get(), event.getClientPermissions()));
eventManager.publish(new ChannelMessageEvent(channel, event, user, message, event.getClientPermissions()));
}
}
}
Expand Down
Expand Up @@ -70,10 +70,13 @@ public class ChannelMessageEvent extends AbstractChannelEvent implements Replyab

/**
* Information regarding any associated Crowd Chant for this message, if applicable.
*
* @deprecated <a href="https://twitter.com/TwitchSupport/status/1486036628523073539">Will be disabled on 2022-02-02</a>
*/
@Nullable
@Unofficial
@Getter(lazy = true)
@Deprecated
ChatCrowdChant chantInfo = ChatCrowdChant.parse(getMessageEvent());

/**
Expand Down
Expand Up @@ -18,9 +18,11 @@
* Information regarding a Crowd Chant participation or initiation.
*
* @see <a href="https://twitch.uservoice.com/forums/310201-chat/suggestions/43451310--test-crowd-chant">Related Uservoice</a>
* @deprecated <a href="https://twitter.com/TwitchSupport/status/1486036628523073539">Will be disabled on 2022-02-02</a>
*/
@Value
@Unofficial
@Deprecated
public class ChatCrowdChant {

public static final String CHANT_MSG_ID_TAG_NAME = "crowd-chant-parent-msg-id";
Expand Down Expand Up @@ -51,8 +53,10 @@ public class ChatCrowdChant {
* Sends the same message in the same channel to participate in the Crowd Chant, with the proper chat tag.
*
* @param chat an authenticated TwitchChat instance.
* @deprecated <a href="https://twitter.com/TwitchSupport/status/1486036628523073539">Will be disabled on 2022-02-02</a>
*/
@Unofficial
@Deprecated
public void participate(ITwitchChat chat) {
Map<String, Object> tags = new LinkedHashMap<>();
tags.put(NONCE_TAG_NAME, CryptoUtils.generateNonce(32));
Expand Down

0 comments on commit dd80aae

Please sign in to comment.