Skip to content

Instantly share code, notes, and snippets.

@daybreaker daybreaker/dlemoji.rb
Last active Jan 10, 2020

What would you like to do?
Download and Zip your slack emoji
# gem install slack-ruby-client rubyzip
# run with: ruby dlemoji.rb
require 'rubygems'
require 'zip'
require 'slack-ruby-client'
require 'open-uri'
token = 'your slack api token'
directory = '/<absolute/path/to>/emoji/' # The emoji directory must exist, and be empty.
zipfile_name = ''
# Download the image from slack's server and save locally
def download_image(url, dest, dir = '')
open(url) do |u| + dest, 'wb') { |f| f.write( }
Slack.configure do |config|
config.token = token
client =
client.emoji_list.emoji.each do |name, url|
next if url.include? 'alias:' # skip aliased emoji
download_image(url, name + '.' + url.split('.').last, directory)
end, Zip::File::CREATE) do |zipfile|
Dir[File.join(directory, '*')].each do |file|
zipfile.add(file.sub(directory, ''), file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.