twitch-pubsub
twitch-pubsub is a Typescript wrapper to the Twitch PubSub API.
Requirements
Documentation
Getting Started
If you are using Node.js, install twitch-pubsub using npm:
$ npm install @sighmir/twitch-pubsub
You can now require and use twitch-pubsub like so:
import twitchPubSub from "@sighmir/twitch-pubsub";
const TWITCH_TOKEN = process.env.TWITCH_TOKEN!;
const tps = twitchPubSub(TWITCH_TOKEN);
tps.on("whispers.45744081", (data) => {
console.log(data);
});
tps.on("ping", () => {
console.log("PONG");
});
Refer to the PubSub API Documentation and the example for more information.
Browser
You can also load this script on your browser like so:
<script src="https://cdn.jsdelivr.net/npm/@sighmir/twitch-pubsub/dist/bundle.js"></script>
You can now use twitch-pubsub normally on the page, like you would on Node.js.
License
twitch-pubsub - Typescript Twitch PubSub API Client.
Copyright (C) 2020 Guilherme Caulada (Sighmir)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.