Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove control character suffix in action event message #526

Merged
merged 2 commits into from Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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