-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create event to post welcome message
- Loading branch information
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require_relative 'events/welcome_message' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
SlackRubyBotServer::Events.configure do |config| | ||
config.on :event, ['event_callback', 'member_joined_channel'] do |event| | ||
|
||
name = SlackMethods.users_name(event[:event][:user]) | ||
user_id = SlackMethods.user_id(event[:event][:user]) | ||
|
||
channel_name = SlackMethods.channel_name(event[:event][:channel]) | ||
|
||
if channel_name.include? 'incident' | ||
incident_title = channel_name.split('_').drop(3).join('-') | ||
SlackMethods.post_a_message_to_user(channel_name, user_id, "Welcome #{name} to the incident channel. Please review the docs and join the <http://g.co/meet/#{incident_title}| discussion>.") | ||
end | ||
|
||
{ ok: true } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters