Skip to content

Issue with Multiple Replies #3

@stefanzweifel

Description

@stefanzweifel

Hey there 👋,

I have an issue while sending multiple replies with the Hangouts driver: Only the first appears, the others are not visible in the chat.
My bot should send the different menus of the canteen into a room or DM. Code looks basically like this:

$botman->hears('menu', function ($bot) {

    $bot->reply('Looking for menues…');

    // Do some API calls to get the menues

    $todaysMenus = collect([
        ['title' => 'Menu 1: Food A'],
        ['title' => 'Menu 2: Food B'],
        ['title' => 'Menu 3: Food C']
    ]);

    $todaysMenus->each(function ($menu) use ($bot) {
        $bot->reply($menu['title']);
    });
});

The Web- and Telegram Driver correctly sends 4 replies:

Web Driver

image

Telegram Driver

image

The Hangouts driver however only shows the first reply 🤔:

image

I've hooked myself into the sendPayload method of Botman to see, what the Hangouts driver sends to Google, but in my eyes, everything looks fine 🤷‍♂️ :

[2018-08-11 12:57:03] local.INFO: array (
  'text' => 'Looking for menues 👀',
  'cards' => 
  array (
    0 => 
    array (
      'sections' => 
      array (
        0 => 
        array (
          'widgets' => 
          array (
          ),
        ),
      ),
    ),
  ),
)  
[2018-08-11 12:57:03] local.INFO: array (
  'text' => 'Menu 1: Food A',
  'cards' => 
  array (
    0 => 
    array (
      'sections' => 
      array (
        0 => 
        array (
          'widgets' => 
          array (
          ),
        ),
      ),
    ),
  ),
)  
[2018-08-11 12:57:03] local.INFO: array (
  'text' => 'Menu 2: Food B',
  'cards' => 
  array (
    0 => 
    array (
      'sections' => 
      array (
        0 => 
        array (
          'widgets' => 
          array (
          ),
        ),
      ),
    ),
  ),
)  
[2018-08-11 12:57:03] local.INFO: array (
  'text' => 'Menu 3: Food C',
  'cards' => 
  array (
    0 => 
    array (
      'sections' => 
      array (
        0 => 
        array (
          'widgets' => 
          array (
          ),
        ),
      ),
    ),
  ),
)  

I know that Hangouts Chat is not the sexiest Chat app but I would really appreciate it if anyone has some ideas, where Botman falls apart here.

If I should provide more code details or other information: I'm happy to provide everything.

Appendix

I could fix my bot by only ever reply once. (But it seems a bit hacky)

$botman->hears('menu', function ($bot) {

    // Do some API calls to get the menues

    $todaysMenus = collect([
        'Menu 1: Food A',
        'Menu 2: Food B',
        'Menu 3: Food C'
    ]);

    $bot->reply($todaysMenus->implode("\n"));
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions