app/Http/Controllers/BotManController.php
/**
     * Place your BotMan logic here.
     */
Place your BotMan logic here.
Place your BotMan logic here .
public function handle()
    {
        $botman = app('botman');
        $botman->fallback(function($bot) {
            $bot->reply('Ketik "covid" untuk melihat statistik Berdasarkan Negara, ketik "check" untuk melakukan test mandiri, ketik "hospital" untuk Rumah sakit Rujukan di Indonesia'. PHP_EOL .'----------------------------'. PHP_EOL . 'Type "covid" to see statistics by country, type "check" to do an self-assesment, type "hospital" for referral hospitals in Indonesia' );
        });
        $botman->hears('Check', function (BotMan $bot) {
            $bot->types();
            $bot->reply('Click Link Below to take self assesment '. PHP_EOL .'https://lawancovid-19.surabaya.go.id/self-assessment');
        });
        $botman->hears("hello, I'm {name}", function ($bot, $name) {
            $bot->reply('Hello '.$name.', nice to meet you!');
        });
        $botman->hears('covid', function ($bot) {
            $bot->types();
            $results = $this->getGlobalData();
            $bot->reply($results);
        });
        $botman->hears('hospital', function ($bot) {
            $bot->types();
            $bot->reply('Click Link Below for Indonesia hospital support '. PHP_EOL .'>> https://gis-kawalcovid19.hub.arcgis.com/datasets/rs-rujukan-penanganan-covid19/data?geometry=110.957%2C-9.310%2C120.186%2C-7.408');
        });
        $botman->hears('infodetail', function ($bot) {
            $bot->types();
             $bot->types();
            $bot->reply('Click Link Below for detail information about covid-19 in Indonesia '. PHP_EOL .'>> https://kawalcovid19.blob.core.windows.net/viz/statistik_harian.html'. PHP_EOL .'>> https://kawalcorona.com/');
        });
        $botman->hears('/global', function ($bot) {
            $bot->types();
            $results = $this->getGlobalData();
            $bot->reply($results);
        });
        $botman->hears('/global_{value}', function ($bot, $value) {
            $bot->types();
            $results = $this->getRegionalData($value);
            $bot->reply($results);
        });
        $botman->hears('/medcare', function ($bot) {
            $bot->types();
            $results = $this->getMedCareData();
            $bot->reply($results);
        });
        $botman->hears('/medcare_{value}', function ($bot, $value) {
            $bot->types();
            $results = $this->getMedCareRegionalData($value);
            $bot->reply($results);
        });
        $botman->hears('/positif', function ($bot) {
            $bot->types();
            $result = $this->getIndividualData('/positif');
            $bot->reply($result);
        });
        $botman->hears('/sembuh', function ($bot) {
            $bot->types();
            $result = $this->getIndividualData('/sembuh');
            $bot->reply($result);
        });
        $botman->hears('/meninggal', function ($bot) {
            $bot->types();
            $result = $this->getIndividualData('/meninggal');
            $bot->reply($result);
        });
        $botman->hears('get', function ($bot) {
            $bot->types();
            $result = $this->getIndividualData('/meninggal');
            $bot->reply($result);
        });
        $botman->receivesLocation(function($bot, Location $location) {
            $lat = $location->getLatitude();
            $lng = $location->getLongitude();
            $bot->reply('Lokasi Anda: Lat ' . $lat . ', Lng ' . $lng);
        });
        $botman->listen();
    }
