Module: SlackRealTime

Includes:
DirectiveLookup, SlackConsole
Included in:
EnerbotSlack
Defined in:
lib/modules/slack_realtime.rb

Overview

Module for reading chat incoming messages

Instance Method Summary collapse

Methods included from SlackConsole

#format_new_message

Methods included from SlackSearch

#conversation_info, #conversation_list, #conversation_members, #conversation_permalink, #conversation_replies, #conversation_type, #get_user_id, #get_user_info, #get_user_list, #search_messages_on, #verify_type

Methods included from SlackClient

#configure_client

Instance Method Details

#share_message(data, output) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/modules/slack_realtime.rb', line 10

def share_message(data, output)
  case output
  when 'slack'
    check_type(data)
  when 'console'
    format_new_message(data)
  else
    format_new_message(data)
    check_type(data)
  end
end

#single_client(output = ENV['SLACK_DEFAULT_OUTPUT']) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/modules/slack_realtime.rb', line 22

def single_client(output = ENV['SLACK_DEFAULT_OUTPUT'])
  @time_client.on :hello do
    puts("Connected to '#{@time_client.team.name}' team at https://#{@time_client.team.domain}.slack.com.")
  end

  @time_client.on :message do |data|
    share_message(data, output)
  end
  @time_client.start!
end