lib/ruboty/adapters/slack_rtm.rb in ruboty-slack_rtm-1.4.0 vs lib/ruboty/adapters/slack_rtm.rb in ruboty-slack_rtm-1.5.0
- old
+ new
@@ -8,10 +8,11 @@
module Adapters
class SlackRTM < Base
env :SLACK_TOKEN, "Account's token. get one on https://api.slack.com/web#basics"
env :SLACK_EXPOSE_CHANNEL_NAME, "if this set to 1, message.to will be channel name instead of id", optional: true
env :SLACK_IGNORE_GENERAL, "if this set to 1, bot ignores all messages on #general channel", optional: true
+ env :SLACK_GENERAL_NAME, "Set general channel name if your Slack changes general name", optional: true
def run
init
bind
connect
@@ -95,10 +96,10 @@
user = user_info(data['user']) || {}
channel = channel_info(data['channel'])
if channel
- return if channel['name'] == 'general' && ENV['SLACK_IGNORE_GENERAL'] == '1'
+ return if channel['name'] == (ENV['SLACK_GENERAL_NAME'] || 'general') && ENV['SLACK_IGNORE_GENERAL'] == '1'
channel_to = expose_channel_name? ? "##{channel['name']}" : channel['id']
else # direct message
channel_to = data['channel']
end