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

monkaSTEER in bttv doesn't work right. #5

Open
chrisyroid opened this issue Feb 12, 2022 · 6 comments
Open

monkaSTEER in bttv doesn't work right. #5

chrisyroid opened this issue Feb 12, 2022 · 6 comments
Labels
bug Something isn't working question Further information is requested

Comments

@chrisyroid
Copy link

It outputs in the console as https://cdn.betterttv.net/emote/5ed0fd17f54be95e2a835054/3x TEER

@smilefx smilefx added the question Further information is requested label Feb 12, 2022
@smilefx
Copy link
Owner

smilefx commented Feb 12, 2022

Could you please elaborate on the issue?

I have tested it with the newest version (thought it might be caused by "monkaS" getting replaced instead of "monkaSTEER") but wasn't able to reproduce the issue.

@chrisyroid
Copy link
Author

To me, it still doesn't parse right. Here's the full output:

adventdolphinrider: <img class="message-emote"src="https://cdn.betterttv.net/emote/56e9f494fff3cc5c35e5287e/3x"/>TEER [ { name: 'broadcaster/1', info: 'Broadcaster', img: 'https://static-cdn.jtvnw.net/badges/v1/5527c58c-fb7d-422d-b71b-f309dcb85cc1/3' }, { name: 'subscriber/3012', info: '1-Year Subscriber', img: 'https://static-cdn.jtvnw.net/badges/v1/e77a1dc2-a53e-464e-9d39-25bed983fa73/3' }, { name: 'sub-gifter/25', info: '25 Gift Subs', img: 'https://static-cdn.jtvnw.net/badges/v1/17e09e26-2528-4a04-9c7f-8518348324d1/3' } ]

@chrisyroid
Copy link
Author

Is there something I'm not doing correctly? I was thinking there might be a conflict but I'm not seeing any on my end.

@chrisyroid
Copy link
Author

I see what's going on. The parser is seeing conflicts. If I'm using a channel with monkaS and another with monkaSTEER it defaults to parsing monkaS.

@smilefx
Copy link
Owner

smilefx commented Feb 15, 2022

The parser should only parse the emotes in one message for the respective channel you input into the replaceEmotes() function?

It loads the emotes for the channel in the beginning, then it replaces the message with the emotes from that channel, starting with the longest Emote first... So monkaSTEER would get replaced before monkaS, because the ID is longer. Therefore it should not lead to any problems. 🤔

Have you tried getEmotes() (working the same way as replaceEmotes()) already? This will return a JSON of all Emotes found in the message instead of directly replacing them. This might be useful for debugging!

Also would you be able to provide me with a slightly longer code sample? I can't seem to figure out the problem either... 😇

@smilefx smilefx added the bug Something isn't working label Feb 15, 2022
@chrisyroid
Copy link
Author

chrisyroid commented Feb 15, 2022

Here's the code I'm using:

const emoteParser = require("tmi-emote-parse");

const tmi = require("tmi.js");

client = new tmi.Client({
    options: {
        debug: false
    },
    connection: {
        reconnect: true,
        secure: true
    },
    channels: [ '#adventdolphinrider' ] /* Channels to join with leading '#' */
});
client.connect();

client.on('message', (channel, userstate, message, self) => {
    console.log(userstate.username + ': ' + emoteParser.replaceEmotes(message, userstate, channel, self));
    console.log(emoteParser.getBadges(userstate, channel));
});

emoteParser.loadAssets("adventdolphinrider", { "bttv": true, "ffz": false, "7tv": false });
emoteParser.loadAssets("Zlodji", { "bttv": true, "ffz": false, "7tv": false });
emoteParser.loadAssets("witly", { "bttv": true, "ffz": false, "7tv": false });
console.log('Twitch is now listening...');
console.log('Press CTRL+C to quit.');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants