PHP 클래스 Longman\TelegramBot\Conversation

Only one conversation can be active at any one time. A conversation is directly linked to a user, chat and the command that is managing the conversation.
파일 보기 프로젝트 열기: akalongman/php-telegram-bot 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$notes array Notes to be stored

보호된 프로퍼티들

프로퍼티 타입 설명
$chat_id integer Telegram chat id
$command string Command to be executed if the conversation is active
$conversation array All information fetched from the database
$protected_notes array Notes stored inside the conversation
$user_id integer Telegram user id

공개 메소드들

메소드 설명
__construct ( integer $user_id, integer $chat_id, string $command = null ) Conversation contructor to initialize a new conversation
cancel ( ) : boolean Cancel the current conversation
exists ( ) : boolean Check if the conversation already exists
getCommand ( ) : string | null Retrieve the command to execute from the conversation
stop ( ) : boolean Delete the current conversation
update ( ) : boolean Store the array/variable in the database with json_encode() function

보호된 메소드들

메소드 설명
clear ( ) : boolean Clear all conversation variables.
load ( ) : boolean Load the conversation from the database
start ( ) : boolean Start a new conversation if the current command doesn't have one yet
updateStatus ( string $status ) : boolean Update the status of the current conversation

메소드 상세

__construct() 공개 메소드

Conversation contructor to initialize a new conversation
public __construct ( integer $user_id, integer $chat_id, string $command = null )
$user_id integer
$chat_id integer
$command string

cancel() 공개 메소드

Cancel the current conversation
public cancel ( ) : boolean
리턴 boolean

clear() 보호된 메소드

Clear all conversation variables.
protected clear ( ) : boolean
리턴 boolean Always return true, to allow this method in an if statement.

exists() 공개 메소드

Check if the conversation already exists
public exists ( ) : boolean
리턴 boolean

getCommand() 공개 메소드

Retrieve the command to execute from the conversation
public getCommand ( ) : string | null
리턴 string | null

load() 보호된 메소드

Load the conversation from the database
protected load ( ) : boolean
리턴 boolean

start() 보호된 메소드

Start a new conversation if the current command doesn't have one yet
protected start ( ) : boolean
리턴 boolean

stop() 공개 메소드

Currently the Conversation is not deleted but just set to 'stopped'
public stop ( ) : boolean
리턴 boolean

update() 공개 메소드

Store the array/variable in the database with json_encode() function
public update ( ) : boolean
리턴 boolean

updateStatus() 보호된 메소드

Update the status of the current conversation
protected updateStatus ( string $status ) : boolean
$status string
리턴 boolean

프로퍼티 상세

$chat_id 보호되어 있는 프로퍼티

Telegram chat id
protected int $chat_id
리턴 integer

$command 보호되어 있는 프로퍼티

Command to be executed if the conversation is active
protected string $command
리턴 string

$conversation 보호되어 있는 프로퍼티

All information fetched from the database
protected array $conversation
리턴 array

$notes 공개적으로 프로퍼티

Notes to be stored
public array $notes
리턴 array

$protected_notes 보호되어 있는 프로퍼티

Notes stored inside the conversation
protected array $protected_notes
리턴 array

$user_id 보호되어 있는 프로퍼티

Telegram user id
protected int $user_id
리턴 integer