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

Emoji offsets cheermote part position in parseEmotesAndBits #107

Closed
AlcaDesign opened this issue Feb 25, 2020 · 0 comments
Closed

Emoji offsets cheermote part position in parseEmotesAndBits #107

AlcaDesign opened this issue Feb 25, 2020 · 0 comments
Labels

Comments

@AlcaDesign
Copy link
Contributor

Bug Report

Emoji before a cheermote offsets the position of the cheermote in the message parts.

Raw IRC:

@badge-info=;badges=bits/100;bits=100;color=;display-name=pine_bunnie1;emotes=;flags=;id=7d4a6c59-a71d-433c-8b40-7ddc665512be;mod=0;room-id=181224914;subscriber=0;tmi-sent-ts=1582585694676;turbo=0;user-id=480609770;user-type= :pine_bunnie1!pine_bunnie1@pine_bunnie1.tmi.twitch.tv PRIVMSG #natehill :you a cutie Nate 🥰 Cheer100

Message: you a cutie Nate 🥰 Cheer100

Code

chatClient.onPrivmsg(async (channel, login, message, msg) => {
    if(!msg.isCheer) return;
    const cheermotes = await twitchClient.kraken.bits.getCheermotes(msg.channelId, true);
    const messageParts = msg.parseEmotesAndBits(cheermotes);
    console.log(messageParts);
});

Expected behavior

[
  {
    type: 'text',
    position: 0,
    length: 20,
    text: 'you a cutie Nate 🥰 C'
  },
  {
    type: 'cheer',
    position: 20,
    length: 8,
    name: 'cheer',
    amount: 100,
    displayInfo: {
      url: 'https://d3aqoihi2n8ty8.cloudfront.net/actions/cheer/dark/static/100/1.png',        
      color: '#9c3ee8'
    }
  }
]

Actual Behavior

[
  {
    type: 'text',
    position: 0,
    length: 20,
    text: 'you a cutie Nate 🥰 '
  },
  {
    type: 'cheer',
    position: 20,
    length: 8,
    name: 'cheer',
    amount: 100,
    displayInfo: {
      url: 'https://d3aqoihi2n8ty8.cloudfront.net/actions/cheer/dark/static/100/1.png',        
      color: '#9c3ee8'
    }
  }
]

Environment

  • Version: 4.0.3
  • Node version: 13.9.0
  • Operating system: Ubuntu 18.04 via WSL on Windows 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants