示例#1
0
 /**
  * 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;
 }
示例#2
0
 /**
  * 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);
 }