- Модуль: imbot
- Путь к файлу: ~/bitrix/modules/imbot/lib/bot/partner24.php
- Класс: BitrixImBotBotPartner24
- Вызов: Partner24::updateBotProperties
static function updateBotProperties()
{
if (!MainLoader::includeModule('im'))
{
return false;
}
if (!self::getBotId())
{
return false;
}
$botParams = [
'CLASS' => __CLASS__,
'METHOD_MESSAGE_ADD' => 'onMessageAdd', /** @see Partner24::onMessageAdd */
'METHOD_WELCOME_MESSAGE' => 'onChatStart', /** @see Partner24::onChatStart */
'METHOD_BOT_DELETE' => 'onBotDelete',/** @see Partner24::onBotDelete */
'TEXT_CHAT_WELCOME_MESSAGE' => '',
'TEXT_PRIVATE_WELCOME_MESSAGE' => '',
'VERIFIED' => 'Y',
'CODE' => 'network_'.self::getBotCode(),
'APP_ID' => self::getBotCode(),
'PROPERTIES' => [
'LOGIN' => 'bot_imbot_partner24',
'NAME' => self::getBotName(),
'WORK_POSITION' => self::getBotDesc()
]
];
$botData = ImUser::getInstance(self::getBotId());
$userAvatar = ImUser::uploadAvatar(self::getBotAvatar(), self::getBotId());
if ($userAvatar && $botData->getAvatarId() != $userAvatar)
{
$botParams['PROPERTIES']['PERSONAL_PHOTO'] = $userAvatar;
}
ImBot::update(['BOT_ID' => self::getBotId()], $botParams);
self::registerCommands(self::getBotId());
self::registerApps(self::getBotId());
return true;
}