You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The bot loses connection sometimes and does nothing with it. In slack chat (web-)application slackbot user just become with gray circle (offline). But the script continues to run, need to be killed and restarted. Isn't there a way to force the bot to check is connection alive and throw an exception if not?
The code (excepting code of commands and config):
<?php
require __DIR__ . '/vendor/autoload.php';
use PhpSlackBot\Bot;
use SlackBot\Commands\AlphaLockCommand;
use SlackBot\Commands\AlphaShipmentCommand;
use SlackBot\Commands\GetItemQtyCommand;
use SlackBot\Commands\StatusCommand;
$config = require __DIR__ . '/config.php';
$bot = new Bot();
$bot->setToken($config['slackbot']['token']);
try {
$bot->loadCommand(new StatusCommand());
$bot->loadCommand(new GetItemQtyCommand());
$bot->loadCommand(new AlphaLockCommand());
$bot->loadCommand(new AlphaShipmentCommand());
$bot->run();
} catch (\Exception $e) {
echo $e->getMessage(), "\n";
}
The text was updated successfully, but these errors were encountered:
Instead of throwing an exception, I think it would be better to check periodically (using a react loop timer) if the bot is still online and re-connect automatically.
To detect disconnections, we can use ping/pong messages specified in the Slack RTM protocol. https://api.slack.com/rtm Section "Ping and Pong"
I am busy at the moment so any help will be very welcome 😃
This is likely due to this change, maybe it was acting as a keepalive.
RTM API Presence is now only available via subscription.
As of January 2018, presence_change events are not dispatched without presence subscriptions established with presence_sub. Relatedly, current user presence status is no longer communicated in rtm.start.
The bot loses connection sometimes and does nothing with it. In slack chat (web-)application slackbot user just become with gray circle (offline). But the script continues to run, need to be killed and restarted. Isn't there a way to force the bot to check is connection alive and throw an exception if not?
The code (excepting code of commands and config):
The text was updated successfully, but these errors were encountered: