File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 55
66
77use Longman \TelegramBot \Entities \Entity ;
8+ use Longman \TelegramBot \Exception \TelegramException ;
89
910class Factory extends \Longman \TelegramBot \Entities \Factory
1011{
1112 public function make (array $ data , string $ bot_username ): Entity
1213 {
13- var_dump ($ data );
14+ $ status = $ data ['status ' ];
15+ switch ($ status ) {
16+ case 'creator ' :
17+ return new ChatMemberOwner ($ data , $ bot_username );
18+ case 'administrator ' :
19+ return new ChatMemberAdministrator ($ data , $ bot_username );
20+ case 'member ' :
21+ return new ChatMemberMember ($ data , $ bot_username );
22+ case 'restricted ' :
23+ return new ChatMemberRestricted ($ data , $ bot_username );
24+ case 'left ' :
25+ return new ChatMemberLeft ($ data , $ bot_username );
26+ case 'kicked ' :
27+ return new ChatMemberBanned ($ data , $ bot_username );
28+ }
29+
30+ throw new TelegramException ('Unexpected ChatMember type ' );
1431 }
1532}
You can’t perform that action at this time.
0 commit comments