DiscordPHP-BridgeBot Documentation

TwitchConfig
in package

FinalYes

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
author

Valithor Obsidion valithor@valgorithms.com

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

$refreshToken read-only

public string|null $refreshToken

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
bool

fromEnvironment()

public static fromEnvironment(Environment $environment) : self
Parameters
$environment : Environment
Tags
throws
RuntimeException

when a required value is missing.

Return values
self

hasOwner()

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
bool

isConfigured()

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
On this page

Search results