glidej / emoji-club

A slack bot that announces which custom emojis have been added to your org each day.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consolidate alias/original emojis into a single digest line

glidej opened this issue · comments

Screen Shot 2019-09-17 at 12 23 37 PM

This latest crop of emojis revealed that aliases come through as separate emojis (see yes-no-blob, choose-blob above. They come through as duplicates in the list. That's not ideal!

Thankfully, the slack response gives us some metadata about whether an emoji is an alias.

"yes-no-blob": "https:\/\/emoji.slack-edge.com\/T0253TWF5\/yes-no-blob\/915cd22c2619687d.png",
"choose-blob": "alias:yes-no-blob",
"choice-blob": "alias:yes-no-blob",
"decide-blob": "alias:yes-no-blob",

In this particular case, the original emoji was added at the same time as the aliases, so it's obvious we should consolidate this into a single digest row:

:yes-no-blob: — :yes-no-blob:, :choose-blob:, ...

If someone simply adds an alias to a long-existing emoji, though, we should probably note that somehow.

:yes-no-blob: — :choose-blob: alias created for :yes-no-blob:

Implementation Notes
This is going to require a refactor in a couple spots.

  1. We're not storing the URL of the emoji or whether it's an alias. We're just storing the emoji keys right now. Parsing this list isn't wildly expensive, so maybe we should just store the whole response so we can parse it each time we generate a digest. We'll have to figure out how to deal with the transition from key-only data to full response storage (How do we deal with knowing :choose-blob: is an alias today, but we didn't know that yesterday?)
  2. Our response parsing is really simple right now; just figure out what wasn't in the response yesterday compared to today. We're going to have to get a little more sophisticated to support consolidation and noting aliases additions.