Module: ConsoleSlack

Includes:
SearchOnSlack
Included in:
ReadSlack
Defined in:
lib/modules/console_slack.rb

Overview

Module to read data from Slack and show it on console

Instance Method Summary collapse

Methods included from SearchOnSlack

#conversation_info, #conversation_list, #conversation_type, #get_user_id, #get_user_info, #get_user_list, #search_messages_on, #verify_type

Instance Method Details

#format_new_message(data) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/modules/console_slack.rb', line 8

def format_new_message(data)
  user_p = if data.subtype == 'bot_message'
             data.username
           else
             user = (data.user)
             user.real_name
           end
  text = data.text
  channel_p = conversation_info(data.channel)
  if @current_channel == channel_p.id
    print "\n#{user_p}: ".yellow + text.blue
  else
    print "\n--- #{channel_p.name} ---".green
    print "\n#{user_p}: ".yellow + text.blue
  end
  @current_channel = channel_p.id
end