PhpSlackBot\Bot::loadCommand PHP Method

loadCommand() public method

public loadCommand ( $command )
    public function loadCommand($command)
    {
        if ($command instanceof Command\BaseCommand) {
            $this->commands[$command->getName()] = $command;
        } else {
            throw new \Exception('Command must implement PhpSlackBot\\Command\\BaseCommand');
        }
    }

Usage Example

Example #1
0
<?php

use gries\Pokebot\Command\PokemathCommand;
use PhpSlackBot\Bot;
require_once __DIR__ . '/../vendor/autoload.php';
$bot = new Bot();
$bot->setToken('token');
$bot->loadCommand(new PokemathCommand());
$bot->run();
All Usage Examples Of PhpSlackBot\Bot::loadCommand