Conditions | 2 |
Total Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | function run(\CharlotteDunois\Livia\Commands\Context $context, \ArrayObject $args, bool $fromPattern) { |
||
28 | return $context->say('Pinging...')->then(function ($msg) use ($context) { |
||
29 | $time = \CharlotteDunois\Yasmin\Utils\Snowflake::deconstruct($msg->id)->timestamp - \CharlotteDunois\Yasmin\Utils\Snowflake::deconstruct($context->message->id)->timestamp; |
||
30 | |||
31 | $ping = $this->client->getPing(); |
||
32 | if(!\is_int($ping)) { |
||
33 | $ping = 0; |
||
34 | } |
||
35 | |||
36 | return $msg->edit($context->message->author.' Pong! The message round-trip took '.\ceil(($time * 1000)).'ms. The WS heartbeat is '.$ping.'ms.'); |
||
37 | }); |
||
41 |