20 if (!Loader::includeModule(self::MODULE_ID))
25 $params = Option::get(self::MODULE_ID, self::OPTION_NAME,
"");
26 $params = ($params !==
"" ? @unserialize($params, [
'allowed_classes' =>
false]) : []);
27 $params = (is_array($params) ? $params : []);
34 $lastId = $lastId ?? $params[
'lastId'];
36 $query = BotTable::query()
37 ->setSelect([
'BOT_ID',
'TYPE'])
38 ->setLimit($this->queryCount)
39 ->setOrder(
'BOT_ID',
'ASC')
40 ->where(
'BOT_ID' ,
'>', $lastId)
46 while ($row = $query->fetch())
48 $lastId = (int)$row[
'BOT_ID'];
49 $params[
'lastId'] = $lastId;
51 if ($row[
'TYPE'] ===
'H')
61 BotTable::updateByFilter(
70 foreach ($botIds as $botId)
72 BotData::cleanCache($botId);
77 Option::set(self::MODULE_ID, self::OPTION_NAME, serialize($params));
82 Option::delete(self::MODULE_ID, [
"name" => self::OPTION_NAME]);
84 \Bitrix\Im\Bot::clearCache();