Ejemplo n.º 1
0
 private function postToInternal($message, Shotbow_ChatBot_User $user, $channel = '#shoutbox')
 {
     $internalFormatted = $message;
     $internalFormatted = preg_replace('#\\[url=([^\\]]+)\\]([^\\[]+)\\[/url\\]#i', '<$1|$2>', $internalFormatted);
     $payload = json_encode(['username' => $user->getName(), 'icon_url' => 'https://shotbow.net/forum/mobiquo/avatar.php?user_id=' . $user->getId(), 'text' => $internalFormatted, 'channel' => $channel]);
     $ch = @curl_init($this->postUrl);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
     curl_setopt($ch, CURLOPT_POSTFIELDS, 'payload=' . $payload);
     curl_exec($ch);
 }
Ejemplo n.º 2
0
 protected function command_fry(Shotbow_ChatBot_User $sender, $arguments)
 {
     if ($sender->getId() == 319) {
         if (!empty($arguments)) {
             $this->postMessage('I must obey my master...');
             $this->postAction('zaps ' . $arguments . ' with 10,000 volts of electricity!');
         } else {
             $this->postMessage('Yes, master... but who?');
         }
     } else {
         $this->postMessage('I try not to be violent.. but you all just keep pushing me...');
         $this->postAction('zaps ' . $sender->getName() . ' with an electric shock!');
     }
 }