An open API service indexing awesome lists of open source software.

https://github.com/doceazedo/emotettv

đŸ’Ŧ A Twitch (BTTV, FFZ & 7TV) emotes and badges parser - built with TMI.js in mind
https://github.com/doceazedo/emotettv

7tv bttv emotes ffz javascript library parser tmi tmijs twitch twurple typescript

Last synced: 12 days ago
JSON representation

đŸ’Ŧ A Twitch (BTTV, FFZ & 7TV) emotes and badges parser - built with TMI.js in mind

Awesome Lists containing this project

README

          

emoteTTV

[![npm](https://badgen.net/npm/v/emotettv?ts=1706478283)](https://www.npmjs.com/package/emotettv)
[![install size](https://badgen.net/packagephobia/install/emotettv)](https://packagephobia.com/result?p=emotettv)
[![downloads](https://badgen.net/npm/dt/emotettv)](https://www.npmjs.com/package/emotettv)
[![snyk](https://snyk.io/test/npm/emotettv/badge.svg)](https://snyk.io/test/npm/emotettv)
[![snyk](https://badgen.net/github/license/doceazedo/emotettv)](/LICENSE)

- Supports Twitch, BTTV, FFZ and 7TV emotes and badges
- Dead simple API — works seamlessly with TMI.js and Twurple
- Works out of the box — no authentication needed
- Flexible outputs to fit every need

## Demo

Checkout this [demo app](https://emotettv.gitbook.io/emotettv/examples) to see emoteTTV in action! â›šī¸

## Basic usage

```js
import { parseEmotes } from "emotettv";

const parsed = await parseEmotes("Hello emotettv! D:");
console.log(parsed.toHTML());
// > Hello emotettv! D:
```

If you're using [TMI.js](https://github.com/tmijs/tmi.js), you can pass your tags directly to emoteTTV:

```js
import { parseBadges, parseEmotes } from "emotettv";
import tmi from "tmi.js";

const client = new tmi.Client({
channels: ["doceazedo911"],
});

const options = {
channelId: "98776633",
};

client.connect();
client.on("message", async (channel, tags, text, self) => {
const badges = await parseBadges(tags.badges, tags.username, options);
const message = await parseEmotes(text, tags.emotes, options);
const htmlBadges = badges.toHTML();
const htmlMessage = message.toHTML();
const displayName = tags["display-name"];
document.body.innerHTML = `${htmlBadges} ${displayName}: ${htmlMessage}`;
});
```

## Docs

Check more examples and API reference on the [emoteTTV docs](https://emotettv.gitbook.io).

## License

The emoteTTV project is licensed under the [GPLv3 License](./LICENSE).