Code Monkey home page Code Monkey logo

emotettv's Introduction

๐Ÿณ๏ธโ€๐ŸŒˆ Non-binary (he/they) โ€ข ๐Ÿงก Svelte evangelist โ€ข ๐Ÿ‘จโ€๐Ÿ’ป Live coder โ€ข ๐Ÿ”“ FOSS supporter โ€ข ๐Ÿค“ Unicode nerd

ย 


Hello and welcome to my personal code compendium. ๐Ÿ‘‹๐Ÿ“š You can call me Doce, I'm a developer that truly enjoys to translate concept ideas to meaningful experiences.

๐Ÿ”ด I do live coding streams on Twitch from Tuesday to Thursday @ 7:30pm (BRT).

โ˜• Keep in touch:

emotettv's People

Contributors

doceazedo avatar luiz21goncalves avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

luiz21goncalves

emotettv's Issues

Add multiple return formats for parsers

Instead of the parseEmotes and parseBadges functions returning their parsing results based on predefined formats, multiple chain functions shall be added to return different formats.

The following methods will be responsible for returning the internal parsed formats - the ones that are currently returned by default:

  • parseEmotes(...).toWords()
  • parseBadges(...).toBasicArray()

The following methods shall be implemented to return different formats for user convenience:

Method:

parseEmotes(...).toHtml(size?: number) => Promise<string>

Description: Returns a string with the original message and emote codes converted to <img>

Input: Hi HeyGuys I'm an example message! popCat

Output:

Hi <img src="..." alt="HeyGuys" /> I'm an example message! <img src="..." alt="popCat" />

Method:

parseBadges(...).toHtml(size?: number) => Promise<string>

Description: Returns a string with the user badges converted to <img>

Output:

<img src="..." alt="broadcast" /> <img src="..." alt="subscriber" /> <img src="..." alt="premium" />

Method:

parseBadges(...).toMinimalArray() => Promise<BadgesMinimalArray>

Description: Returns a simplified version of the badges array, with only the image URLs in all sizes

Output:

type BadgesMinimalArray = {
  image_url_1x: string;
  image_url_2x: string;
  image_url_4x: string;
}[];

Organize modules, services and their types

  • The ffz service should be merged with the bttv one, as they use the same API.
  • The services folder shall be deleted and its files moved to their related modules, renamed as <module>.service.ts.
  • Every module that uses custom types shall have a <module>.types.ts file exporting all of its types.

Implement 7TV

Implement 7TV emotes. Docs. Handle overlay/zero-width emotes. Handle personal emotes.

Later, also parse badges (#16).

Should we handle other stuff?

  • Custom name colors
  • Custom profile pictures

parseEmotes options (and custom emote factories)

Add an options parameter for more flexibility and remove channelId in favor of it.

type ParseEmotesOptions = {
  channelId?: string;
  thirdPartyProviders?: {
    bttv?: boolean;
    ffz?: boolean;
  };
  customEmotes: EmotesFactory | EmotesFactory[]
}

Descriptions:

  • channelId being optional will allow the use of only global or custom emotes
  • thirdPartyProviders will allow to toggle third-party emotes and help adding others in the future
  • customEmotes will allow the use of custom emote factories, provided by the user

All third-party providers will be defaulted to true.

Split channel and global emote stores

If emotettv is used to parse messages from different channels, the store of every channel emotes will have their own copy of the global emotes yet they could be shared.

My proposal is to add a globaEmotesStore alongside channelEmotesStore.

This could also be achieved by adding a global key alongside the other channel IDs in the channelEmotesStore, but I think the first option is more elegant.

Allow (re)loading and clearing emotes/badges

Add these methods to the lib:

  • reloadEmotes(options)
  • clearEmotes()
  • reloadBadges(options)
  • clearBadges()

The reload functions should expect those same options of type ParseEmotesOptions described on issue #10.

As this wouldn't break any existing code, it could probably be delayed to later v1 release.

Setup GitHub Actions

It would be nice to have an action to run these steps on every pull request open:

  • Run linting and formatting checks
  • Run Jest tests (yet to be created on: #6)
  • Run build

And an action to run these on creating a new release:

  • Run build
  • Bump version (according to the release)
  • Publish package to NPM

Create documentation

I'm totally open to suggestions on the best way to document this project :) These are some of the alternatives I was thinking of:

  • Just create some Markdown files on a "docs" folder
  • Use Docz or some other alternative
  • Create a static website with Astro

If we create a static website for the docs, It would be cool to get all the info the we can automatically.

Setup automated tests

It would be cool to setup Jest with a few simple tests and add more complex ones later (using TMI.js, for example).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.