Skip to content

Commit

Permalink
Fix #632 Change the default settings to "useRtmConnect: true" (#633)
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch authored Dec 21, 2021
1 parent 1204249 commit 19f8449
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 19f8449

Please sign in to comment.