Skip to content

$chatMember->status , it seems not defined #370

Answered by Lukasss93
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

The IDE will not autocomplete that fields because ChatMember is not a real type (it's an abstract type)...

Anyway, to fix this, you can check the specific type of ChatMember, like this:

$chatMember = $bot->getChatMember($chatID, $userID);

if($chatMember instanceof ChatMemberMember || 
   $chatMember instanceof ChatMemberAdministrator || 
   $chatMember instanceof ChatMemberOwner) {
    // your code
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ghost
Comment options

@ghost
Comment options

Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant