A tool to upload all the pokemon to slack emoji.
Install Docker: https://docs.docker.com/engine/installation/
or
Install Package Locally
$ npm install slack-pokemon-emoji -g
team
Your team name.cookie
Slack does not have an api to upload emoji, so we have to emulate a browser environment to pass the cookie to our request. You can find the cookie from the Chrome devtools Networks tab, and it's under Header tab of any request.
Docker:
./run-docker.sh TEAM "COOKIE"
Local Install:
$ slack-pokemon-emoji TEAM "COOKIE"
# or
$ slack-pokemon-emoji -t TEAM -c "COOKIE"
# or
$ slack-pokemon-emoji team=TEAM cookie=COOKIE
Fetch pokemon images from http://www.pokemon.com/us/pokedex/
Do this in Chrome devtools and get all the pokemon indexs
/**
* Quick and dirty jQuery script to extract pokemon name and image url
*/
var pokemons = $($0).find('li').toArray().map(function(li) {
return {
imgSrc: $($(li).find('figure')[0]).find('img')[0].src,
name: $($(li).find('.pokemon-info')[0]).find('h5')[0].innerHTML
}
})
$ node index.js
Resize all the images and rename it to pokemonname.png
pokemons.forEach(function (pokemon) {
var readStream = hyperquest.get(pokemon.imgSrc)
gm(readStream)
.resize('128', '128')
.stream()
.pipe(fs.createWriteStream(`./images/${pokemon.name.toLowerCase()}.png`))
})
$ node uploader.js
gm
A nodejs wrapper for imageMagick, used for resizing imagehyperquest
A nodejs stream based http request utilscheerio
A nodejs module to parse html text on server sideform-data
A nodejs module to build form data and upload to slack
Slack does not provide a upload emoji api, and this tool is inspired by slack-emojinator.
Some of the code here use ES6 syntax so you might need nodejs 4.. to run the code.
MIT