Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sha1() expects parameter 1 to be string, array given #39

Open
arthurkirkosa opened this issue Jul 30, 2018 · 0 comments
Open

sha1() expects parameter 1 to be string, array given #39

arthurkirkosa opened this issue Jul 30, 2018 · 0 comments

Comments

@arthurkirkosa
Copy link

arthurkirkosa commented Jul 30, 2018

[2018-07-30 14:07:08] local.ERROR: sha1() expects parameter 1 to be string, array given {"exception":"[object] (ErrorException(code: 0): sha1() expects parameter 1 to be string, array given at /var/www/example.com/vendor/botman/botman/src/Messages/Incoming/IncomingMessage.php:88)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'sha1() expects ...', '/var/www/growth...', 88, Array)
#1 /var/www/example.com/vendor/botman/botman/src/Messages/Incoming/IncomingMessage.php(88): sha1(Array)
#2 /var/www/example.com/vendor/botman/botman/src/Traits/HandlesConversations.php(173): BotMan\\BotMan\\Messages\\Incoming\\IncomingMessage->getConversationIdentifier()
#3 [internal function]: BotMan\\BotMan\\BotMan->BotMan\\BotMan\\Traits\\{closure}(Object(BotMan\\BotMan\\Messages\\Incoming\\IncomingMessage), 0)
#4 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Support/Arr.php(606): array_filter(Array, Object(Closure), 1)
#5 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Support/Collection.php(471): Illuminate\\Support\\Arr::where(Array, Object(Closure))
#6 /var/www/example.com/vendor/botman/botman/src/Traits/HandlesConversations.php(174): Illuminate\\Support\\Collection->filter(Object(Closure))
#7 /var/www/example.com/vendor/botman/botman/src/BotMan.php(396): BotMan\\BotMan\\BotMan->loadActiveConversation()
#8 /var/www/example.com/app/Http/Controllers/BotmanController.php(19): BotMan\\BotMan\\BotMan->listen()
#9 [internal function]: App\\Http\\Controllers\\BotManController->handle()
// routes/botman.php

<?php

use App\Http\Controllers\BotManController;

$botman = app('botman');

$botman->on('team_join', BotManController::class.'@slackTeamJoin');
// BotMatContrller

<?php

namespace App\Http\Controllers;

use BotMan\BotMan\BotMan;
use App\Conversations\SlackTeamJoin;

class BotManController extends Controller
{
    /**
     * Place your BotMan logic here.
     */
    public function handle()
    {
        $botman = app('botman');

        logger()->info(request()->all());

        $botman->listen();
    }

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function tinker()
    {
        return view('pages.tinker');
    }

    /**
     * Loaded through routes/botman.php
     *
     * @param  BotMan $bot
     */
    public function slackTeamJoin(BotMan $bot)
    {
        $text = file_get_contents(base_path('core/instructions.md'));

        $bot->replay($text);
    }
}
// logger->info

[2018-07-30 14:07:07] local.INFO: array (
  'token' => 'YdQetlQAzAJJyqNN3RyaKl93',
  'team_id' => 'TBSG4AS8J',
  'api_app_id' => 'ABTRKKFQW',
  'event' =>
  array (
    'type' => 'team_join',
    'user' =>
    array (
      'id' => 'UBZDVG805',
      'team_id' => 'TBSG4AS8J',
      'name' => 'name862',
      'deleted' => false,
      'color' => 'e7392d',
      'real_name' => 'Gigi Lanseta',
      'tz' => 'Europe/Athens',
      'tz_label' => 'Eastern European Summer Time',
      'tz_offset' => 10800,
      'profile' =>
      array (
        'title' => NULL,
        'phone' => NULL,
        'skype' => NULL,
        'real_name' => 'Gigi Lanseta',
        'real_name_normalized' => 'Gigi Lanseta',
        'display_name' => 'gigi',
        'display_name_normalized' => 'gigi',
        'fields' => NULL,
        'status_text' => NULL,
        'status_emoji' => NULL,
        'status_expiration' => 0,
        'avatar_hash' => 'g58edf7ee5c4',
        'image_24' => 'https://secure.gravatar.com/avatar/58edf7ee5c45c7fa9d33d0ceb50ce45d.jpg?s=24&d=https%3A%2F%2Fa.slack-edge.com%2F0180%2Fimg%2Favatars%2Fava_0017-24.png',
        'image_32' => 'https://secure.gravatar.com/avatar/58edf7ee5c45c7fa9d33d0ceb50ce45d.jpg?s=32&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0017-32.png',
        'image_48' => 'https://secure.gravatar.com/avatar/58edf7ee5c45c7fa9d33d0ceb50ce45d.jpg?s=48&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0017-48.png',
        'image_72' => 'https://secure.gravatar.com/avatar/58edf7ee5c45c7fa9d33d0ceb50ce45d.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2F66f9%2Fimg%2Favatars%2Fava_0017-72.png',
        'image_192' => 'https://secure.gravatar.com/avatar/58edf7ee5c45c7fa9d33d0ceb50ce45d.jpg?s=192&d=https%3A%2F%2Fa.slack-edge.com%2F7fa9%2Fimg%2Favatars%2Fava_0017-192.png',
        'image_512' => 'https://secure.gravatar.com/avatar/58edf7ee5c45c7fa9d33d0ceb50ce45d.jpg?s=512&d=https%3A%2F%2Fa.slack-edge.com%2F7fa9%2Fimg%2Favatars%2Fava_0017-512.png',
        'status_text_canonical' => NULL,
        'team' => 'TBSG4AS8J',
      ),
      'is_admin' => false,
      'is_owner' => false,
      'is_primary_owner' => false,
      'is_restricted' => false,
      'is_ultra_restricted' => false,
      'is_bot' => false,
      'is_app_user' => false,
      'updated' => 1532959260,
      'presence' => 'away',
    ),
    'cache_ts' => 1532959260,
    'event_ts' => '1532959260.000107',
  ),
  'type' => 'event_callback',
  'event_id' => 'EvC0K57FN2',
  'event_time' => 1532959260,
  'authed_users' =>
  array (
    0 => 'UBRSHE0M6',
    1 => 'UBSG4ASR0',
  ),
)

What I'm trying to achieve is when a new member joins the team, have the bot send him the contents of that md file (multi line text)

What am I doing wrong?

The bot is listening to the demo sample code (Hello, Hi)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant