public function openChannelAction(\AlfredSlack\Models\ChatInterface $channel) { $id = $channel->getId(); // Get the IM id if a user if ($channel instanceof \AlfredSlack\Models\UserModel) { $im = $this->service->getImByUser($channel); $id = $im->getId(); } $url = 'slack://channel?id=' . $id . '&team=' . $channel->getAuth()->getTeamId(); Utils::openUrl($url); Utils::openApp('Slack'); }
public function postMessage(\AlfredSlack\Models\ChatInterface $channel, $message, $asBot = false) { $teamId = $channel->getAuth()->getTeamId(); $model = $this->services[$teamId]; return $model->postMessage($channel, $message, $asBot); }
public function postMessage(\AlfredSlack\Models\ChatInterface $channel, $message, $asBot = false) { $id = $channel->getId(); if ($channel instanceof \AlfredSlack\Models\UserModel) { $id = $this->getImByUser($channel)->getId(); } return $this->commander->execute('chat.postMessage', ['channel' => $id, 'text' => $message, 'as_user' => !$asBot, 'parse' => 'full', 'link_names' => 1, 'unfurl_links' => true, 'unfurl_media' => true])->getBody(); }