Giter Club home page Giter Club logo

emojme's People

Contributors

allcentury avatar benswinburne avatar curtisgibby avatar fine-fiddle avatar jackellenberger avatar matthew-gerstman avatar max-winderbaum avatar mootari avatar n1c avatar narze avatar yhprum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

emojme's Issues

Rate limiting backoff messages inculde entire buffer data

When rate limiting is detected we output message: Endpoint $endpoint rate limited. Will retry request $request after $time backoff, which is nice! But,

  • rate limiting shouldn't happen if we come in under the limit, which we should be
    • i think we need to increase the rate limit time to be suggested time * concurrent requests to account for the fact that slack is gonna punish us for having multiple concurrent requests hitting at the same time
  • $endpoint is undefined
  • $time is in ms but it says "seconds"
  • $request contains the entire image buffer for the emoji being rate limited, so the output becomes unreadable.

Add --since option where applicable

Slack has started rolling out emoji creation timestamps in their adminlist endpoint. We can use that for fun and profit!

  • sync emoji created --since some time
  • download emoji created --since some time
  • emoji creation user-stats --since some time

Handling users with "/" in their username

I just tried using this for the first time but I can't actually run a user-stats because one of the users has "/" in their Slack user name which breaks since filenames cant contain "/". Building the .json for that user in ./build/ is impossible.

[Improvement] Allow bursting for rate limited requests

For operations like downloading the initial emojilist, if you have more than 50 pages of emoji (and we do), then the minimum download time is SLACK_REQUEST_WINDOW = 60000ms. That's kind of a nasty user experience, esp because slack does allow bursting. We could get our 53 pages in no time at all by just running emojme with the SLACK_REQUEST_RATE set to 60, but that will override other rate limited endpoints to use that rate, which may fail in a sync type scenario.

If we just build in bursting, mayyyybe that'd make the problem easier. the implementation I imagine is just "go as fast as possible until we get rate limited, then abide by the limit." shrug_intensifies

[Feature Request] Add support and documentation for using raw adminLists without hitting slack

Now that I have abdicated my throne at Braintree, my subjects are still passing me adminLists with the latest emoji, but I don't have access to the slack instance itself. Methods like sync should be able to take an adminlist instead of an authjson and just use that. A few things to note:

  1. isn't that just an emojme-upload? yes it is, but whatever. document it
  2. can't you already do it without auth if you poke the file to make it look fresh to emojme, then specify garb as the token and cookie? yes, but that ux does not spark joy.

This is more a documentation and testing problem than a code problem, but it's a requested feature none the less.

Add better logging and output control

Problem

Right now progress is shown through stdout logging, which is a very bad experience for module users.

Solution

  • restrict stdout logging to --verbose mode, perhaps on by default in cli mode
  • allow module users to provide their own logs for emojme to write to
  • make contents of logs more useful
    • -v => . for success, x for failure
    • -vv => `${emoji} ${action} ${success | failure}, etc

handle ENOTFOUND errors

Seeing a spate of this kind of error. emoji.slack-edge.com is a real domain that I really need to hit, so we should make sure we're hitting it.

(node:62676) UnhandledPromiseRejectionWarning: Error: getaddrinfo ENOTFOUND emoji.slack-edge.com emoji.slack-edge.com:443
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26)
(node:62676) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:62676) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```

Does download --save all work?

I have a feeling that --save all doesn't work how it's supposed to, meaning it's impossible to easily save all emoji from a subdomain. I should write a test to make sure all works, and make it work.

Use your splendid token/cookie instructions

Hey @jackellenberger , I'm astonished how easy you made it for the users to get the slack token/cookie with the extension.

I have a similar problem in Slackdump - i think it's might be complex for the unprepared person to do all this magic with going into the dev console, finding the token, and cookie, copy pasting, putting into a file.

Would you mind if I reference your extension and provide the instructions in the readme file for slackdump project?
Along the lines of:
"If you happen to have THIS EXTENSION, you can easily export your ... "

Cheers

Integration testing is incomplete

  • Module testing
    • emojme-add
    • emojme-upload
    • emojme-download
    • emojme-sync
    • emojme-user-stats
  • CLI Testing
    • emojme-add
    • emojme-upload
    • emojme-download
    • emojme-sync
    • emojme-user-stats

Use jsdoc

It's very unclear what you get when you call emojme.add(). I should document that junk.

Will TLS 1.2 break things?

probably!

From the API newsletter:

Deprecating support for TLS 1.0 & 1.1 by the end of 2019

In December 2019, Slack will stop supporting any connections made via TLS 1.0 & 1.1. Instead, we hope you’ll join the developer community in making safe & secure apps with TLS 1.2.
 

Add list user op to user-stats

I thought of a maybe useful op, emojme user-stats --list-users could return a list of users in the results, or maybe a list of users should always be included 🤷‍♀️ we'll see

Error: Slack request failed with error not_allowed_token_type

Hi, i used this before and it used to work perfectly. Somehow it is breaking now with the below error.
(node:18118) UnhandledPromiseRejectionWarning: Error: Slack request failed with error not_allowed_token_type
at EmojiAdminList.getAdminListPages (/home/vadiraj/slack/youappi/emojme/node_modules/emojme/lib/emoji-admin-list.js:60:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async EmojiAdminList.get (/home/vadiraj/slack/youappi/emojme/node_modules/emojme/lib/emoji-admin-list.js:47:26)
at async /home/vadiraj/slack/youappi/emojme/node_modules/emojme/emojme-download.js:72:23
at async Promise.all (index 0)
at async download (/home/vadiraj/slack/youappi/emojme/node_modules/emojme/emojme-download.js:82:36)
(node:18118) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:18118) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Please let us know what we need to do to fix this. Thanks for helping as usually.

