more readme fixes
This commit is contained in:
parent
0412ee0aba
commit
d8ca472e52
@ -196,6 +196,7 @@ Restrict access to specific roles:
|
|||||||
username: "mybot",
|
username: "mybot",
|
||||||
token: "oauth:...",
|
token: "oauth:...",
|
||||||
clientId: "...",
|
clientId: "...",
|
||||||
|
channel: "your_channel",
|
||||||
allowedRoles: ["moderator", "vip"]
|
allowedRoles: ["moderator", "vip"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -224,6 +225,7 @@ Only allow specific Twitch user IDs (most secure):
|
|||||||
username: "mybot",
|
username: "mybot",
|
||||||
token: "oauth:...",
|
token: "oauth:...",
|
||||||
clientId: "...",
|
clientId: "...",
|
||||||
|
channel: "your_channel",
|
||||||
allowFrom: ["123456789", "987654321"]
|
allowFrom: ["123456789", "987654321"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,6 +254,7 @@ Users in `allowFrom` bypass role checks. In this example:
|
|||||||
username: "mybot",
|
username: "mybot",
|
||||||
token: "oauth:...",
|
token: "oauth:...",
|
||||||
clientId: "...",
|
clientId: "...",
|
||||||
|
channel: "your_channel",
|
||||||
allowFrom: ["123456789"],
|
allowFrom: ["123456789"],
|
||||||
allowedRoles: ["moderator"]
|
allowedRoles: ["moderator"]
|
||||||
}
|
}
|
||||||
@ -274,6 +277,7 @@ Only respond when the bot is mentioned:
|
|||||||
username: "mybot",
|
username: "mybot",
|
||||||
token: "oauth:...",
|
token: "oauth:...",
|
||||||
clientId: "...",
|
clientId: "...",
|
||||||
|
channel: "your_channel",
|
||||||
requireMention: true
|
requireMention: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -306,7 +310,8 @@ Config with env fallback:
|
|||||||
accounts: {
|
accounts: {
|
||||||
default: {
|
default: {
|
||||||
username: "mybot",
|
username: "mybot",
|
||||||
clientId: "your_client_id"
|
clientId: "your_client_id",
|
||||||
|
channel: "your_channel"
|
||||||
// token will be read from CLAWDBOT_TWITCH_ACCESS_TOKEN
|
// token will be read from CLAWDBOT_TWITCH_ACCESS_TOKEN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -377,6 +382,7 @@ clawdbot channels status --probe
|
|||||||
username: "mybot",
|
username: "mybot",
|
||||||
token: "oauth:...",
|
token: "oauth:...",
|
||||||
clientId: "...",
|
clientId: "...",
|
||||||
|
channel: "your_channel",
|
||||||
// Temporary: allow everyone
|
// Temporary: allow everyone
|
||||||
allowedRoles: ["all"]
|
allowedRoles: ["all"]
|
||||||
}
|
}
|
||||||
@ -386,7 +392,7 @@ clawdbot channels status --probe
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Check the bot is in the channel:** The bot must join the channel (either `channel: "target_channel"` or defaults to `username`).
|
**Check the bot is in the channel:** The bot must join the channel specified in `channel`.
|
||||||
|
|
||||||
### Token issues
|
### Token issues
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# @clawdbot/twitch
|
# @clawdbot/twitch
|
||||||
|
|
||||||
Twitch channel plugin for Clawdbot.
|
Twitch chat plugin for Clawdbot.
|
||||||
|
|
||||||
## Install (local checkout)
|
## Install (local checkout)
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ Onboarding: select Twitch and confirm the install prompt to fetch the plugin aut
|
|||||||
|
|
||||||
## Config
|
## Config
|
||||||
|
|
||||||
Minimal config (default account):
|
Minimal config:
|
||||||
|
|
||||||
```json5
|
```json5
|
||||||
{
|
{
|
||||||
@ -27,137 +27,30 @@ Minimal config (default account):
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
accounts: {
|
accounts: {
|
||||||
default: {
|
default: {
|
||||||
username: "mybot",
|
username: "clawdbot",
|
||||||
token: "oauth:your_token_here",
|
token: "oauth:abc123...",
|
||||||
clientId: "your_client_id_here",
|
clientId: "your_client_id_here",
|
||||||
},
|
channel: "vevisk"
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
1. **Create a Twitch application:**
|
1. Create a Twitch application: [Twitch Developer Console](https://dev.twitch.tv/console)
|
||||||
- Go to [Twitch Developer Console](https://dev.twitch.tv/console)
|
2. Generate OAuth token: [Twitch Token Generator](https://twitchtokengenerator.com/)
|
||||||
- Click "Register Your Application"
|
|
||||||
- Set Application Type to "Chat Bot"
|
|
||||||
- Copy the Client ID
|
|
||||||
|
|
||||||
2. **Generate your OAuth token:**
|
|
||||||
- Use [Twitch Token Generator](https://twitchtokengenerator.com/) or [TwitchApps TMI](https://twitchapps.com/tmi/)
|
|
||||||
- Select scopes: `chat:read` and `chat:write`
|
- Select scopes: `chat:read` and `chat:write`
|
||||||
- Copy the token (starts with `oauth:`)
|
3. Start the gateway
|
||||||
|
|
||||||
3. **Configure credentials:**
|
|
||||||
- Config: `channels.twitch.accounts.default.token`
|
|
||||||
- Or env: `CLAWDBOT_TWITCH_ACCESS_TOKEN=...` (default account only)
|
|
||||||
|
|
||||||
4. **Start the gateway** - Twitch starts when a token is resolved
|
|
||||||
|
|
||||||
## Token refresh (recommended)
|
|
||||||
|
|
||||||
For long-running bots, configure automatic token refresh:
|
|
||||||
|
|
||||||
```json5
|
|
||||||
{
|
|
||||||
channels: {
|
|
||||||
twitch: {
|
|
||||||
accounts: {
|
|
||||||
default: {
|
|
||||||
username: "mybot",
|
|
||||||
token: "oauth:abc123...",
|
|
||||||
clientId: "your_client_id",
|
|
||||||
clientSecret: "your_client_secret",
|
|
||||||
refreshToken: "your_refresh_token",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Access control
|
|
||||||
|
|
||||||
Allowlist by user ID (recommended):
|
|
||||||
|
|
||||||
```json5
|
|
||||||
{
|
|
||||||
channels: {
|
|
||||||
twitch: {
|
|
||||||
accounts: {
|
|
||||||
default: {
|
|
||||||
username: "mybot",
|
|
||||||
token: "oauth:...",
|
|
||||||
clientId: "...",
|
|
||||||
allowFrom: ["123456789", "987654321"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Role-based restrictions:
|
|
||||||
|
|
||||||
```json5
|
|
||||||
{
|
|
||||||
channels: {
|
|
||||||
twitch: {
|
|
||||||
accounts: {
|
|
||||||
default: {
|
|
||||||
username: "mybot",
|
|
||||||
token: "oauth:...",
|
|
||||||
clientId: "...",
|
|
||||||
allowedRoles: ["moderator", "vip"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Available roles: `"moderator"`, `"owner"`, `"vip"`, `"subscriber"`, `"all"`
|
|
||||||
|
|
||||||
## Multiple accounts
|
|
||||||
|
|
||||||
```json5
|
|
||||||
{
|
|
||||||
channels: {
|
|
||||||
twitch: {
|
|
||||||
accounts: {
|
|
||||||
main: {
|
|
||||||
username: "mybot",
|
|
||||||
token: "oauth:...",
|
|
||||||
clientId: "...",
|
|
||||||
channel: "streamer1",
|
|
||||||
},
|
|
||||||
secondary: {
|
|
||||||
username: "mybot",
|
|
||||||
token: "oauth:...",
|
|
||||||
clientId: "...",
|
|
||||||
channel: "streamer2",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Environment variables
|
|
||||||
|
|
||||||
For the default account:
|
|
||||||
|
|
||||||
- `CLAWDBOT_TWITCH_ACCESS_TOKEN` - OAuth token (with `oauth:` prefix)
|
|
||||||
|
|
||||||
Restart the gateway after config changes.
|
|
||||||
|
|
||||||
## Full documentation
|
## Full documentation
|
||||||
|
|
||||||
See [https://docs.clawd.bot/channels/twitch](https://docs.clawd.bot/channels/twitch) for complete documentation including:
|
See https://docs.clawd.bot/channels/twitch for:
|
||||||
|
|
||||||
- Token setup options
|
- Token refresh setup
|
||||||
- Access control patterns
|
- Access control patterns
|
||||||
|
- Multi-account configuration
|
||||||
- Troubleshooting
|
- Troubleshooting
|
||||||
- Capabilities & limits
|
- Capabilities & limits
|
||||||
|
|||||||
@ -52,7 +52,7 @@ export interface TwitchAccountConfig {
|
|||||||
/** Twitch OAuth token (requires chat:read and chat:write scopes) */
|
/** Twitch OAuth token (requires chat:read and chat:write scopes) */
|
||||||
token: string;
|
token: string;
|
||||||
/** Twitch client ID (from Twitch Developer Portal or twitchtokengenerator.com) */
|
/** Twitch client ID (from Twitch Developer Portal or twitchtokengenerator.com) */
|
||||||
clientId?: string;
|
clientId: string;
|
||||||
/** Channel name to join (required) */
|
/** Channel name to join (required) */
|
||||||
channel: string;
|
channel: string;
|
||||||
/** Enable this account */
|
/** Enable this account */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user