jackellenberger / emojme Goto Github PK
View Code? Open in Web Editor NEW:rotating_light: very powerful very stupid Slack emoji tools, holy cow! :rotating_light:
Home Page: https://jackellenberger.github.io/emojme
:rotating_light: very powerful very stupid Slack emoji tools, holy cow! :rotating_light:
Home Page: https://jackellenberger.github.io/emojme
Looks like you have support for these, but I didn't see any hints on using that feature in your docs.
BTW, thanks for the slick tool!
When rate limiting is detected we output message: Endpoint $endpoint rate limited. Will retry request $request after $time backoff
, which is nice! But,
suggested time * concurrent requests
to account for the fact that slack is gonna punish us for having multiple concurrent requests hitting at the same timeSlack has started rolling out emoji creation timestamps in their adminlist endpoint. We can use that for fun and profit!
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.
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."
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:
This is more a documentation and testing problem than a code problem, but it's a requested feature none the less.
Right now progress is shown through stdout logging, which is a very bad experience for module users.
.
for success, x
for failureSeeing 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.```
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.
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
It's very unclear what you get when you call emojme.add()
. I should document that junk.
probably!
From the API newsletter:
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.
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
it takes me like 5 whole minutes to type out --src-subdomain --src-token --dst-subdomain --dst-token, why not just --src domain:token --dst domain:token I mean cmon
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.
when uploading an emojilist, new emoji have the prefix applied, but alias referring to new emoji break because there are no emoji named emoji
, it's named prefix-emoji
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?
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.```
It would be really nice if I could just upload all emoji in a directory without having to build a list in advance.
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?
I will do this once integration testing (#14) is complete.
Many emoji packs seem to support YAML files only. It appears that this tool only works with JSON data. Is uploading with YAML supported somehow? Ex: https://github.com/jmhobbs/cultofthepartyparrot.com
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 👌
I'm trying to use emojme.add
but I keep hitting the error on this line: https://github.com/jackellenberger/emojme/blob/master/lib/emoji-admin-list.js#L55
The error given is not_allowed_token_type
but I'm definitely using a user token - I regenerated one and it's working to make requests for emoji.list
Do we really need to get adminList
? Do I have to be an admin to use this tool?
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.
/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?
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.
As @mootari suggests i / we should think about using a solution like @rusq's https://github.com/rusq/slackdump/blob/master/doc/login-auto.rst to capture tokens and cookies rather than requiring a chrome extension or browser fiddling. I hate headless browsers but it seems like a way better UX.
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');
}
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.
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 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.
And we do not handle it well.
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_
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"
Have the ability to onFire(emoji)
or to dealWithIt(emoji)
!
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.