Finding User Token

It seems like the guide over here is outdated: https://github.com/jackellenberger/emojme/tree/1.9.0#finding-a-slack-token

I can't seem to generate a working user token at all.

The Slack For Web section no longer works, it's only responding with "client" tokens (xoxc)

And the slack for Desktop isn't working for me either, I can't get the devTools to show up no matter how many ways or devices I've tested on

Any idea as to where else I could get a working user-token?

error invalid_auth

No matter what I try, I get
Error: Slack request failed with error invalid_auth

Full text:

(node:28632) UnhandledPromiseRejectionWarning: Error: Slack request failed with error invalid_auth
    at EmojiAdminList.getAdminListPages (/Users/tyleryoung/node_modules/emojme/lib/emoji-admin-list.js:59:13)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async EmojiAdminList.get (/Users/tyleryoung/node_modules/emojme/lib/emoji-admin-list.js:46:26)
    at async Promise.all (index 0)
    at async Promise.all (index 1)
    at async sync (/Users/tyleryoung/node_modules/emojme/emojme-sync.js:84:44)
(node:28632) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:28632) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```

Specify bin

You don't have a bin section in package.json so npm doesn't create CLI aliases anywhere. Given it's a CLI tool, that seems useful?

Current npm build broken

emojme.js requires many sibling files that are not there in the npm dist, they have been moved to lib.

I would have fixed this quickly but couldn't see how you were doing the release and moving stuff into lib so couldn't help. If you point me in the right direction I can amend this and submit a PR 👌

Use error logs to prevent further errors

on sync and upload we see a lot of error_name_taken_i18n. We don't expect to stop seeing those error messages, so we should collect those reserve-word-emoji and store a list of em and stop trying to reupload them.

  • add i18n_emoji.json
  • add logic to add to i18n_emoji.json automatically
  • remove emoji from upload queue that collide with i18n_emoji.json

Client.boot fixture out of date, causing a test failure

/spec/fixtures/clientBoot.json is a bit outdated - namely, the prefs object has been moved out of the self object and is now a key in the base object (this is what is causing the error right now). My own client.boot output seems to be 1168 lines compared to the 633 in the fixture, idk if you omitted anything though.

Solutions could be to just move the offending prefs object to it's rightful place, or to just grab the new client.boot (though it would be a bit time consuming to sanitize all my personal info out of it tbh). What do you think?

Upload --prefix doesn't properly update aliases

Problem

If you are uploading multiple emoji, and new emoji emoji-b is to be an alias of new emoji emoji-a, but you prefix the upload with pre-, emojme will upload pre-emoji-a, but attempt to add pre-emoji-b as an alias for emoji-a, which does not exist.

Can't upload if no emojis already on slack

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');
}

Success count on upload doesn't work?

Cached request is still fresh. To force a new request, delete or move ./build/$SUBDOMAIN.adminList.json
Found 16072 emoji
Attempting to upload 1 emoji to $SUBDOMAIN
.
requests: 0
successes: 0
errors: 0

That's wrong.

  • write a test
  • fix it

Instructions for grabbing token no longer work

It appears that Slack changed something on their side that prevents the current method for determining an API token from working.

The readme says:

It's easy! Open any signed in slack window, e.g. subdomain.slack.com/messages, right click anywhere > inspect element. Open the console and paste:

window.prompt("your api token is: ", window.boot_data.api_token)

As of now, the console throws an error:

TypeError: window.boot_data is undefined

Any other ways of finding the API token?

Errors are often improperly handled

errors like (node:6929) UnhandledPromiseRejectionWarning: Error: Slack request failed with error not_allowed_token_type are all over. We should handle those promise rejections more gracefully.

[Feature Request] specify a directory --src for `emojme add`

In the meantime, you can do:

# Given directory "directory" of emoji-able images
$ ls directory
...

# Craft a json describing the files
$ ls directory/ | jq -R 'reduce . as $i ({}; {"src": ("directory/" + $i), "name": ($i | sub(".gif"; "") | sub(".jpg"; "") | sub(".jpeg"; ""))})' | jq -s '.' > emoji.json

# Use your new emoji json
$ npx emojme upload -s $SUBDOMAIN -t $TOKEN --verbose --src emoji.json --prefix some_prefix_

Invalid inputs should be more understandable

This is terrible

$ emojme download
(node:99824) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'srcSubdomains' of undefined
    at validSrcDstPairs (/Users/jellenberger/jellenberger/emojme/lib/util/helpers.js:8:18)
    at atLeastOneValidInputType (/Users/jellenberger/jellenberger/emojme/lib/util/helpers.js:20:7)
    at Object.zipAuthPairs (/Users/jellenberger/jellenberger/emojme/lib/util/helpers.js:37:8)
    at download (/Users/jellenberger/jellenberger/emojme/emojme-download.js:13:31)
    at downloadCli (/Users/jellenberger/jellenberger/emojme/emojme-download.js:39:10)
    at Object.<anonymous> (/Users/jellenberger/jellenberger/emojme/emojme-download.js:48:3)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
(node:99824) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:99824) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

It should say "hey bro you need to give me some options you can't just say "download"

Upload only accepts single --src file

Problem

Examples like
./emojme.js upload -s SUBDOMAIN -t TOKEN --src emojiList1.json --src emojiList2.yaml --src emojiList 3.json
Should work, but don't. Only the first emojiList is updated, or maybe it errors out, I'm honestly not sure at this point. I should fix that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.