1
0
Fork 0
Go to file
Lucidiot a6f7e2a9ce
Fix lxml requirement
2023-01-31 17:11:03 +01:00
.env.example Initial implementation of aiohttp export 2017-10-25 14:20:28 +10:00
.gitignore Let me have multiple dotenvs 2023-01-31 17:10:43 +01:00
LICENSE Initial commit 2015-02-22 09:07:37 -05:00
Pipfile Mark idna-ssl as a requirement (resolves #37) 2019-11-24 22:17:45 -06:00
Pipfile.lock Bump lxml from 4.6.2 to 4.6.3 2021-03-22 16:58:34 +00:00
README.md Fix pipenv run commands 2017-10-20 21:11:03 -04:00
export.py Add auto-retry on 429 when listing emojis for export 2022-07-20 10:18:35 +02:00
requirements.txt Fix lxml requirement 2023-01-31 17:11:03 +01:00
upload.py Do not crash on missing token 2022-07-20 10:30:47 +02:00

README.md

Slack Emojinator

Bulk upload emoji into Slack

Want to create a custom Slack emoji for every pokemon? Slack doesn't currently expose an API endpoint for creating emoji, probably to prevent users from doing exactly what I'm doing, but here's a way to do it anyway.

Creating Emoji

You'll need Python and pip to get started. I recommend using pipenv.

Prepare a directory that contains an image for each emoji you want to create. Remember to respect Slack's specifications for valid emoji images: no greater than 128px in width or height, no greater than 64K in image size. The base filename of each image file should be the name of the emoji (the bit you'll type inside : to display it).

Clone the project and install its prereqs:

libxml is required on your system, if you'd like to use the bulk export script.

git clone https://github.com/smashwilson/slack-emojinator.git
cd slack-emojinator
pipenv install

You'll need to provide your team name (the bit before ".slack.com" in your admin URL) and your session cookie (grab it from your browser). Copy .env.example, fill them in, and source it.

To grab your Slack session cookie:

  • Open your browser's dev tools and copy the value of document.cookie.
  • Go to the Network tab.
  • Re-load your workspace's https://{teamname}.slack.com/customize/emoji page.
  • Find the call to emoji (it is most likely the very top request).
  • Scroll to Request-Headers, copy the value of "Cookie," and add to your .env file.
cp .env.example .env
${EDITOR} .env
source .env

Now you're ready to go. Use a shell glob to invoke upload.py with the emoji files as ARGV:

pipenv run python upload.py ${EMOJI_DIR}/*.png

Exporting Emoji

To export emoji, use export.py and specify an emoji directory:

source .env
pipenv run python export.py path-to-destination/