Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var emote = JSON.parse('{ "438": [ "34-44" ], "443": [ "0-1" ] }');
- const message = ":D :P"
- Object.keys(emote).forEach(function(key){
- console.log(key, emote[key] );
- var emoteUrl = `<img class="profImg" src="https://static-cdn.jtvnw.net/emoticons/v1/${key}/1.0" alt="${key}" id="${key}">`;
- var placement = JSON.stringify(emote[key])
- console.log(placement.indexOf('-'))
- var dashLoc = placement.indexOf('-')
- var furstnum = placement.slice(2, dashLoc )
- console.log( furstnum)
- var secondnum = placement.slice(dashLoc+1, placement.length-2)
- console.log(secondnum)
- var rmWord = message.slice(furstnum, secondnum)
- var messageNew = message.replace(rmWord, emoteUrl )
- console.log(messageNew);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement