driver-slack icon indicating copy to clipboard operation
driver-slack copied to clipboard

Two Problems: Instructions on originating messages not working, and resulting issues with Drivers.

Open leenooks opened this issue 7 years ago • 3 comments

Hi, I'm trying to originate a message to slack - so I started with using the example here https://botman.io/master/driver-slack

DriverManager::loadDriver(SlackDriver::class);

$o = SlackChannel::findOrFail($this->argument('id'));
$botman = BotManFactory::create([
   'slack' => [
       'token' => $o->slack->getBot()->token,
    ]
]);

(I have confirmed the token is correct.)

I"m getting an error: Symfony\Component\Debug\Exception\FatalThrowableError : Type error: Argument 1 passed to BotMan\Drivers\Slack\SlackRTMDriver::__construct() must be of the type array, object given,. Not sure why it was falling through to the RTM driver?

1st Problem: I've put some "dumps" in DriverManager::getMatchingDriver() and see that it first selects BotMan\Drivers\Slack\SlackDriver which appears to fail the tests if ($driver->matchesRequest() || $driver->hasMatchingEvent()) and then selects the BotMan\Drivers\Slack\SlackRTMDriver which causes the exception.

(BTW: I see it correctly connects to slack and gets the BotID and BotUserID.)

So what am I doing wrong here?

2nd Problem: The fact that the code falls through to the second driver BotMan\Drivers\Slack\SlackRTMDriver the call

new $driver($request, $this->config, $this->http);

is incorrect since SlackRTMDriver::_construct is

__construct(array $config, RealTimeClient $client)

leenooks avatar May 28 '18 02:05 leenooks

I just came across the exact same problem. @leenooks I wonder if it might be an API update on botman/botman that is not yet reflected on botman/driver-slack

Lobosque avatar Jun 14 '18 23:06 Lobosque

Issue still present

rakshazi avatar Jun 04 '19 09:06 rakshazi

issue still present

ismaelcanales avatar Jul 17 '20 08:07 ismaelcanales