Exemplo n.º 1
0
 public function process(\Shotbow_ChatBot_User $sender, $message)
 {
     static::outputDebug($message, $sender->getName());
     $this->messages = [];
     parent::process($sender, $message);
     return $this->messages;
 }
Exemplo n.º 2
0
 public function testAllCommandsDontError()
 {
     $dbh = new PDO();
     $bot = new Bot($dbh);
     $navarr = \Shotbow_ChatBot_User::create(1, 'Navarr');
     $commands = $bot->getCommandList();
     foreach ($commands as $command => $callable) {
         $bot->process($navarr, "!{$command}");
     }
 }
Exemplo n.º 3
0
 protected function command_fry(Shotbow_ChatBot_User $sender, $arguments)
 {
     $this->postMessage('I try not to be violent.. but you all just keep pushing me...');
     $this->postMessage('zaps ' . $sender->getName() . ' with an electric shock!');
 }
Exemplo n.º 4
0
 protected function command_activeusers(Shotbow_ChatBot_User $sender, $arguments)
 {
     if ($sender->getName() != 'Navarr') {
         return;
     }
     $users = $this->getUsersInChat();
     $usernames = [];
     $message = "Players in chat: ";
     foreach ($users as $user) {
         $usernames[] = $user->getName();
     }
     $message .= implode(', ', $usernames);
     $this->postMessage($message);
 }
Exemplo n.º 5
0
 public function testToString()
 {
     $user = \Shotbow_ChatBot_User::create(2, 'lazertester');
     $stringified = (string) $user;
     $this->assertEquals('lazertester', $stringified);
 }
Exemplo n.º 6
0
<?php

require_once 'vendor/autoload.php';
$user = Shotbow_ChatBot_User::create(1, 'Navarr');
Exemplo n.º 7
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!');
     }
 }