TelegramSDK_php

User
in package

Tags
brief

This class lets you get information about users.

details

This class contains functions to get information about users. To change the user, use the set_user() method.

see
User::set_user()

Table of Contents

Properties

$first_name  : string
$full_name  : string
$last_name  : string
$user_id  : int
$username  : string

Methods

__construct()  : mixed
__get()  : mixed
get_latest_messages()  : int
get_new_user_by_id()  : array<string|int, mixed>
get_profile_picture()  : string
set_user()  : bool

Properties

$first_name read-only

public string $first_name

The first name.

$full_name read-only

public string $full_name

The full name. This is a combination of the first and last name.

$last_name read-only

public string $last_name

The last name.

$user_id read-only

public int $user_id

The user id. Use set_user() to change the user.

$username read-only

public string $username

The username.

Methods

__construct()

public __construct() : mixed

__get()

public __get(string $name) : mixed
Parameters
$name : string
Tags
brief

Get protected properties, keeping them protected from being changed.

throws
Exception

If variable does not exist or is not allowed to be accessed externally.

get_latest_messages()

public get_latest_messages([int $amount = 100 ]) : int
Parameters
$amount : int = 100

(Optional) Amount of messages to get. Default is 100.

Tags
brief

Get latest (default 100) messages from user. PM only.

Return values
int

get_new_user_by_id()

public static get_new_user_by_id(int $user_id) : array<string|int, mixed>
Parameters
$user_id : int
Tags
brief

Get new user by id

Return values
array<string|int, mixed>

get_profile_picture()

public get_profile_picture([int $size = 320 ]) : string
Parameters
$size : int = 320

(Optional) Size of the profile picture. Default is 320.

Tags
brief

Get user profile picture url. Only returns the first one.

Note: This function returns a url containing sensitive information. Make sure to protect it and not share with end users.

Return values
string

set_user()

public set_user(string|int $identifier) : bool
Parameters
$identifier : string|int

Can be a username or a user id.

Tags
brief

Sets user. Returns false if user does not exist in database.

Return values
bool

        
On this page

Search results