/** * Main function for building up a ping and sending it off. First checks if the type is valid. * Called after the input from the slash command has been parsed, or can be called by external scripts. * * @param String $type * @param String $message * @param String $sender * * @return bool */ public function ping($type, $message, $sender) { if (!$this->isValidPingType($type)) { return false; } $payload = $this->makePayload($type, $message, $sender); if ($this->slack->sendMessageToServer($payload)) { $this->returnMessage = 'Ping sent'; if (config('pingbot.ping-bots.' . $type . '.announce')) { $this->slack->sendMessageToServer($this->announcementPayload($type, $sender)); } return true; } return false; }
/** * Execute the console command. * * @return mixed */ public function fire(SlackMonkey $slackMonkey) { $payload = ['channel' => '#p-drama', 'username' => config('pingbot.ping-bot-name'), 'icon_emoji' => config('pingbot.ping-bot-emoji'), 'text' => 'HAPPY BIRTHDAY @punkslap', 'link_names' => 1]; $slackMonkey->sendMessageToServer($payload); }