Overview
  • Namespace
  • Class

Namespaces

  • Slack
    • Message

Classes

  • Slack\ApiClient
  • Slack\Bot
  • Slack\Channel
  • Slack\ClientObject
  • Slack\DataObject
  • Slack\DirectMessageChannel
  • Slack\Group
  • Slack\Message\Attachment
  • Slack\Message\AttachmentBuilder
  • Slack\Message\AttachmentField
  • Slack\Message\Message
  • Slack\Message\MessageBuilder
  • Slack\Payload
  • Slack\RealTimeClient
  • Slack\Team
  • Slack\User

Interfaces

  • Slack\ChannelInterface
  • Slack\Exception

Exceptions

  • Slack\ApiException
  • Slack\ConnectionException
  • Slack\UserNotFoundException
 1 <?php
 2 namespace Slack;
 3 
 4 /**
 5  * Contains information about a direct message channel.
 6  */
 7 class DirectMessageChannel extends ClientObject implements ChannelInterface
 8 {
 9     /**
10      * {@inheritDoc}
11      */
12     public function getId()
13     {
14         return $this->data['id'];
15     }
16 
17     /**
18      * Gets the time the channel was created.
19      *
20      * @return \DateTime The time the channel was created.
21      */
22     public function getTimeCreated()
23     {
24         $time = new \DateTime();
25         $time->setTimestamp($this->data['created']);
26         return $time;
27     }
28 
29     /**
30      * Gets the user the direct message channel is with.
31      *
32      * @return \React\Promise\PromiseInterface
33      */
34     public function getUser()
35     {
36         return $this->client->getUserById($this->data['user']);
37     }
38 
39     /**
40      * {@inheritDoc}
41      */
42     public function close()
43     {
44         return $this->client->apiCall('im.close', [
45             'channel' => $this->getId(),
46         ])->then(function ($response) {
47             return !isset($response['no_op']);
48         });
49     }
50 }
51 
API documentation generated by ApiGen