1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
chatservice.php
См. документацию.
1<?php
2
3namespace Bitrix\Calendar\Integration\Im;
4
5use Bitrix\Main\Loader;
6
7final class ChatService
8{
9 private static ?self $instance;
10
11 public static function getInstance(): self
12 {
13 self::$instance ??= new self();
14
15 return self::$instance;
16 }
17
18 public function deleteUserFromChat(int $userId, int $chatId): bool
19 {
20 if (!$this->isAvailable())
21 {
22 return false;
23 }
24
25 $chat = new \CIMChat(0);
26
27 return $chat->DeleteUser(
28 chatId: $chatId,
29 userId: $userId,
30 checkPermission: false,
31 skipMessage: false,
32 additionalParams: ['SKIP_RIGHTS' => true],
33 );
34 }
35
36 public function addUserToChat(int $userId, int $chatId): bool
37 {
38 if (!$this->isAvailable())
39 {
40 return false;
41 }
42
43 $chat = new \CIMChat(0);
44
45 return $chat->AddUser(
46 chatId: $chatId,
47 userId: $userId,
48 hideHistory: false,
49 skipMessage: false,
50 );
51 }
52
53 public function isAvailable(): bool
54 {
55 return Loader::includeModule('im');
56 }
57
58 private function __construct()
59 {
60 }
61}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
deleteUserFromChat(int $userId, int $chatId)
Определения chatservice.php:18
addUserToChat(int $userId, int $chatId)
Определения chatservice.php:36