Emotettv
đŦ A Twitch (BTTV, FFZ & 7TV) emotes and badges parser - built with TMI.js in mind
Install / Use
/learn @doceazedo/EmotettvREADME
<h1>emoteTTV <img src="https://i.imgur.com/Qgc9fJ4.gif" height="56" width="56" align="right"></h1>
- <img src="https://cdn.betterttv.net/emote/5fa8f232eca18f6455c2b2e1/2x" height="28" align="left"> Supports Twitch, BTTV, FFZ and 7TV emotes and badges
- <img src="https://cdn.7tv.app/emote/63071ba3449e6f5ff95cca6d/2x.webp" height="28" align="left"> Dead simple API â works seamlessly with <a href="https://github.com/tmijs/tmi.js">TMI.js</a> and <a href="https://twurple.js.org">Twurple</a>
- <img src="https://static-cdn.jtvnw.net/emoticons/v2/81274/default/dark/2.0" height="28" align="left"> Works out of the box â no authentication needed
- <img src="https://i.imgur.com/munRwdJ.png" height="28" align="left"> Flexible outputs to fit every need
Demo
Checkout this demo app to see emoteTTV in action! âšī¸
Basic usage
import { parseEmotes } from "emotettv";
const parsed = await parseEmotes("Hello emotettv! D:");
console.log(parsed.toHTML());
// > Hello emotettv! <figure><img src="..." alt="D:" /></figure>
If you're using TMI.js, you can pass your tags directly to emoteTTV:
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.
License
The emoteTTV project is licensed under the GPLv3 License.
