Skip to content

Commit

Permalink
debug crasher
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewpbrett committed Aug 20, 2018
1 parent 6dc03ec commit 5f98256
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/beebot.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ var handleMessage = (rtm, message) => {
// remove the @-mention of the bot from the message
var tokenized = message.text.split(/\s/)
tokenized = tokenized.filter((e) => {
return !e.match(new RegExp(regexpString))
return !e.match(new RegExp(regexpString))
})
text = tokenized.join(" ")
}
https.get("https://www.beeminder.com/slackbot?command="
+ encodeURIComponent(text) + "&team_id=" + message.team
+ encodeURIComponent(text) + "&team_id=" + message.team
+ "&user_id=" + message.user,
function(res) {
var resText = ''
Expand All @@ -55,7 +55,7 @@ var startBot = (teamId, rurl=null) => {
console.log(`DEBUG: teamId/obj/err = ${teamId} / ${obj} / ${err}`)
var RtmClient = require('@slack/client').RtmClient
var MemoryDataStore = require('@slack/client').MemoryDataStore
if (obj === null && rurl !== null) {
if (obj === null && rurl !== null) {
botils.blurt(rurl, "Sad panda. Can't create a bot to listen here. " +
`redis.hgetall("beebot.teamid.${teamId}") returned null ` +
"so we can't look up the bot access token for the Slack RTM client.")
Expand All @@ -80,7 +80,11 @@ var startBot = (teamId, rurl=null) => {
}
})

rtm.on('error', (bot) => { bot.disconnect() })
rtm.on('error', (error) => {
console.log(error)
console.log(typeof(error))
console.log("mysterycrashererror")
})

var CLIENT_EVENTS = require('@slack/client').CLIENT_EVENTS

Expand Down Expand Up @@ -157,9 +161,9 @@ var rtmForTeam = (teamId) => {
return bots.filter((b) => { return b.teamId === teamId })[0]
}

module.exports = {
module.exports = {
startBot: startBot,
handleCreateBot: handleCreateBot,
handleZeno: handleZeno,
rtmForTeam: rtmForTeam,
}
}

0 comments on commit 5f98256

Please sign in to comment.