Skip to content

Commit

Permalink
Fix #632 Change the default settings to "useRtmConnect: true"
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Nov 24, 2021
1 parent 688682a commit 1caa12c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions slack.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,18 @@ exports.use = (robot) ->
# reacts to only messages by insalled workspace users in a shared channel
installedTeamOnly: process.env.INSTALLED_TEAM_ONLY?
try
options.rtm = JSON.parse(process.env.HUBOT_SLACK_RTM_CLIENT_OPTS)
catch
options.rtm = JSON.parse(process.env.HUBOT_SLACK_RTM_CLIENT_OPTS or '{}')
unless options.rtm.useRtmConnect?
# The original way to connect to one of our oldest APIs is finally retiring.
# For existing apps, rtm.start will start behaving exactly like rtm.connect
# on September 20, 2022. Beginning November 30, 2021, newly created apps and integrations
# will only be able to use rtm.connect.
# https://api.slack.com/changelog/2021-10-rtm-start-to-stop
options.rtm.useRtmConnect = true
catch e
console.error(e)
try
options.rtmStart = JSON.parse(process.env.HUBOT_SLACK_RTM_START_OPTS)
catch
options.rtmStart = JSON.parse(process.env.HUBOT_SLACK_RTM_START_OPTS or '{}')
catch e
console.error(e)
new SlackBot robot, options

0 comments on commit 1caa12c

Please sign in to comment.