Two Problems: Instructions on originating messages not working, and resulting issues with Drivers.
- Dominant language
- PHP
- Stars
- 51
- Forks
- 54
- PR merge metrics
- No merged PRs in 30d
Description
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)```
Contributor guide
Research direction
Start with DriverManager::getMatchingDriver() and compare the SlackDriver and SlackRTMDriver paths described in the report. Read SlackRTMDriver::__construct(array $config, RealTimeClient $client) alongside the call new $driver($request, $this->config, $this->http). Done means the originating-message flow selects the appropriate Slack driver without the reported type error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100