The Wayback Machine - https://web.archive.org/web/20201202075955/https://github.com/botman/botman/issues/1113
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

Allow for typesAndWaits with milliseconds #1113

Open
roelofr opened this issue Feb 22, 2020 · 2 comments
Open

Allow for typesAndWaits with milliseconds #1113

roelofr opened this issue Feb 22, 2020 · 2 comments

Comments

@roelofr
Copy link

@roelofr roelofr commented Feb 22, 2020

  • BotMan Version: 2.5.0
  • PHP Version: 7.4.2
  • Messaging Service(s): Telegram, Web
  • Cache Driver: Redis

Description:

I noticed the typesAndWaits uses the sleep method, but this only allows you to sleep whole seconds.

Wouldn't it be better to use usleep, so we can sleep for 2.5 seconds, or 0.5 seconds?

I noticed the code moved from the BotMan class to the drivers, but the change woud likely be comparable to this:

 class BotMan {
     // …
     /**
-     * @param int $seconds Number of seconds to wait
+     * @param float $seconds Number of seconds to wait
      * @return $this
      */
     public function typesAndWaits($seconds)
     {
         $this->getDriver()->types($this->message);
-        sleep($seconds);
+        usleep($seconds * 1000000);
 
         return $this;
     }
     // …
 }

Just a suggestion, let me know what you think.

@roelofr roelofr changed the title Allow for sleep in seconds Allow for sleep in milliseconds Feb 22, 2020
@roelofr roelofr changed the title Allow for sleep in milliseconds Allow for typesAndWaits with milliseconds Feb 22, 2020
@feralheart
Copy link
Contributor

@feralheart feralheart commented May 20, 2020

Hi @roelofr ,
Thank you for the request, it would be a nice addition for this project.

@diegorivas89
Copy link

@diegorivas89 diegorivas89 commented Jul 28, 2020

Hi @feralheart,
I was looking open issues to contribute, and I saw that this issue was resolved by this PR #765 Is that right?

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.