twitchbot/README.md

67 lines
2.4 KiB
Markdown
Raw Permalink Normal View History

2025-01-14 00:55:26 -05:00
# twitchbot
A [maubot](https://github.com/maubot/maubot) plugin to get Twitch live stream notifications.
## Installation
Either download an `.mbp` file from the [release assets](https://laboon.dev/brad/twitchbot/releases) or [build one yourself](#building).
Then, [upload](https://docs.mau.fi/maubot/usage/basic.html#uploading-plugins) it to your maubot instance.
## Configuration
Before configuring your instance, you must first [register a new application](https://dev.twitch.tv/console/apps/create) using your Twitch account on the dev console.
When registering the application, use `http://localhost` as the Redirect URL and "Confidential" as the Client Type.
After registration, click "Manage" next to your new application and then click "New Secret" to generate a new client secret. Make note of both the Client ID and Client Secret.
This plugin has the following settings you can configure:
### `client_id`
Fill this in with the client ID you generated earlier.
### `client_secret`
Likewise, fill this in with the client secret you generated earlier.
### `notify_channels`
A list of Twitch channels for which you will be notified when they go live.
### `notify_room`
The room ID of the Matrix room where notifications will be sent. Make sure your bot user is added to this room.
### `matrix_users`
(Optional) A mapping of Twitch users to Matrix users. This will allow the bot to @ mention users when they go live.
### Example config
```
client_id: 'my_client_id'
client_secret: 'my_client_secret'
notify_channels:
- twitch_channel1
- twitch_channel2
- twitch_channel3
notify_room: '!matrix_room:example.com'
matrix_users:
twitch_channel1: '@matrix_user1:example.com'
twitch_channel2: '@matrix_user2:example.com'
```
## Usage
Once configured, notifications will automatically be sent to the specified room whenever one of the specified channels goes live.
You can use `!twitch <channel>` to get the current status of any Twitch channel.
## Building
Use the `mbc` tool to build this plugin:
```
mbc build
```
Optionally, use the `-u` switch to upload it to your maubot instance, if configured:
```
mbc build -u
```
Since `.mbp` files are just zip archives with a different name, you can also just zip the files of this repository:
```
zip -r twitchbot.mbp *
```
## License
<img align="right" src="https://www.gnu.org/graphics/agplv3-155x51.png" />
This project is licensed under the GNU Affero General Public License v3.0, see [LICENSE](LICENSE).