PHP code example of revolution / botman-chatwork

1. Go to this page and download the library: Download revolution/botman-chatwork library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

revolution / botman-chatwork example snippets




namespace App\Providers\BotMan;

use BotMan\BotMan\Drivers\DriverManager;
use BotMan\Studio\Providers\DriverServiceProvider as ServiceProvider;

use Revolution\BotMan\Drivers\ChatWork\ChatWorkRoomDriver;
use Revolution\BotMan\Drivers\ChatWork\ChatWorkAccountDriver;

class DriverServiceProvider extends ServiceProvider
{
    /**
     * The drivers that should be loaded to
     * use with BotMan
     *
     * @var array
     */
    protected $drivers = [
        //        ChatWorkRoomDriver::class,
        ChatWorkAccountDriver::class,
    ];

    /**
     * @return void
     */
    public function boot()
    {
        parent::boot();

        foreach ($this->drivers as $driver) {
            DriverManager::loadDriver($driver);
        }
    }
}

$botman->hears('Hi', function ($bot) {
    $bot->reply('Hello!', ['api_token' => '...']);
});

$botman->say('say()', 'Room ID', ChatWorkAccountDriver::class, ['api_token' => '...']);
bash
php artisan vendor:publish --provider="Revolution\BotMan\Drivers\ChatWork\Providers\ChatWorkDriverServiceProvider"