public function handle ( ) { $ botman = app ( 'botman' ) ; $ botman -> fallback ( function ( $ bot ) { $ bot -> reply ( 'Ketik "covid" untuk melihat statistik Berdasarkan Negara, ketik "check" untuk melakukan test mandiri, ketik "hospital" untuk Rumah sakit Rujukan di Indonesia' . PHP_EOL . '----------------------------' . PHP_EOL . 'Type "covid" to see statistics by country, type "check" to do an self-assesment, type "hospital" for referral hospitals in Indonesia' ) ; } ) ; $ botman -> hears ( 'Check' , function ( BotMan $ bot ) { $ bot -> types ( ) ; $ bot -> reply ( 'Click Link Below to take self assesment ' . PHP_EOL . 'https://lawancovid-19.surabaya.go.id/self-assessment' ) ; } ) ; $ botman -> hears ( " hello, I'm {name} " , function ( $ bot , $ name ) { $ bot -> reply ( 'Hello ' . $ name . ', nice to meet you!' ) ; } ) ; $ botman -> hears ( 'covid' , function ( $ bot ) { $ bot -> types ( ) ; $ results = $ this -> getGlobalData ( ) ; $ bot -> reply ( $ results ) ; } ) ; $ botman -> hears ( 'hospital' , function ( $ bot ) { $ bot -> types ( ) ; $ bot -> reply ( 'Click Link Below for Indonesia hospital support ' . PHP_EOL . '>> https://gis-kawalcovid19.hub.arcgis.com/datasets/rs-rujukan-penanganan-covid19/data?geometry=110.957%2C-9.310%2C120.186%2C-7.408' ) ; } ) ; $ botman -> hears ( 'infodetail' , function ( $ bot ) { $ bot -> types ( ) ; $ bot -> types ( ) ; $ bot -> reply ( 'Click Link Below for detail information about covid-19 in Indonesia ' . PHP_EOL . '>> https://kawalcovid19.blob.core.windows.net/viz/statistik_harian.html' . PHP_EOL . '>> https://kawalcorona.com/' ) ; } ) ; $ botman -> hears ( '/global' , function ( $ bot ) { $ bot -> types ( ) ; $ results = $ this -> getGlobalData ( ) ; $ bot -> reply ( $ results ) ; } ) ; $ botman -> hears ( '/global_{value}' , function ( $ bot , $ value ) { $ bot -> types ( ) ; $ results = $ this -> getRegionalData ( $ value ) ; $ bot -> reply ( $ results ) ; } ) ; $ botman -> hears ( '/medcare' , function ( $ bot ) { $ bot -> types ( ) ; $ results = $ this -> getMedCareData ( ) ; $ bot -> reply ( $ results ) ; } ) ; $ botman -> hears ( '/medcare_{value}' , function ( $ bot , $ value ) { $ bot -> types ( ) ; $ results = $ this -> getMedCareRegionalData ( $ value ) ; $ bot -> reply ( $ results ) ; } ) ; $ botman -> hears ( '/positif' , function ( $ bot ) { $ bot -> types ( ) ; $ result = $ this -> getIndividualData ( '/positif' ) ; $ bot -> reply ( $ result ) ; } ) ; $ botman -> hears ( '/sembuh' , function ( $ bot ) { $ bot -> types ( ) ; $ result = $ this -> getIndividualData ( '/sembuh' ) ; $ bot -> reply ( $ result ) ; } ) ; $ botman -> hears ( '/meninggal' , function ( $ bot ) { $ bot -> types ( ) ; $ result = $ this -> getIndividualData ( '/meninggal' ) ; $ bot -> reply ( $ result ) ; } ) ; $ botman -> hears ( 'get' , function ( $ bot ) { $ bot -> types ( ) ; $ result = $ this -> getIndividualData ( '/meninggal' ) ; $ bot -> reply ( $ result ) ; } ) ; $ botman -> receivesLocation ( function ( $ bot , Location $ location ) { $ lat = $ location -> getLatitude ( ) ; $ lng = $ location -> getLongitude ( ) ; $ bot -> reply ( 'Lokasi Anda: Lat ' . $ lat . ', Lng ' . $ lng ) ; } ) ; $ botman -> listen ( ) ; }
Place your BotMan logic here.
Place your BotMan logic here .
// Make your bot feel and act more human, you can make it send “typing …” //Get Data From API //Get Data From API //Get Data From API //Get Data From API //Get Data From API //Get Data From API //Get Data From API //Get Data From API //Get Data From API