Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
twitch-pro
Advanced tools
Readme
twitch-pro is a Node.js library that simplifies interactions with the Twitch API and Twitch IRC chat.
You can install twitch-pro using npm:
npm install twitch-pro
Before using twitch-pro, you need to provide your Twitch client ID and OAuth2 token. Replace "your_client_id"
and "your_token"
with your actual Twitch client ID and OAuth2 token respectively.
const opts = {
clientId: "your_client_id", // Replace with your Twitch client ID here
token: "your_token", // Replace with your Twitch OAuth2 token here
nickname: "MaxA_MM" // Your Twitch username
}
Similarly, for WebSocket client options, replace "your_token"
with your Twitch OAuth2 token.
const wsOpts = {
token: "your_token", // Replace with your Twitch OAuth2 token here
nickname: "MaxA_MM" // Your Twitch username
};
You can create instances of the Twitch Client and WebSocket Client using the provided options.
import { Client, Events, WSClient } from "twitch-pro";
import { error, log } from "console";
const client = new Client(opts); // Twitch Client instance
const ws = new WSClient(wsOpts); // WebSocket Client instance
You can connect to the Twitch API and IRC chat by calling the connect()
method on the Twitch Client and WebSocket Client instances respectively.
client.connect()
.then(() => log(`Successfully connected to Twitch API`));
ws.connect();
You can register event handlers for various WebSocket events such as ready
, message
, join
, close
, and error
.
ws.on(Events.Ready, async () => {
log("WebSocket is ready");
ws.ping();
ws.join('maxa_mm');
});
ws.on(Events.Message, async (msg) => {
log(msg.content);
});
// Add handlers for other events: Join, Close, Error
Ensure to replace "your_client_id"
and "your_token"
with your actual Twitch client ID and OAuth2 token respectively. This ensures proper authentication when connecting to Twitch services.
Contributions are welcome! If you encounter any bugs or have suggestions for improvements, please feel free to submit issues or pull requests.
This project is licensed under the MIT License.
FAQs
A Twitch API Module. To interact with Twitch API!
The npm package twitch-pro receives a total of 1 weekly downloads. As such, twitch-pro popularity was classified as not popular.
We found that twitch-pro demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.