Skip to content

Issue with ServerResponse #331

@jacklul

Description

@jacklul

Responses from getChat are being mistakely handled by getMe condition:

if (isset($data['result']['total_count'])) {
	//Response from getUserProfilePhotos
	$this->result = new UserProfilePhotos($data['result']);
} elseif (isset($data['result']['file_id'])) {
	//Response from getFile
	$this->result = new File($data['result']);
} elseif (isset($data['result']['username'])) {
	//Response from getMe
	$this->result = new User($data['result']);
} elseif (isset($data['result']['id'])) {
	//Response from getChat
	$this->result = new Chat($data['result']);
} elseif (isset($data['result']['user'])) {
	//Response from getChatMember
	$this->result = new ChatMember($data['result']);
} else {
	//Response from sendMessage
	$this->result = new Message($data['result'], $bot_name);
}	

should be changed to:

(...)
} elseif (isset($data['result']['title'])) {
	//Response from getChat
	$this->result = new Chat($data['result']);
} elseif (isset($data['result']['username'])) {
	//Response from getMe
	$this->result = new User($data['result']);
(...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions