# twitch-tools-vx

> This project is a library/module that provides additional functionalities for interacting with the Twitch API, complementing the Vitor-VX/Twitch-Tools library and much more.

Latest version **1.0.1** (published 2024-02-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install twitch-tools-vx
pnpm add twitch-tools-vx
yarn add twitch-tools-vx
bun add twitch-tools-vx
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2024-02-10 |
| First published | 2024-02-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 22.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Vitor-VX |
| Maintainers | victor-vx |

## Links

- npm: https://www.npmjs.com/package/twitch-tools-vx
- Repository: https://github.com/Vitor-VX/TwitchToolsVX
- Homepage: https://github.com/Vitor-VX/TwitchToolsVX#readme
- Issues: https://github.com/Vitor-VX/TwitchToolsVX/issues
- npm.io page: https://npm.io/package/twitch-tools-vx

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) ^1.6.7
- [tmi.js](https://npm.io/package/tmi.js.md) ^1.8.5
- [swearguard-vx](https://npm.io/package/swearguard-vx.md) ^1.0.1
- [twitch-moderation-tools](https://npm.io/package/twitch-moderation-tools.md) ^1.2.0

## Recent versions

- 1.0.1 (latest) — 2024-02-10
- 1.0.0 — 2024-02-08

## README

# TwitchToolsVX - New Implementations

This project is a library/module that provides additional functionalities for interacting with the Twitch API, complementing the Vitor-VX/Twitch-Tools library and much more.

- The library includes all the features/functions from the [twitch-moderation-tools](https://www.npmjs.com/package/twitch-moderation-tools), library, making it an add-on to this library.

**Examples:**
```javascript

const Twitch = require("twitch-tools-vx");

const TwitchTools = new Twitch('__TOKEN__', '__CLIENT-ID__');

TwitchTools.TwitchModeration.AddBlockedTerm();
TwitchTools.TwitchModeration.BanUser();
TwitchTools.TwitchModeration.TimeoutUser();
```

## Functionalities

### `SetTitleLive(authTokenMain, channel, title, botChannel = false)`
Sets the title of a live stream.

**Usage Example:**
```javascript
SetTitleLive('authToken', 'channelName', 'New Live Title');
```

### `SetTegLive(authTokenMain, channel, teg, botChannel = false)`
Sets the tag of a live stream.

**Usage Example:**
```javascript
SetTegLive('authToken', 'channelName', 'new-tag');
```

### `GetTokenTwitchDevice(waitTimeInSeconds, scopes = [])`
Obtains an authentication token using the Twitch device OAuth flow.

**Usage Example:**
```javascript
GetTokenTwitchDevice(30, ['channel:manage:broadcast']);
```

### `RefreshToken(refreshToken, clientSecret)`
Refreshes an authentication token using a refresh token.

**Usage Example:**
```javascript
RefreshToken('refreshToken', 'clientSecret');
```

### `StreamerIsLive(streamer)`
Checking whether a streamer is online or offline, returns `true` for online and `false` for offline

**Usage Example:**
```javascript
StreamerIsLive('jvzx_'); // return false
```

### Additional Functionalities
In addition to the functionalities mentioned above, this library also includes custom features that I developed myself and that can be useful, such as:

- `RemoveSpamCaules(channel, botModerator, message, tags)`: Removes messages containing spam keywords.
- `BanSpamCaules(channel, botModerator, userBanned, message)`: Bans users who sent messages containing spam keywords.
- `RemoveMessageSwearWord(channel, botModerator, tags, message)`: Removes messages containing swear words.
- `BanSwearWord(channel, botModerator, userBanned, message)`: Bans users who sent messages containing swear words.

These additional functionalities were developed by myself using custom libraries like npm i swearguard-vx, which checks for swear words in strings, and are "not part of" the standard Twitch functionalities.

These functionalities are useful for moderating and managing live streams on the Twitch platform. The TwitchToolsVX class provides a convenient interface for interacting with the Twitch API and performing various moderation and content management operations.

## Installation
To install the library, you can use npm. Run the following command:

```bash
npm i twitch-tools-vx
```

## Important

To use the SetTitleLive or SetTegLive functions, you need to obtain the token of the channel you want to modify. This is because Twitch separates functionalities between those that a token can perform and those that can only be performed with the token of the specific channel. For example, if my bot is called StreamSquawk and I want to change the title or tag of the channel called jvzx_, I can only do that with the token of the jvzx_ channel, not with the token of StreamSquawk.

If you want to obtain the CHANNEL token to use both functions, use the following scope:

```
scope=channel:manage:broadcast
```

For example, if I use both functions to try to change the title or tag of the live stream using the token of my bot StreamSquawk, the title or tag will be changed in the CHANNEL of my bot.

## Observação - PT-BR

A documentação completa em português-br está disponível na pasta docs/ptbr.

---
_Source: https://npm.io/package/twitch-tools-vx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
