TwitchConfig
in package
What the Twitch connector needs to start, read from the same environment the bot itself was.
Kept here rather than in the core's Config, which is the point of the connector model: installing a network should not mean the core grows fields for settings it will never read.
Secrets only ever come from the environment — never from the JSON store, which is runtime state a server admin edits through chat and which should be safe to read, back up, or paste into an issue.
Tags
Table of Contents
Constants
- DEFAULT_PREFIX : mixed = '!'
- What the bot answers to in Twitch chat when no prefix is configured.
Properties
- $clientId : string
- $clientSecret : string
- $envPath : string
- $nick : string
- $ownerLogin : string|null
- $prefix : string
- $refreshToken : string|null
- $token : string|null
Methods
- canRefreshToken() : bool
- Whether a client secret is available.
- fromEnvironment() : self
- hasOwner() : bool
- Whether anyone can run the operator-gated Twitch commands from Twitch chat.
- isConfigured() : bool
- Whether the environment carries enough to install this connector at all.
- __construct() : mixed
Constants
DEFAULT_PREFIX
What the bot answers to in Twitch chat when no prefix is configured.
public
mixed
DEFAULT_PREFIX
= '!'
Properties
$clientId read-only
public
string
$clientId
$clientSecret read-only
public
string
$clientSecret
$envPath read-only
public
string
$envPath
$nick read-only
public
string
$nick
$ownerLogin read-only
public
string|null
$ownerLogin
$prefix read-only
public
string
$prefix
$refreshToken read-only
public
string|null
$refreshToken
$token read-only
public
string|null
$token
Methods
canRefreshToken()
Whether a client secret is available.
public
canRefreshToken() : bool
Without one the bot still runs — Helix sends only the bearer token and
Client-Id, and IRC needs neither — but OAuth::form() refuses every
grant except device-code, so the access token cannot be refreshed when
it expires, roughly every four hours. Recovery then depends on somebody
approving a device code; see TwitchConnector::reauthorizer().
Return values
boolfromEnvironment()
public
static fromEnvironment(Environment $environment) : self
Parameters
- $environment : Environment
Tags
Return values
selfhasOwner()
Whether anyone can run the operator-gated Twitch commands from Twitch chat.
public
hasOwner() : bool
Unset is the intended default: api can reach endpoints that ban users,
end streams and rewrite a channel, so it should require somebody to have
said who is allowed to do that.
Return values
boolisConfigured()
Whether the environment carries enough to install this connector at all.
public
static isConfigured(Environment $environment) : bool
Parameters
- $environment : Environment
Return values
bool__construct()
private
__construct(string $clientId, string $clientSecret, string $nick, string|null $token, string|null $refreshToken, string $prefix, string|null $ownerLogin, string $envPath) : mixed
Parameters
- $clientId : string
- $clientSecret : string
- $nick : string
- $token : string|null
- $refreshToken : string|null
- $prefix : string
- $ownerLogin : string|null
- $envPath : string