class GroupDMChannel extends DMChannel implements GroupDMChannelInterface (View source)

Represents a Group DM channel.

Traits

The text based channel trait.

Properties

Client $client The client which initiated the instance. from ClientBase
static Client|null $serializeClient The client which will be used to unserialize. from ClientBase
protected Collection $typings Collection of all typing users (contains arrays). from TextChannelTrait
protected array $typingTriggered Triggered typings in this channel. from TextChannelTrait
protected string|null $lastMessageID The last message's ID, or null. from TextChannelTrait
StorageInterface $messages The storage with all cached messages. from DMChannel
string $id The channel ID. from DMChannel
string|null $ownerID The owner ID of this channel, or null. from DMChannel
Collection $recipients The recipients of this channel, mapped by user ID. from DMChannel
int $createdTimestamp The timestamp of when this channel was created. from DMChannel
DateTime $createdAt The DateTime instance of createdTimestamp. from DMChannel
User|null $owner The owner of this channel, or null. from DMChannel
string|null $applicationID The application which created the group DM channel.
string|null $icon The icon of the Group DM channel.

Methods

__construct(Client $client, array $channel)

No description

__destruct()

Default destructor.

from Base
bool
__isset(string $name)

No description

from Base
mixed
__get(string $name)

No description

mixed
__call(string $name, array $args)

No description

from Base
mixed
jsonSerialize()

No description

string
serialize()

No description

void
unserialize($data)

No description

void
_patch(array $channel)

No description

bool
_shouldUpdate(array $data)

No description

from Base
void
_markForDelete()

No description

from Base
mixed
__debugInfo()

No description

ExtendedPromiseInterface
bulkDelete(Collection|array|int $messages, string $reason = '', bool $filterOldMessages = false)

Deletes multiple messages at once. Resolves with $this.

ExtendedPromiseInterface
collectMessages(callable $filter, array $options = array())

Collects messages during a specific duration (and max. amount). Resolves with a Collection of Message instances, mapped by their IDs.

ExtendedPromiseInterface
fetchMessage(string $id)

Fetches a specific message using the ID. Resolves with an instance of Message.

ExtendedPromiseInterface
fetchMessages(array $options = array())

Fetches messages of this channel. Resolves with a Collection of Message instances, mapped by their ID.

Message|null
getLastMessage()

Gets the last message in this channel if cached, or null.

ExtendedPromiseInterface
send(string $content, array $options = array())

Sends a message to a channel. Resolves with an instance of Message, or a Collection of Message instances, mapped by their ID.

void
startTyping()

Starts sending the typing indicator in this channel. Counts up a triggered typing counter.

void
stopTyping(bool $force = false)

Stops sending the typing indicator in this channel. Counts down a triggered typing counter.

int
typingCount()

Returns the amount of user typing in this channel.

bool
isTyping(User $user)

Determines whether the given user is typing in this channel or not.

int
isTypingSince(User $user)

Determines whether how long the given user has been typing in this channel. Returns -1 if the user is not typing.

_createMessage(array $message)

No description

bool
_updateTyping(User $user, int|null $timestamp = null)

No description

bool
isRecipient(User|string $user)

Determines whether a given user is a recipient of this channel.

from DMChannel
ExtendedPromiseInterface
addRecipient(string|User $user, string $accessToken, string $nick = '')

Adds the given user to the Group DM channel using the given access token. Resolves with $this.

string|null
getIconURL(int|null $size = null, string $format = 'png')

Returns the group DM's icon URL, or null.

ExtendedPromiseInterface
removeRecipient(string|User $user)

Removes the given user from the Group DM channel. Resolves with $this.

Details

__construct(Client $client, array $channel)

Parameters

Client $client
array $channel

__destruct()

Default destructor.

bool __isset(string $name)

Parameters

string $name

Return Value

bool

Exceptions

Exception

mixed __get(string $name)

Parameters

string $name

Return Value

mixed

Exceptions

RuntimeException

mixed __call(string $name, array $args)

Parameters

string $name
array $args

Return Value

mixed

Exceptions

RuntimeException

mixed jsonSerialize()

Return Value

mixed

string serialize()

Return Value

string

void unserialize($data)

Parameters

$data

Return Value

void

void _patch(array $channel)

Parameters

array $channel

Return Value

void

bool _shouldUpdate(array $data)

Parameters

array $data

Return Value

bool

void _markForDelete()

Return Value

void

mixed __debugInfo()

Return Value

mixed

ExtendedPromiseInterface bulkDelete(Collection|array|int $messages, string $reason = '', bool $filterOldMessages = false)

Deletes multiple messages at once. Resolves with $this.

Parameters

