-
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.
- Loading branch information
Showing
12 changed files
with
98 additions
and
144 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module WhoIsOnDutyTodaySlackBotModule | ||
module Commands | ||
class ChannelAutoAnswer < SlackRubyBot::Commands::Base | ||
DESCRIPTION = 'Bot will answer on any message in channel at working time'.freeze | ||
EXAMPLE = 'channel auto_answer_enabled=<boolean> example `channel auto_answer_enabled=true`'.freeze | ||
|
||
def self.call(client:, data:, match:) | ||
value = match['expression'].split('=').last.strip | ||
|
||
unless %w[true false].include?(value) | ||
client.say( | ||
channel: data.channel, | ||
text: "Invalid value for auto-answer. Please use 'true' or 'false'.", | ||
thread_ts: data.thread_ts || data.ts | ||
) | ||
return | ||
end | ||
|
||
channel = Channel.find_or_initialize_by(slack_channel_id: data.channel) | ||
channel.update(auto_answer_enabled: value) | ||
channel.save | ||
|
||
client.say( | ||
channel: data.channel, | ||
text: "Channel auto-answer has been set to '#{value}'.", | ||
thread_ts: data.thread_ts || data.ts | ||
) | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
module WhoIsOnDutyTodaySlackBotModule | ||
module Commands | ||
class ChannelReminder < SlackRubyBot::Commands::Base | ||
DESCRIPTION = 'Enable or disable channel reminders.'.freeze | ||
EXAMPLE = 'example `channel reminder=true` or `channel reminder=false`'.freeze | ||
|
||
def self.call(client:, data:, match:) | ||
value = match['expression'].split('=').last.strip | ||
|
||
unless %w[true false].include?(value) | ||
client.say(channel: data.channel, text: "Invalid value for reminder. Please use 'true' or 'false'.") | ||
return | ||
end | ||
|
||
channel = Channel.find_or_initialize_by(slack_channel_id: data.channel) | ||
channel.update(reminder_enabled: value) | ||
channel.save | ||
|
||
client.say( | ||
channel: data.channel, | ||
text: "Channel reminder has been set to '#{value}'.", | ||
thread_ts: data.thread_ts || data.ts | ||
) | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
module WhoIsOnDutyTodaySlackBotModule | ||
module Commands | ||
class ChannelTagReporterInThread < SlackRubyBot::Commands::Base | ||
|
||
DESCRIPTION = 'Enable or disable tagging the reporter in the thread.'.freeze | ||
EXAMPLE = 'example `channel tag_reporter_enabled=true` or `channel tag_reporter_enabled=false`'.freeze | ||
|
||
def self.call(client:, data:, match:) | ||
value = match['expression'].split('=').last.strip | ||
|
||
unless %w[true false].include?(value) | ||
client.say(channel: data.channel, text: "Invalid value for tagging the reporter. Please use 'true' or 'false'.") | ||
return | ||
end | ||
|
||
channel = Channel.find_or_initialize_by(slack_channel_id: data.channel) | ||
channel.update(tag_reporter_enabled: value) | ||
channel.save | ||
|
||
client.say( | ||
channel: data.channel, | ||
text: "Tagging the reporter in the thread has been set to '#{value}'.", | ||
thread_ts: data.thread_ts || data.ts | ||
) | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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