Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Add 7TV emotes to nodecg-io-twitch-addons #313

Merged
merged 2 commits into from
Nov 16, 2021
Merged

Add 7TV emotes to nodecg-io-twitch-addons #313

merged 2 commits into from
Nov 16, 2021

Conversation

devJimmyboy
Copy link
Contributor

Added 7TV Emotes to the providers in nodecg-io-twitch-addons

Sadly, since Javascript variables (and object properties) can't start with numbers, I made 7tv's property on EmoteCollection 'stv' so users can access the collection with emotes.stv instead of using a string key with access through emotes["7tv"]

var emotes = await client.getEmoteCollection... // Get emotes
// Easier to access:
emotes.stv.find(v => v.name === "docSpin")
// An annoyance to access:
emotes["7tv"].find(v => v.name === "docSpin")

Since it's common to make 7TV optional (at least in the chat clients I've looked over), I also modified the second parameter of getEmoteCollection (previously a boolean for 'includeGlobal') to be more of an "options" parameter. It's now an object of type:
{ includeGlobal: boolean, include7tv: boolean } and has default values of { includeGlobal: true, include7tv: false } so users can just call getEmoteCollection(emotes) without the options.

If I missed anything in my PR then please let me know!

Heres my NodeCG console printing a test of the providers' emote lengths (the '7tv' key is just part of the test object):

A console log from me testing if all emote sources work.

Cheers!
devJimmyboy

@hlxid hlxid self-requested a review November 16, 2021 05:13
Copy link
Member

@hlxid hlxid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much

@hlxid hlxid merged commit 2c638a0 into codeoverflow-org:main Nov 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants