Incoming messages are empty

Aperta
#127 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
laravel, php
Ambito
api, backend

Direzione di ricerca

Inizia da config/botman/web.php, routes/botman.php e dal metodo handle mostrato nell’issue. Esegui la richiesta /botman/?driver=web e ispeziona l’IncomingMessage registrato e il driver selezionato, quindi traccia il percorso della richiesta fino a BotMan. Il lavoro è completato quando la richiesta web produce un IncomingMessage popolato e utilizza il web driver invece di NullDriver.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I am connecting botman to an existing project on laravel 5.8.

I installed botman and driver-web
added configs and botman routes
config/botman/config.php

return [
    'conversation_cache_time' => 40,
    'user_cache_time' => 30,
];

config/botman/web.php

return [
    'web' => [
        'matchingData' => [
            'driver' => 'web',
        ]
    ]
];

routes/botman.php

use App\Conversations\WorkingConversation;
use App\Conversations\ComplaintsConversation;
use App\Conversations\InstructionConversation;
use App\Conversations\CallServiceConversation;
use App\Conversations\VacationConversation;
use App\Conversations\InvoiceConversation;
use App\Conversations\ContactUpdateConversation;
use App\Conversations\BusinessOfferConversation;
use BotMan\BotMan\BotMan;
use Illuminate\Support\Facades\Log;

$botman = resolve('botman');

$botman->hears('{mess}', function ($bot, $mess) {
    /** @var BotMan $bot */
    Log::info('$bot mess >'.$mess.'<');
    Log::info('$bot message >'.var_export($bot->getMessage(), true).'<');
    Log::info('$bot driver >'.var_export($bot->getDriver(), true).'<');
    Log::info('$bot matches >'.var_export($bot->getMatches(), true).'<');
    $bot->reply('Hi!');
});

$botman->hears('Start', function ($bot) {
    Log::info('botman hears start!!1');
    $bot->reply('Hello!');
});

make a route
Route::match(['get', 'post'], '/botman', 'BotManController@handle');

handle function

public function handle(Request $request)
    {
        /** @var BotMan $botman */
        $botman = app('botman');
        $botman->listen();
    }

when i visit /botman/?driver=web&userId=111&message=Start the following is written to the log file

[2022-07-20 15:53:15] local.INFO: $bot mess ><  
[2022-07-20 15:53:15] local.INFO: $bot message >BotMan\BotMan\Messages\Incoming\IncomingMessage::__set_state(array(
   'message' => '',
   'sender' => '',
   'recipient' => '',
   'bot_id' => '',
   'images' => 
  array (
  ),
   'videos' => 
  array (
  ),
   'payload' => NULL,
   'extras' => 
  array (
  ),
   'audio' => 
  array (
  ),
   'files' => 
  array (
  ),
   'location' => NULL,
   'contact' => NULL,
   'isFromBot' => false,
))<  
[2022-07-20 15:53:15] local.INFO: $bot driver >BotMan\BotMan\Drivers\NullDriver::__set_state(array(
   'payload' => NULL,
   'event' => NULL,
   'http' => 
  BotMan\BotMan\Http\Curl::__set_state(array(
     'options' => 
    array (
    ),
  )),
   'config' => 
  Illuminate\Support\Collection::__set_state(array(
     'items' => 
    array (
    ),
  )),
   'content' => '',
))<  
[2022-07-20 15:53:15] local.INFO: $bot matches >array (
  'mess' => '',
  0 => '',
)<  

I do not understand

  1. why are the messages empty
  2. why the driver is NullDriver

Help me understand what the problem is, any ideas will be useful

Lingua principale
PHP
Stelle
332
Fork
91
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di botman/studio

Tutte le issue di botman/studio

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.