SupportBot extends NetworkBot
Common interface for support bots.
Table of Contents
Methods
- allowAdditionalQuestion() : bool
- Permits adding new question.
- getAccessLevel() : string
- Detects client's access level.
- getAppList() : array<string|int, array{command: string, icon: string, js: string, context: string, lang: string}>
- Returns app's property list.
- getBotAvatar() : string
- Returns url of the bot avatar picture.
- getBotCode() : string
- Returns OL code.
- getBotDesc() : string
- Return bot shot description.
- getBotId() : int
- Returns registered bot Id.
- getBotName() : string
- Return name of the bot.
- getBotSettings() : array<string|int, mixed>|null
- Loads bot settings from controller.
- getCommandList() : array<string|int, array{handler: string, visible: bool, context: string}>
- Returns command's property list.
- getError() : Error
- getMessage() : string|null
- Returns phrase by the code.
- getQuestionLimit() : int
- Returns the limit for additional questions.
- getSupportLevel() : string
- Detects client's support level.
- isEnabled() : bool
- Is bot enabled.
- isNeedUpdateBotAvatarAfterNewMessage() : bool
- Allows updating bot's avatar using data from incoming message.
- isNeedUpdateBotFieldsAfterNewMessage() : bool
- Allows updating bot fields (name, desc, avatar, welcome mess) using data from incoming message.
- onAnswerAdd() : array<string|int, mixed>
- Event handler on answer add.
- onBotDelete() : bool
- Event handler on bot remove.
- onChatStart() : bool
- Event handler when bot join to chat.
- onCommandAdd() : bool
- Event handler on command add.
- onMessageAdd() : bool
- Event handler on message add.
- onReceiveCommand() : Error|array<string|int, mixed>
- Event handler on answer add.
- onSessionVote() : bool
- Handler for "im:OnSessionVote" event.
- register() : int
- Register bot at portal.
- registerApps() : bool
- Register bot's command.
- registerCommands() : bool
- Register bot's command.
- unRegister() : bool
- Unregister bot at portal.
Methods
allowAdditionalQuestion()
Permits adding new question.
public
static allowAdditionalQuestion([int|null $botId = null ]) : bool
Parameters
- $botId : int|null = null
Return values
boolgetAccessLevel()
Detects client's access level.
public
static getAccessLevel() : string
Return values
stringgetAppList()
Returns app's property list.
public
static getAppList() : array<string|int, array{command: string, icon: string, js: string, context: string, lang: string}>
Return values
array<string|int, array{command: string, icon: string, js: string, context: string, lang: string}>getBotAvatar()
Returns url of the bot avatar picture.
public
static getBotAvatar() : string
Return values
stringgetBotCode()
Returns OL code.
public
static getBotCode() : string
Return values
stringgetBotDesc()
Return bot shot description.
public
static getBotDesc() : string
Return values
stringgetBotId()
Returns registered bot Id.
public
static getBotId() : int
Return values
intgetBotName()
Return name of the bot.
public
static getBotName() : string
Return values
stringgetBotSettings()
Loads bot settings from controller.
public
static getBotSettings([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>|null
Parameters
- $params : array<string|int, mixed> = []
-
Command arguments.
Return values
array<string|int, mixed>|nullgetCommandList()
Returns command's property list.
public
static getCommandList() : array<string|int, array{handler: string, visible: bool, context: string}>
Return values
array<string|int, array{handler: string, visible: bool, context: string}>getError()
public
static getError() : Error
Return values
ErrorgetMessage()
Returns phrase by the code.
public
static getMessage(string $code) : string|null
Parameters
- $code : string
Return values
string|nullgetQuestionLimit()
Returns the limit for additional questions.
public
static getQuestionLimit([int|null $botId = null ]) : int
Parameters
- $botId : int|null = null
Return values
int —-1 - Functional is disabled, 0 - There is no limit, 1 - Only one session allowed, n - Max number for sessions allowed.
getSupportLevel()
Detects client's support level.
public
static getSupportLevel() : string
Return values
stringisEnabled()
Is bot enabled.
public
static isEnabled() : bool
Return values
boolisNeedUpdateBotAvatarAfterNewMessage()
Allows updating bot's avatar using data from incoming message.
public
static isNeedUpdateBotAvatarAfterNewMessage() : bool
Return values
boolisNeedUpdateBotFieldsAfterNewMessage()
Allows updating bot fields (name, desc, avatar, welcome mess) using data from incoming message.
public
static isNeedUpdateBotFieldsAfterNewMessage() : bool
Return values
boolonAnswerAdd()
Event handler on answer add.
public
static onAnswerAdd(string $command, array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $command : string
- $params : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>onBotDelete()
Event handler on bot remove.
public
static onBotDelete([int|null $bodId = null ]) : bool
Parameters
- $bodId : int|null = null
Tags
Return values
boolonChatStart()
Event handler when bot join to chat.
public
static onChatStart(string $dialogId, array<string|int, mixed> $joinFields) : bool
Parameters
- $dialogId : string
- $joinFields : array<string|int, mixed>
Tags
Return values
boolonCommandAdd()
Event handler on command add.
public
static onCommandAdd(int $messageId, array<string|int, mixed> $messageFields) : bool
Parameters
- $messageId : int
-
Incomming message Id.
- $messageFields : array<string|int, mixed>
-
Message fields array.
Tags
Return values
boolonMessageAdd()
Event handler on message add.
public
static onMessageAdd(int $messageId, array<string|int, mixed> $messageFields) : bool
Parameters
- $messageId : int
-
Outgoing message Id.
- $messageFields : array<string|int, mixed>
-
Message fields array.
Tags
Return values
boolonReceiveCommand()
Event handler on answer add.
public
static onReceiveCommand(string $command, array<string|int, mixed> $params) : Error|array<string|int, mixed>
Alias for @see \Bitrix\Imbot\Bot\ChatBot::onAnswerAdd
Parameters
- $command : string
-
Text command alias.
- $params : array<string|int, mixed>
-
Command arguments.
Return values
Error|array<string|int, mixed>onSessionVote()
Handler for "im:OnSessionVote" event.
public
static onSessionVote(array<string|int, mixed> $params) : bool
Parameters
- $params : array<string|int, mixed>
-
Event arguments.
Tags
Return values
boolregister()
Register bot at portal.
public
static register([array<string|int, mixed> $params = [] ]) : int
Parameters
- $params : array<string|int, mixed> = []
Return values
intregisterApps()
Register bot's command.
public
static registerApps() : bool
Return values
boolregisterCommands()
Register bot's command.
public
static registerCommands() : bool
Return values
boolunRegister()
Unregister bot at portal.
public
static unRegister([string $code = '' ][, bool $notifyController = true ]) : bool
Parameters
- $code : string = ''
-
Open Line Id.
- $notifyController : bool = true
-
Send unregister notification request to controller.