Collection|array|int $messages A collection or array of Message instances, or the number of messages to delete (2-100).
string $reason
bool $filterOldMessages Automatically filters out too old messages (14 days).

Return Value

ExtendedPromiseInterface

ExtendedPromiseInterface collectMessages(callable $filter, array $options = array())

Collects messages during a specific duration (and max. amount). Resolves with a Collection of Message instances, mapped by their IDs.

Options are as following (all are optional):

array(
  'max' => int, (max. messages to collect)
  'time' => int, (duration, in seconds, default 30)
  'errors' => array, (optional, which failed "conditions" (max not reached in time ("time")) lead to a rejected promise, defaults to [])
)

Parameters

callable $filter The filter to only collect desired messages. Signature: function (Message $message): bool
array $options The collector options.

Return Value

ExtendedPromiseInterface This promise is cancellable.

Exceptions

RangeException The exception the promise gets rejected with, if collecting times out.
OutOfBoundsException The exception the promise gets rejected with, if the promise gets cancelled.

See also

ExtendedPromiseInterface fetchMessage(string $id)

Fetches a specific message using the ID. Resolves with an instance of Message.

Parameters

string $id

Return Value

ExtendedPromiseInterface

See also

ExtendedPromiseInterface fetchMessages(array $options = array())

Fetches messages of this channel. Resolves with a Collection of Message instances, mapped by their ID.

Options are as following:

array(
  'after' => string, (message ID)
  'around' => string, (message ID)
  'before' => string, (message ID)
  'limit' => int, (1-100, defaults to 50)
)

Parameters

array $options

Return Value

ExtendedPromiseInterface

See also

Message|null getLastMessage()

Gets the last message in this channel if cached, or null.

Return Value

Message|null

ExtendedPromiseInterface send(string $content, array $options = array())

Sends a message to a channel. Resolves with an instance of Message, or a Collection of Message instances, mapped by their ID.

Options are as following (all are optional):

array(
   'embed' => array|\CharlotteDunois\Yasmin\Models\MessageEmbed, (an (embed) array/object or an instance of MessageEmbed)
   'files' => array, (an array of `[ 'name' => string, 'data' => string || 'path' => string ]` or just plain file contents, file paths or URLs)
   'nonce' => string, (a snowflake used for optimistic sending)
   'disableEveryone' => bool, (whether @everyone and @here should be replaced with plaintext, defaults to client option disableEveryone)
   'tts' => bool,
   'split' => bool|array, (*)
)

  * array(
  *   'before' => string, (The string to insert before the split)
  *   'after' => string, (The string to insert after the split)
  *   'char' => string, (The string to split on)
  *   'maxLength' => int, (The max. length of each message)
  * )

Parameters

string $content The message content.
array $options Any message options.

Return Value

ExtendedPromiseInterface

See also

void startTyping()

Starts sending the typing indicator in this channel. Counts up a triggered typing counter.

Return Value

void

void stopTyping(bool $force = false)

Stops sending the typing indicator in this channel. Counts down a triggered typing counter.

Parameters

bool $force Reset typing counter and stop sending the indicator.

Return Value

void

int typingCount()

Returns the amount of user typing in this channel.

Return Value

int

bool isTyping(User $user)

Determines whether the given user is typing in this channel or not.

Parameters

User $user

Return Value

bool

int isTypingSince(User $user)

Determines whether how long the given user has been typing in this channel. Returns -1 if the user is not typing.

Parameters

User $user

Return Value

int

Message _createMessage(array $message)

Parameters

array $message

Return Value

Message

bool _updateTyping(User $user, int|null $timestamp = null)

Parameters

User $user
int|null $timestamp

Return Value

bool

bool isRecipient(User|string $user)

Determines whether a given user is a recipient of this channel.

Parameters

User|string $user The User instance or user ID.

Return Value

bool

Exceptions

InvalidArgumentException

ExtendedPromiseInterface addRecipient(string|User $user, string $accessToken, string $nick = '')

Adds the given user to the Group DM channel using the given access token. Resolves with $this.

Parameters

string|User $user The User instance, or the user ID.
string $accessToken The OAuth 2.0 access token for the user.
string $nick The nickname of the user being added.

Return Value

ExtendedPromiseInterface

Exceptions

InvalidArgumentException

string|null getIconURL(int|null $size = null, string $format = 'png')

Returns the group DM's icon URL, or null.

Parameters

int|null $size One of 128, 256, 512, 1024 or 2048.
string $format One of png, jpg or webp.

Return Value

string|null

ExtendedPromiseInterface removeRecipient(string|User $user)

Removes the given user from the Group DM channel. Resolves with $this.

Parameters

string|User $user The User instance, or the user ID.

Return Value

ExtendedPromiseInterface

Exceptions

InvalidArgumentException