mirror of
https://github.com/System-End/identity-vault.git
synced 2026-04-19 19:45:08 +00:00
channeling
This commit is contained in:
parent
14849fb675
commit
f4ea2b2d69
3 changed files with 36 additions and 1 deletions
|
|
@ -17,6 +17,6 @@ module OnboardingScenarios
|
|||
|
||||
def slack_channels = Rails.configuration.slack_channels.slice(:waiting_room).values
|
||||
|
||||
def promotion_channels = Rails.configuration.slack_channels.slice(:announcements, :welcome, :ship, :neighbourhood, :library, :lounge).values
|
||||
def promotion_channels = Rails.configuration.slack_channels.slice(:announcements, :happenings, :community, :hardware, :code, :ship, :neighbourhood, :library, :lounge).values
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
production:
|
||||
announcements: C0266FRGT
|
||||
happenings: C05B6DBN802
|
||||
community: C01D7AHKMPF
|
||||
ysws: C0710J7F4U9
|
||||
hardware: C6C026NHJ
|
||||
code: C0EA9S0A0
|
||||
library: C078Q8PBD4G
|
||||
ship: C0M8PUPU6
|
||||
welcome: C75M7C0SY
|
||||
|
|
|
|||
30
lib/tasks/slack.rake
Normal file
30
lib/tasks/slack.rake
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
namespace :slack do
|
||||
desc "Join all channels defined in config/slack_channels.yml"
|
||||
task join_channels: :environment do
|
||||
config = YAML.load_file(Rails.root.join("config/slack_channels.yml"))
|
||||
client = SlackService.client
|
||||
joined_ids = Set.new
|
||||
|
||||
config.each do |env, channels|
|
||||
puts "\n=== #{env} ==="
|
||||
channels.each do |name, channel_id|
|
||||
next if joined_ids.include?(channel_id)
|
||||
|
||||
joined_ids << channel_id
|
||||
print "Joining ##{name} (#{channel_id})... "
|
||||
client.conversations_join(channel: channel_id)
|
||||
puts "✓"
|
||||
rescue Slack::Web::Api::Errors::MethodNotSupportedForChannelType
|
||||
puts "skipped (DM or unsupported type)"
|
||||
rescue Slack::Web::Api::Errors::ChannelNotFound
|
||||
puts "not found"
|
||||
rescue Slack::Web::Api::Errors::SlackError => e
|
||||
puts "failed: #{e.message}"
|
||||
end
|
||||
end
|
||||
|
||||
puts "\nDone!"
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue