Skip to content

Commit a9e782e

Browse files
committed
Move typesAndWaits() into DriverInterface
1 parent 6f53e7f commit a9e782e

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/BotMan.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -618,14 +618,7 @@ public function types()
618618
*/
619619
public function typesAndWaits(float $seconds)
620620
{
621-
$driver = $this->getDriver();
622-
623-
if (method_exists($driver, 'typesAndWaits')) {
624-
$this->getDriver()->typesAndWaits($this->message, $seconds);
625-
} else {
626-
$this->types();
627-
usleep($seconds * 1000000);
628-
}
621+
$this->getDriver()->typesAndWaits($this->message, $seconds);
629622

630623
return $this;
631624
}

src/Interfaces/DriverInterface.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ public function hasMatchingEvent();
7474
*/
7575
public function types(IncomingMessage $matchingMessage);
7676

77+
/**
78+
* Send a typing indicator and wait for the given amount of seconds.
79+
* @param IncomingMessage $matchingMessage
80+
* @param int $seconds
81+
* @param float $seconds
82+
* @return mixed
83+
*/
84+
public function typesAndWaits(IncomingMessage $matchingMessage, float $seconds);
85+
7786
/**
7887
* Tells if the stored conversation callbacks are serialized.
7988
*

0 commit comments

Comments
 (0)