Class: EnergonNotify

Inherits:
Credentials show all
Includes:
MessageDiscord, MessageSlack, SearchOnSlack
Defined in:
lib/energon_notify.rb

Overview

Slack Set Up

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 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, as_user: false) ⇒ EnergonNotify

Returns a new instance of EnergonNotify.



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

def initialize(name: '', image: '', token: nil, as_user: false)
  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?
  @bot_user = as_user

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