Class: BaezSlack

Inherits:
Credentials show all
Includes:
MessageSlack, ReadSlack, RegexpSlack, SearchOnSlack
Defined in:
lib/baez_slack.rb

Overview

Groups client initialization with instance parameters

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

Methods included from RegexpSlack

#echo, #get_values_from

Methods included from ReadSlack

#share_message, #single_client

Methods included from ConsoleSlack

#format_new_message

Methods included from MessageSlack

#add_reaction, #attach_format, #discern_end, #send_attachment, #send_direct_message, #send_file, #send_message

Methods inherited from Credentials

#set_credentials

Constructor Details

#initialize(name = '', image = '', token = nil) ⇒ BaezSlack

Returns a new instance of BaezSlack.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/baez_slack.rb', line 15

def initialize(name = '', image = '', token = nil)
  set_credentials

  Slack.configure do |config|
    config.token = token.nil? ? @bot_token : token
    config.raise 'Missing token' unless config.token
  end

  @bot_name = name unless name.empty?
  @bot_icon = image unless image.empty?

  @time_client ||= Slack::RealTime::Client.new
  @web_client ||= Slack::Web::Client.new
end