Skip to content

Bot loses connection to Slack #30

@gugglegum

Description

@gugglegum

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";
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions