1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace BPT\types; |
4
|
|
|
|
5
|
|
|
use BPT\constants\chatMemberStatus; |
6
|
|
|
use BPT\settings; |
7
|
|
|
use stdClass; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* This object represents changes in the status of a chat member. |
11
|
|
|
*/ |
12
|
|
|
class chatMemberUpdated extends types { |
|
|
|
|
13
|
|
|
/** Keep all of properties which has sub properties */ |
14
|
|
|
private const subs = [ |
15
|
|
|
'chat' => 'BPT\types\chat', |
16
|
|
|
'from' => 'BPT\types\user', |
17
|
|
|
'old_chat_member' => 'BPT\types\chatMember', |
18
|
|
|
'new_chat_member' => 'BPT\types\chatMember', |
19
|
|
|
'invite_link' => 'BPT\types\chatInviteLink', |
20
|
|
|
]; |
21
|
|
|
|
22
|
|
|
/** Chat the user belongs to */ |
23
|
|
|
public chat $chat; |
24
|
|
|
|
25
|
|
|
/** Performer of the action, which resulted in the change */ |
26
|
|
|
public user $from; |
27
|
|
|
|
28
|
|
|
/** Date the change was done in Unix time */ |
29
|
|
|
public int $date; |
30
|
|
|
|
31
|
|
|
/** Previous information about the chat member */ |
32
|
|
|
public chatMember $old_chat_member; |
33
|
|
|
|
34
|
|
|
/** New information about the chat member */ |
35
|
|
|
public chatMember $new_chat_member; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events |
39
|
|
|
* only. |
40
|
|
|
*/ |
41
|
|
|
public null|chatInviteLink $invite_link = null; |
42
|
|
|
|
43
|
|
|
|
44
|
|
|
public function __construct(stdClass|null $object = null) { |
45
|
|
|
if ($object != null) { |
46
|
|
|
parent::__construct($object, self::subs); |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function isUnBlockedMe(): bool { |
51
|
|
|
return $this->chat->isPrivate() && $this->isMe() && $this->isJoined(); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function isBlockedMe(): bool { |
55
|
|
|
return $this->chat->isPrivate() && $this->isMe() && $this->isKicked(); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function isMe (): bool { |
59
|
|
|
return $this->new_chat_member->user->id == settings::$bot_id; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function isAdded(): bool { |
63
|
|
|
return $this->isJoined() && $this->from->id !== $this->new_chat_member->user->id; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function isJoined(): bool { |
67
|
|
|
return $this->new_chat_member->status === chatMemberStatus::MEMBER; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function isJoinedByLink(): bool { |
71
|
|
|
return $this->isJoined() && !empty($this->invite_link); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function isLeaved (): bool { |
75
|
|
|
return $this->new_chat_member->status === chatMemberStatus::LEFT; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function isKicked (): bool { |
79
|
|
|
return $this->new_chat_member->status === chatMemberStatus::KICKED; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function isOldAdmin (): bool { |
83
|
|
|
return $this->old_chat_member->status === chatMemberStatus::ADMINISTRATOR && $this->isJoined(); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function isNewAdmin (): bool { |
87
|
|
|
return $this->new_chat_member->status === chatMemberStatus::ADMINISTRATOR; |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths