TelegramPHP Documentation

ChatBehaviour

What you can do to a chat you are holding.

Mixed into the generated Chat part (and, through ChatFullInfoBehaviour, into the full variant), so the chat id is read off the part instead of being passed back in.

Tags
author

Valithor Obsidion valithor@valgorithms.com

Table of Contents

Methods

ban()  : PromiseInterface<string|int, bool>
Bans a user, optionally until a point in time.
countMembers()  : PromiseInterface<string|int, int>
How many members this chat has.
fetch()  : PromiseInterface<string|int, ChatFullInfo>
The full record for this chat, which carries far more than the stub an update brings along.
getMember()  : PromiseInterface<string|int, ChatMember>
One member of this chat.
leave()  : PromiseInterface<string|int, bool>
Leaves this chat.
sendAction()  : PromiseInterface<string|int, bool>
Shows "typing...", "sending photo...", and the rest, for a few seconds.
sendMessage()  : PromiseInterface<string|int, Message>
Sends a message to this chat.
sendPhoto()  : PromiseInterface<string|int, Message>
Sends a photo to this chat.
unban()  : PromiseInterface<string|int, bool>
Lifts a ban.

Methods

ban()

Bans a user, optionally until a point in time.

public ban(int $userId[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, bool>
Parameters
$userId : int
$options : array<string, mixed> = []

Any other banChatMember field.

Return values
PromiseInterface<string|int, bool>

countMembers()

How many members this chat has.

public countMembers() : PromiseInterface<string|int, int>
Return values
PromiseInterface<string|int, int>

fetch()

The full record for this chat, which carries far more than the stub an update brings along.

public fetch() : PromiseInterface<string|int, ChatFullInfo>
Return values
PromiseInterface<string|int, ChatFullInfo>

getMember()

One member of this chat.

public getMember(int $userId) : PromiseInterface<string|int, ChatMember>
Parameters
$userId : int
Return values
PromiseInterface<string|int, ChatMember>

leave()

Leaves this chat.

public leave() : PromiseInterface<string|int, bool>
Return values
PromiseInterface<string|int, bool>

sendAction()

Shows "typing...", "sending photo...", and the rest, for a few seconds.

public sendAction([string $action = 'typing' ]) : PromiseInterface<string|int, bool>
Parameters
$action : string = 'typing'
Return values
PromiseInterface<string|int, bool>

sendMessage()

Sends a message to this chat.

public sendMessage(string $text[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message>
Parameters
$text : string
$options : array<string, mixed> = []

Any other sendMessage field.

Return values
PromiseInterface<string|int, Message>

sendPhoto()

Sends a photo to this chat.

public sendPhoto(InputFile|string $photo[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message>
Parameters
$photo : InputFile|string
$options : array<string, mixed> = []

Any other sendPhoto field.

Return values
PromiseInterface<string|int, Message>

unban()

Lifts a ban.

public unban(int $userId[, bool $onlyIfBanned = true ]) : PromiseInterface<string|int, bool>
Parameters
$userId : int
$onlyIfBanned : bool = true
Return values
PromiseInterface<string|int, bool>
On this page

Search results