Esempio n. 1
0
 public function getChannels()
 {
     if ($this->channels === null) {
         $request = new Request('channels.list');
         $response = $request->execute();
         $this->channels = $response->channels;
     }
     return $this->channels;
 }
Esempio n. 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);
         }
     }
 }