예제 #1
0
파일: Finder.php 프로젝트: tmaciej/slackphp
 public function getChannels()
 {
     if ($this->channels === null) {
         $request = new Request('channels.list');
         $response = $request->execute();
         $this->channels = $response->channels;
     }
     return $this->channels;
 }
예제 #2
0
 public function send($text, $channels, $username = '******')
 {
     if (!is_array($channels)) {
         $channels = (array) $channels;
     }
     $channels = array_merge($this->channels, $channels);
     foreach ($channels as $channel) {
         if (strpos($channel, '#') === 0) {
             $id = $this->finder->find($channel);
         } else {
             $id = $channel;
         }
         if ($id !== null) {
             $request = new Request('chat.postMessage', array('channel' => $id, 'text' => $text, 'username' => $username));
             $request->execute();
             unset($request);
         }
     }
 }