NetworkBot extends ChatBot
Common interface for chat bots.
Table of Contents
Methods
- allowAdditionalQuestion() : bool
- Permits adding new question.
- getAppList() : array<string|int, array{command: string, icon: string, js: string, context: string, lang: string}>
- Returns app's property list.
- getBotCode() : string
- Returns OL code.
- getBotId() : int
- Returns registered bot Id.
- getCommandList() : array<string|int, array{handler: string, visible: bool, context: string}>
- Returns command's property list.
- getError() : Error
- getQuestionLimit() : int
- Returns the limit for additional questions.
- 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
boolgetAppList()
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}>getBotCode()
Returns OL code.
public
static getBotCode() : string
Return values
stringgetBotId()
Returns registered bot Id.
public
static getBotId() : int
Return values
intgetCommandList()
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
ErrorgetQuestionLimit()
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.
isEnabled()
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.