https://github.com/nerixyz/rewards
Server and website for custom Twitch channel rewards
https://github.com/nerixyz/rewards
hacktoberfest rust typescript vue
Last synced: 5 months ago
JSON representation
Server and website for custom Twitch channel rewards
- Host: GitHub
- URL: https://github.com/nerixyz/rewards
- Owner: Nerixyz
- Created: 2021-05-26T18:57:47.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2026-01-26T21:38:44.000Z (6 months ago)
- Last Synced: 2026-01-27T05:47:04.571Z (5 months ago)
- Topics: hacktoberfest, rust, typescript, vue
- Language: Rust
- Homepage: https://rewards.nerixyz.de
- Size: 1.62 MB
- Stars: 22
- Watchers: 1
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rewards
This is an application that manages custom Twitch rewards. The current instance is hosted at [rewards.nerixyz.de](https://rewards.nerixyz.de/).


# Web Interface
## Editors and Broadcasters
A broadcaster can add multiple editors who then can manage the rewards.
This is done in the `Editors`-tab.
**Important:** A broadcaster can **only** add editors that have registered on this app (like on BTTV).
The editors can access the rewards through the `Broadcasters` tab.
## Rewards
You can edit the rewards in the `Rewards` tab.
When adding or editing a reward, you can change the action at the bottom.
Click on the pen (✏) icon to select the reward.
First, you can edit Twitch specific parameters like the reward title or the cooldown.
The cooldown can be specified like this: `1h`, `3.5d`, `3m` or `123` (seconds).
Some rewards expose a `Duration` configuration.
Here, you can specify the duration like this: `1hour 3min 4ms`.
For more examples go [here](https://docs.rs/humantime/2.1.0/humantime/fn.parse_duration.html).
You can also provide the duration like this: `rand( 10m ; 10h )`.
This would timeout the user for a random duration between `10m` and `1h`.
Users can rename emotes on 7TV by specifying `as=`.
### Available Rewards
- Timeout user (constant or random duration - only if they're not yet timed out)
- Enter Subonly-mode (constant or random duration)
- Enter Emoteonly-mode (constant or random duration)
- Swap/Add BTTV/FFZ/7TV emotes (requires `RewardMore` to be an editor on each platform)
- Add BTTV/FFZ/7TV emotes to slots that expire after a set amount of time (+/- 2min)
- Skip a Spotify track
- Play a Spotify track
- Queue a Spotify track
### Commands
- `::ei `, `::emoteinfo `, `::emote info `
Displays information about an emote. Only works for emotes managed by the bot.
- `::emote ban/unban ` Ban/unban emotes from being added. Requires editor rights.
- `::emote eject ` Untracks the emote from the bot's database; doesn't remove the emote from the platform.
- `::emote inject ` Adds an emote to the bot's database (only works with swap rewards currently).
- `::emote reload` Syncs swap emotes with the platform.
- `::slots`, `::emoteslots` Display the current slots.
- `::emotes`, `::ce`, `::currentemotes` Display the current emotes.
- `::ping`, `::bing` Ping the bot.
- `::about`, `::rewardmore`, `::who`, `::bot` Display details about the bot.
- `::(sp)otify (i)nfo` Display the current song.
- `::(sp)otify (s)kip` Skip the current song (requires broadcaster or editor rights).
**Admin only**
- `::debug channel ?name` Print debug info about a channel.
- `::debug platforms` Check if the auth-tokens for the platforms are still valid.
- `::debug edit ` Add the admin as editor.
- `::debug rmedit ` Remove the admin as editor.
- `::debug sync ?name` Sync rewards with Twitch.
# Development
## Setup
- Setup a [`postgres`](https://www.postgresql.org/) database.
- Create a new application on the [Twitch Console](https://dev.twitch.tv/console/apps).
- Copy `config.toml.example` to `config.toml` and set the appropriate values.
- Copy `.env.example` to `.env` and set the `DATABASE_URL` to the one you configured.
- Run `setup.sh` or `setup.bat` depending on your platform.
- Setup nginx to proxy `8082`.
- Add the following entry to your nginx config:
```conf
location /api/v1/metrics {
return 403;
}
```
- Add the following job to your prometheus config
```yaml
- job_name: 'rewards'
scrape_interval: 10s
metrics_path: '/api/v1/metrics'
static_configs:
- targets: ['localhost:8082']
```
- Now you're done!
### Setting up a development environment
- Use [`ngrok`](https://ngrok.com/) to create a tunnel to your machine for _eventsub_.
- Edit `server.url` to the ngrok-https-url.
- In the `web` directory set the `VITE_API_BASE_URL` to the ngrok-https-url.
## Roadmap
Things to-do are tracked [here](https://github.com/Nerixyz/rewards/projects).
# Internal - web API
All endpoints are on `/api/v1`. All endpoints (except `/auth/twich-auth-url` and the auth-callbacks) require authentication.
Authentication is done through the `Authorization` header
that has to be set to `Bearer { cookie(auth_token) }`.