Chat
in package
Tags
Table of Contents
Properties
- $chat_id : int
- $chat_obj : stdClass|null
- $title : string|null
- $type : ChatType
- $user : User|null
- $username : string|null
- $chat_obj : stdClass|null
Methods
- __construct() : mixed
- __get() : mixed
- accept_join_request() : void
- create_invite_link() : string
- decline_join_request() : void
- get_administrators() : array<string|int, mixed>
- get_chat_member() : array<string|int, mixed>
- get_invite_link() : string
- get_latest_messages() : array<string|int, mixed>
- get_members_count() : int
- get_permissions() : stdClass|null
- get_profile_picture() : string
- pin_message() : bool
- revoke_invite_link() : bool
- save_chat_from_message() : void
- set_description() : void
- set_permissions() : void
- set_title() : void
- chat_member_to_array() : array<string|int, mixed>
- get_chat() : stdClass|null
Properties
$chat_id read-only
public
int
$chat_id
Chat id.
$chat_obj read-only
public
stdClass|null
$chat_obj
Chat object (as returned by Telegram).
$title read-only
public
string|null
$title
Chat title.
$type read-only
public
ChatType
$type
Chat type.
$user read-only
public
User|null
$user
User object (if chat is a private chat, otherwise null).
$username read-only
public
string|null
$username
Chat username.
$chat_obj
private
stdClass|null
$chat_obj
Methods
__construct()
public
__construct(string|int $identifier) : mixed
Parameters
- $identifier : string|int
-
Chat id or username.
Tags
__get()
public
__get(string $name) : mixed
Parameters
- $name : string
-
Variable name.
Tags
accept_join_request()
public
accept_join_request(int $user_id) : void
Parameters
- $user_id : int
-
User id.
Tags
create_invite_link()
public
create_invite_link([int $expire_date = 0 ][, int $member_limit = 0 ][, bool $approval_needed = false ]) : string
Parameters
- $expire_date : int = 0
-
(Optional) Date when the link will expire. Default is 0 (never expires).
- $member_limit : int = 0
-
(Optional) Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999. Default is 0 (unlimited).
- $approval_needed : bool = false
-
(Optional) If users joining the chat via the link need to be approved by chat administrators. If true $member_limit is ignored. Default is false.
Tags
Return values
stringdecline_join_request()
public
decline_join_request(int $user_id) : void
Parameters
- $user_id : int
-
User id.
Tags
get_administrators()
public
get_administrators() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>get_chat_member()
public
get_chat_member() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>get_invite_link()
public
get_invite_link() : string
Tags
Return values
stringget_latest_messages()
public
get_latest_messages([int $limit = 100 ]) : array<string|int, mixed>
Parameters
- $limit : int = 100
-
(Optional) Limit of messages to get. Default is 100.
Tags
Return values
array<string|int, mixed>get_members_count()
public
get_members_count() : int
Tags
Return values
intget_permissions()
public
get_permissions() : stdClass|null
Tags
Return values
stdClass|null —Chat permissions. Docs: https://core.telegram.org/bots/api#chatpermissions
get_profile_picture()
public
get_profile_picture([ChatPhotoSize $size = ChatPhotoSize::big ]) : string
Parameters
- $size : ChatPhotoSize = ChatPhotoSize::big
-
(Optional) Size of the profile picture. Default is big.
Tags
Return values
stringpin_message()
public
pin_message(int $message_id[, bool $disable_notification = false ]) : bool
Parameters
- $message_id : int
-
Message id of the message to pin.
- $disable_notification : bool = false
-
(Optional) Disable notification. Default is false.
Tags
Return values
boolrevoke_invite_link()
public
revoke_invite_link(string $invite_link) : bool
Parameters
- $invite_link : string
-
Invite link to revoke.
Tags
Return values
boolsave_chat_from_message()
public
static save_chat_from_message(stdClass $message) : void
Parameters
- $message : stdClass
-
Message object.
Tags
set_description()
public
set_description(string $description) : void
Parameters
- $description : string
-
New chat description.
Tags
set_permissions()
public
set_permissions(stdClass $permissions) : void
Parameters
- $permissions : stdClass
-
Chat permissions. Docs: https://core.telegram.org/bots/api#chatpermissions
Tags
set_title()
public
set_title(string $title) : void
Parameters
- $title : string
-
New chat title.
Tags
chat_member_to_array()
private
chat_member_to_array(stdClass $member_obj) : array<string|int, mixed>
Parameters
- $member_obj : stdClass
-
Member object.
Tags
Return values
array<string|int, mixed>get_chat()
private
get_chat() : stdClass|null