Class: EnergonNotify
- Inherits:
-
Credentials
- Object
- Credentials
- EnergonNotify
- Includes:
- MessageDiscord, MessageSlack, SearchOnSlack
- Defined in:
- lib/energon-notify.rb
Overview
Slack Set Up
Instance Method Summary collapse
-
#initialize(name: '', image: '', slack_enabled: false, slack_token: nil, slack_as_user: false) ⇒ EnergonNotify
constructor
A new instance of EnergonNotify.
Methods included from MessageDiscord
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
Constructor Details
#initialize(name: '', image: '', slack_enabled: false, slack_token: nil, slack_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 28 |
# File 'lib/energon-notify.rb', line 13 def initialize(name: '', image: '', slack_enabled: false, slack_token: nil, slack_as_user: false) set_credentials if slack_enabled Slack.configure do |config| config.token = slack_token.nil? ? @bot_token : slack_token config.raise 'Missing token' unless config.token end @bot_name = name unless name.empty? @bot_icon = image unless image.empty? @bot_user = slack_as_user @time_client ||= Slack::RealTime::Client.new @web_client ||= Slack::Web::Client.new end end |