Slack\User::getPresence PHP Method

getPresence() public method

Gets a user's presence.
public getPresence ( ) : React\Promise\PromiseInterface
return React\Promise\PromiseInterface The current user's presence, either "active" or "away".
    public function getPresence()
    {
        return $this->client->apiCall('users.getPresence', ['user' => $this->getId()])->then(function (Payload $response) {
            return $response['presence'];
        });
    }

Usage Example

Ejemplo n.º 1
0
 public function testGetPresence()
 {
     $presence = $this->faker->boolean ? 'active' : 'away';
     $user = new User($this->client, ['id' => $this->faker->uuid]);
     $this->mockResponse(200, null, ['ok' => true, 'presence' => $presence]);
     $this->watchPromise($user->getPresence()->then(function ($actual) use($presence) {
         $this->assertEquals($presence, $actual);
     }));
 }