Ejemplo n.º 1
0
 /**
  * @param SlackTimestamp $slackTimestamp
  * @return SlackMessage[]
  */
 public function getMessages(SlackTimestamp $slackTimestamp)
 {
     $response = $this->commander->execute('channels.history', ['channel' => $this->channel, 'oldest' => $slackTimestamp->getValue()]);
     $responseBody = $response->getBody();
     $responses = [];
     if (isset($responseBody['messages'])) {
         foreach ($responseBody['messages'] as $message) {
             \array_push($responses, new SlackMessage($message['text'], SlackTimestamp::createFromSlackString($message['ts'])));
         }
     }
     return $responses;
 }
Ejemplo n.º 2
0
 public function update(SlackTimestamp $time)
 {
     $this->since = $time;
     \file_put_contents($this->filepath, $time->getValue());
 }