channeling

This commit is contained in:
24c02 2026-02-04 13:24:46 -05:00
parent 14849fb675
commit f4ea2b2d69
3 changed files with 36 additions and 1 deletions

View file

@ -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

View file

@ -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
View 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