Room
in package
A place on another network that a Discord channel can be bridged to: a Twitch channel, a Telegram group, whatever a later connector brings.
What every platform has in common is less than it looks — an id and
something to call it — so everything beyond that is optional and rendered
only when the connector supplies it. A connector that cannot cheaply answer
"how many people are in here" says null rather than guessing.
Returned by Connector::resolve(), which is what link uses to check a
target exists before wiring it up. A typo otherwise produces a bridge that
silently never works, because the bot joins a room that isn't there and
never hears anything.
Two identifiers, because some networks have two
id is how the room is routed: what Store keeps, what
Links matches incoming messages against, what the connector joins.
platformId is what the network's own API wants when that is something else.
Twitch is the case that makes the distinction necessary. Chat arrives
addressed to a channel login — #coffeescrafts — so that is what a bridge
must be keyed by; but Helix wants the broadcaster's numeric user id. Storing
the numeric id would make every bridge silently deaf, because no message
would ever arrive addressed to it. Telegram has only one, and leaves
platformId null.
Tags
Table of Contents
Properties
- $avatarUrl : string|null
- $description : string|null
- $id : string
- $kind : string|null
- $label : string
- $members : int|null
- $platformId : string|null
- $url : string|null
Methods
- __construct() : mixed
- apiId() : string
- The id to hand the network's API.
Properties
$avatarUrl read-only
public
string|null
$avatarUrl
= null
$description read-only
public
string|null
$description
= null
$id read-only
public
string
$id
$kind read-only
public
string|null
$kind
= null
$label read-only
public
string
$label
$members read-only
public
int|null
$members
= null
$platformId read-only
public
string|null
$platformId
= null
$url read-only
public
string|null
$url
= null
Methods
__construct()
public
__construct(string $id, string $label[, string|null $url = null ][, string|null $kind = null ][, int|null $members = null ][, string|null $description = null ][, string|null $avatarUrl = null ][, string|null $platformId = null ]) : mixed
Parameters
- $id : string
-
How the room is routed, and as Store keeps it.
- $label : string
-
What to call it in front of a human.
- $url : string|null = null
-
Somewhere to open it, when the platform has public links.
- $kind : string|null = null
-
The platform's own word for what this is — "channel", "supergroup".
- $members : int|null = null
-
Only when the platform makes it cheap to ask.
- $description : string|null = null
-
As the room describes itself.
- $avatarUrl : string|null = null
-
For a panel's thumbnail.
- $platformId : string|null = null
-
What the network's API calls it, when that is not
$id.
apiId()
The id to hand the network's API.
public
apiId() : string