Module: SlackConsole

Includes:
SlackSearch
Included in:
SlackRealTime
Defined in:
lib/modules/slack_console.rb

Overview

Module to read data from Slack and show it on console

Instance Method Summary collapse

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

#format_new_message(data) ⇒ Object



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

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