Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

bot change status go away after several hours #445

Closed
ryzn0518 opened this issue Oct 14, 2016 · 3 comments
Closed

bot change status go away after several hours #445

ryzn0518 opened this issue Oct 14, 2016 · 3 comments

Comments

@ryzn0518
Copy link

ryzn0518 commented Oct 14, 2016

I have created a bot which works fine for only some hours, but, with no reason, after several hours the bot status is go away and I cannot interact with it. The bot is still running in the server, it didn't crash and I don't see any error log?

@peterswimm
Copy link
Contributor

same as #442

@garymoon
Copy link

@diaojunxian #261 might be helpful.

@inn0v8
Copy link

inn0v8 commented Dec 8, 2016

@diaojunxian

#532 might solve your problem.

Below might help you keep track of rtm disconnects and reconnect failurs which can cause the bot to stop responding.

console.log('\n\n*** '+moment().tz('America/Los_Angeles').format()+' ** The RTM api just closed');

try {
controller.findTeamById('<SLACK_TEAM_ID_HERE>', function(err, team) {
var alertBot = controller.spawn(team);
alertBot.api.chat.postMessage(
{
channel : '<SLACK_CHANNEL_ID_HERE>',
text: 'GUYS!!! I just got an RTM Close event trigger for this team --> '+bot.team_info.id+' '+bot.team_info.name+' .',
attachments: [],
}, function (err, response) {
});
});
} catch (err) {
console.log('\n\n*** '+moment().tz('America/Los_Angeles').format()+' Tried to send alert for an rtm_close event but failed with this error: '+err);
}
});

controller.on('rtm_reconnect_failed',function(bot) {
console.log('\n\n*** '+moment().tz('America/Los_Angeles').format()+' ** Unable to automatically reconnect to rtm after a closed conection.');

try {
controller.findTeamById('<SLACK_TEAM_ID_HERE>', function(err, team) {
var alertBot = controller.spawn(team);
alertBot.api.chat.postMessage(
{
channel : '<SLACK_CHANNEL_ID_HERE>',
text: 'GUYS!!! I just got an RTM Reconnect Failed trigger for this team --> '+bot.team_info.id+' name: '+bot.team_info.name+'. The team either uninstalled the app or there was an issue which requires a resart of the bot.',
attachments: [],
}, function (err, response) {
});
});
} catch (err) {
console.log('\n\n*** '+moment().tz('America/Los_Angeles').format()+' Tried to send alert for an rtm_reconnect_failed event but failed with this error: '+err);
}
});```

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants