Closed cletusc closed 9 years ago
Initially from #52, with a poll pushing me to add this. Results at the time of this post are:
Depends on #59 as I don't want to make excessive API calls; cache display name for 24 hours.
BTTV's implementation in #52:
- if (ticket.product.emoticons && ticket.product.emoticons.length) { - var badge = ticket.product.features.badge; - var channel = ticket.product.owner_name; - // Add channel badges. - if (badge) { - badge = 'http://static-cdn.jtvnw.net/jtv_user_pictures/' + [badge.prefix, badge.owner, badge.type, badge.uid, badge.sizes[0]].join('-') + '.' + badge.format; + window.Twitch.api.get("users/"+(ticket.product.owner_name || 'turbo')).done(function(owner) { + if (ticket.product.emoticons && ticket.product.emoticons.length) { + var badge = ticket.product.features.badge, + channel = owner.display_name; + // Add channel badges. + if (badge) { + badge = 'http://static-cdn.jtvnw.net/jtv_user_pictures/' + [badge.prefix, badge.owner, badge.type, badge.uid, badge.sizes[0]].join('-') + '.' + badge.format; + } + else { + badge = 'https://static-cdn.jtvnw.net/jtv_user_pictures/subscriber-star.png'; + } + emotes.subscriptions.badges[channel] = badge; + + // Add emotes channel. + ticket.product.emoticons.forEach(function (emote) { + emotes.subscriptions.emotes[getEmoteFromRegEx(new RegExp(emote.regex))] = { + channel: channel, + url: emote.url + }; + }); } - else { - badge = 'https://static-cdn.jtvnw.net/jtv_user_pictures/subscriber-star.png'; - } - emotes.subscriptions.badges[channel] = badge; - - // Add emotes channel. - ticket.product.emoticons.forEach(function (emote) { - emotes.subscriptions.emotes[getEmoteFromRegEx(new RegExp(emote.regex))] = { - channel: channel, - url: emote.url - }; - }); - } + });
Initially from #52, with a poll pushing me to add this. Results at the time of this post are:
Depends on #59 as I don't want to make excessive API calls; cache display name for 24 hours.
BTTV's implementation in #52: