DiscordPHP-BridgeBot Documentation

Outgoing
in package

FinalYes

A Discord message on its way out to another network, before anyone has decided what it should look like there.

Text is the raw Discord content, mention markup and all, with the lookup tables needed to render <@1234> as a name. Nothing is escaped or truncated yet, because what has to be escaped and how much will fit are the connector's business: IRC cannot carry a newline, Telegram's HTML mode needs three characters escaped and no more, and the limits are 500 and 4096.

So the relay builds one of these and the connector renders it — using MessageText, which holds the parts that are the same everywhere.

Tags
author

Valithor Obsidion valithor@discordphp.org

Table of Contents

Properties

$author  : string
$channelNames  : array<string|int, mixed>
$edited  : bool
$media  : array<string|int, mixed>
$roleNames  : array<string|int, mixed>
$sourceId  : string|null
$text  : string
$userNames  : array<string|int, mixed>

Methods

__construct()  : mixed
isEmpty()  : bool
Whether there is anything at all worth relaying.
mediaUrls()  : array<int, string>
The attachment URLs, in order, for a connector that can only relay links.
withoutMedia()  : self
The same message without one attachment.

Properties

$channelNames read-only

public array<string|int, mixed> $channelNames = []

$edited read-only

public bool $edited = false

$media read-only

public array<string|int, mixed> $media = []

$roleNames read-only

public array<string|int, mixed> $roleNames = []

$sourceId read-only

public string|null $sourceId = null

$text read-only

public string $text = ''

$userNames read-only

public array<string|int, mixed> $userNames = []

Methods

__construct()

public __construct(string $author[, string $text = '' ][, array<string, string> $userNames = [] ][, array<string, string> $channelNames = [] ][, array<string, string> $roleNames = [] ][, array<int, Media> $media = [] ][, string|null $sourceId = null ][, bool $edited = false ]) : mixed
Parameters
$author : string

Display name, already resolved from the member or user.

$text : string = ''

Raw Discord content, mention markup included.

$userNames : array<string, string> = []

Discord user id => display name, for <@id>.

$channelNames : array<string, string> = []

Discord channel id => name, for <#id>.

$roleNames : array<string, string> = []

Discord role id => name, for <@&id>.

$media : array<int, Media> = []

Attachments, in the order posted.

$sourceId : string|null = null

The Discord message id, for mapping a later edit.

$edited : bool = false

Whether this revises a message already relayed.

isEmpty()

Whether there is anything at all worth relaying.

public isEmpty() : bool
Return values
bool

mediaUrls()

The attachment URLs, in order, for a connector that can only relay links.

public mediaUrls() : array<int, string>
Return values
array<int, string>

withoutMedia()

The same message without one attachment.

public withoutMedia(Media $sent) : self

For a network that sends a picture as a picture and the text as its caption: the caption should not then link to the very image it sits under.

Parameters
$sent : Media
Return values
self
On this page

Search results