Skip to content

Instantly share code, notes, and snippets.

@dblock
Created June 20, 2016 13:57
Show Gist options
  • Save dblock/b01e39b395651c5525c84fe88ac00666 to your computer and use it in GitHub Desktop.
Save dblock/b01e39b395651c5525c84fe88ac00666 to your computer and use it in GitHub Desktop.
Team.active.asc(:_id).each do |team|
begin
next if team.premium
STDOUT.write "#{team.name}: "
client = Slack::Web::Client.new(token: team.token)
channels = client.channels_list['channels'].select { |channel| channel['is_member'] }
channels.each do |channel|
STDOUT.write "#{channel['name']} "
client.chat_postMessage(
channel: channel.id,
as_user: true,
text: "With 300+ active teams, PlayPlay.io can no longer operate entirely for free and is going freemium for some features, including seasons and turning GIFs off. #{team.upgrade_text} We appreciate your support!"
)
end
STDOUT.write "\n"
rescue Exception => e
puts "#{team.id} ERROR: #{e.message}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment