Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump custom emojis #44

Closed
craigrandall opened this issue Mar 22, 2022 · 8 comments
Closed

Dump custom emojis #44

craigrandall opened this issue Mar 22, 2022 · 8 comments
Labels
enhancement New feature or request
Milestone

Comments

@craigrandall
Copy link

Since custom emojis are an important aspect of Slack instance culture/comms, perhaps it makes sense for SlackDump to also dump custom emojis (e.g. via a new flag/arg/param to slackdump).

https://github.com/jason0x43/alfred-slack/blob/master/emoji.go provides one examples of leveraging the appropriate Slack API: https://api.slack.com/methods/emoji.list.

Thank you for considering!

@rusq rusq added the enhancement New feature or request label Mar 25, 2022
@rusq rusq modified the milestones: v1.4.0, v1.4.1 Apr 2, 2022
@rusq
Copy link
Owner

rusq commented Aug 17, 2022

@craigrandall sorry, it's taking me obscene long time to get to this.

Let me ask - do you see it as a separate mode, i.e. slackdump -emoji and it would dump the json definiton of those emojis along with png/gif files for them?

@craigrandall
Copy link
Author

No worries! This is open source after all. I appreciate all of your hard work--as you can get to it. Thank you!

Yes, I did see it more as a separate mode since it is somewhat orthogonal to channel content--similar to a user list. In terms of output, yes, that is roughly what I envisioned, where GIF would include animated support, if applicable.

Thanks for asking

@mootari
Copy link

mootari commented Aug 30, 2022

Just in case it's helpful in any way (e.g. for testing purposes), here's a JavaScript snippet that I've been using to fetch the list of custom emojis on the client side, via dev tools:

await (async (teamId) => {
  const {token} = JSON.parse(localStorage.localConfig_v2).teams[teamId];
  const query = (marker) =>
    fetch(`https://edgeapi.slack.com/cache/${teamId}/emojis/list`, {
      body: JSON.stringify({ count: 100, token, marker }),
      method: "POST",
      credentials: "include"
    }).then((r) => r.json());
  const results = [];
  let marker;
  do {
    const data = await query(marker);
    results.push(...data.results.map((d) => [d.name, d.value]));
    marker = data.next_marker;
  } while (marker);
  return Object.fromEntries(results);
})('THE_TEAM_ID')

Note that the results may not only contain image URLs but also aliases.

@rusq
Copy link
Owner

rusq commented Aug 30, 2022

Edge api are dodgy to deal with as there's no documentation, I'll put this snippet to a good use, thank you!

rusq added a commit that referenced this issue Sep 23, 2022
@rusq
Copy link
Owner

rusq commented Sep 23, 2022

@craigrandall finally! Merged the emoji dump to master, it will be available in the v2.2.0, which I release soon. Thank you for the wait :)

Need to document it, and add to the UI, for now it can be invoked like this:

./slackdump -emoji -base my_emojis.zip

-base my_emoji.zip sets the output to my_emoji.zip. It can also be a directory, i.e. -base some_dir
-emoji sets the emoji download mode.

You can let me know your OS, and I can build a binary for you, if you wish to try it out before it's released?

@craigrandall
Copy link
Author

craigrandall commented Sep 24, 2022 via email

rusq added a commit that referenced this issue Sep 28, 2022
@rusq
Copy link
Owner

rusq commented Oct 8, 2022

Hey @craigrandall, version 2.2.0 has the -emoji flag built in that allows to download the emojis, see this documentation section.

Thank you for your patience!

@rusq rusq closed this as completed Oct 8, 2022
@craigrandall
Copy link
Author

craigrandall commented Oct 8, 2022 via email

rusq added a commit that referenced this issue Oct 9, 2022
#44: fix the different folder name for channels and attachments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants