Skip to content

Commit

Permalink
2nd attempt at fix (#516)
Browse files Browse the repository at this point in the history
* 2nd attempt at fix

* lowercase
  • Loading branch information
ftwpala authored Nov 13, 2023
1 parent ec8f451 commit 63d6a86
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion assets/chat/js/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const TAGS = [
"weeb",
];

const SEASON = "june";
const SEASON = "december";

module.exports = {
KEYCODES,
Expand Down
4 changes: 2 additions & 2 deletions assets/chat/js/formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function moveModifierToFront(modifierList, modifierName) {
return modifierList;
}

class IdentityFormatter {
class DisabledFormatter {
format(chat, str, message = null) {
return str;
}
Expand Down Expand Up @@ -750,7 +750,7 @@ export {
EmoteFormatter,
GreenTextFormatter,
HtmlTextFormatter,
IdentityFormatter,
DisabledFormatter,
MentionedUserFormatter,
RawEmoteFormatter,
SpoilerFormatter,
Expand Down
14 changes: 9 additions & 5 deletions assets/chat/js/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
HtmlTextFormatter,
MentionedUserFormatter,
UrlFormatter,
IdentityFormatter,
DisabledFormatter,
CodeFormatter,
SpoilerFormatter
} from "./formatters";
Expand Down Expand Up @@ -36,9 +36,9 @@ formatters.set("green", new GreenTextFormatter());

function setFormattersFromSettings(settings) {
if (!settings.get("formatter-emote"))
formatters.set("emote", new IdentityFormatter());
formatters.set("emote", new DisabledFormatter());
if (!settings.get("formatter-green"))
formatters.set("green", new IdentityFormatter());
formatters.set("green", new DisabledFormatter());
}

function buildMessageTxt(chat, message) {
Expand Down Expand Up @@ -440,9 +440,12 @@ function ChatEmoteMessageCount(message) {
if (!message._combo) console.error("no combo", message._combo);
message._combo.attr("class", "chat-combo" + stepClass);

// TODO: currently this does not get hit on "2x" combos, and requires a hack to get swarm emotes to work properly.
// consider finding the reason why it isn't going into this function on "2x" combos and swarm emote hack in the "afterRender" function in the ChatEmoteMessage class
if (
SWARM_EMOTES.includes(message.message.split(":")[0]) &&
message.emotecount <= 6
message.emotecount <= 6 &&
formatters.get("emote").constructor.name !== "DisabledFormatter"
) {
message._text.attr("class", message.message.split(":")[0] + "Combo");

Expand Down Expand Up @@ -495,7 +498,8 @@ class ChatEmoteMessage extends ChatMessage {
this._combo_txt
);

if (SWARM_EMOTES.includes(this.message.split(":")[0])) {
// this fixes a bug when a swarm emote hits "2x" it does not enter the ChatEmoteMessageCount function until 3x
if (SWARM_EMOTES.includes(this.message.split(":")[0]) && formatters.get("emote").constructor.name !== "DisabledFormatter") {
this._text.attr("class", this.message.split(":")[0] + "Combo");
this._text.append(
`${formatters.get("emote").format(chat, this.message, this)}`
Expand Down

0 comments on commit 63d6a86

Please sign in to comment.