Class: EnerbotSlack
- Inherits:
-
Credentials
- Object
- Credentials
- EnerbotSlack
- Includes:
- SlackFormat, SlackImage, SlackMessage, SlackRealTime, SlackSearch
- Defined in:
- lib/enerbot-slack.rb
Overview
Groups client initialization with instance parameters
Instance Method Summary collapse
-
#initialize(name: '', image: '', token: nil, as_user: false) ⇒ EnerbotSlack
constructor
A new instance of EnerbotSlack.
Methods included from SlackSearch
#conversation_info, #conversation_list, #conversation_members, #conversation_type, #get_user_id, #get_user_info, #get_user_list, #search_messages_on, #verify_type
Methods included from SlackClient
Methods included from SlackFormat
#attachment_style, #channel_pattern, #coin_pattern, #hyper_text_pattern
Methods included from SlackImage
#event_look_revert, #event_look_set, #imitate_look
Methods included from SlackMessage
#add_reaction, #destination_points, #send_attachment, #send_command, #send_direct_message, #send_ephemeral, #send_file, #send_message
Methods included from SlackRealTime
#share_message, #single_client
Methods included from SlackConsole
Methods inherited from Credentials
Constructor Details
#initialize(name: '', image: '', token: nil, as_user: false) ⇒ EnerbotSlack
Returns a new instance of EnerbotSlack.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/enerbot-slack.rb', line 17 def initialize(name: '', image: '', token: nil, as_user: false) set_defaults 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 |