jackellenberger / emojme

:rotating_light: very powerful very stupid Slack emoji tools, holy cow! :rotating_light:

Home Page:https://jackellenberger.github.io/emojme

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't upload if no emojis already on slack

benswinburne opened this issue · comments

If there are no custom emojis in the slack team, then uploading the first one using emojme fails because the following error is thrown from the admin list.

if (!firstPageBody.emoji || firstPageBody.emoji.length === 0) {
  throw new Error('Slack is not returning any emoji');
}

Iiiiiiiinteresting! I can fix that up, never thought i'd see a slack instance without custom emoji, but that shows what kinda bubble i live in.

I test drove a script on my work Slack which has no custom emoji 😢

@benswinburne Sorry for the delay, could you clone this branch and give it a try: https://github.com/jackellenberger/emojme/tree/allow-0-emoji-responses

I think that's all the change we need, the requirement of having emoji in a response is a self imposed one so we should be able to just remove it. Let me know if you need help setting that branch up in your project.

Apologies I haven't had chance to test this yet as I'd need to create a new slack team or delete the emojis from one. There's presumably no delete API for emojis on slack given it doesn't appear to be an option here?

Anyway, as you've merged I'm sure you've tested this now? I can still give it a punt at the weekend if that'd be helpful.

There is a delete API for emoji! however, each user only has permission to delete their own emoji. I've got plans for a tinder-but-for-emoji project, but it's not ready for prime time yet.

I was able to test via stubbing, but i did not create a new slack instance so my assumptions about what an empty adminList looks like may be wrong. If so I'll just reopen this.