This repository has been archived by the owner on May 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 147
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # package.json
@@ -47,17 +47,11 @@ describe('league of legends', () => { | |||
}); | |||
|
|||
describe('items', () => { | |||
it('should return items for ekko mid', done => { | |||
function sendMessage(channel, res) { | |||
it('should return an image buffer larger then 70000', function(done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
than*
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This is a pretty major PR that adds support for image responses instead of text in Discord, managing League of Legends data, adds League champs and items images, and scripts to keep league data updated. It also improves dev commands.
Fixes #90 and #25
Technical Details
Image responses are simple HTML pages (written in Jade and Stylus) where a PhantomJS client sitting in the background takes screenshots and returns the buffer as an image to Discord. The PhantomJS client runs on a queue only allowing one screenshot to be taken at a time. The image generation response time on Heroku is roughly 400ms.
Both Jade and Stylus have their own folders within the
web
folder, both with linters that have been added to the tests.The first feature that supports this new feature is the
!lol items
command, giving a simple image with the champions picture, name, position, and then all the items to go with it. The images are easier to resemble to then the names of items, making it easier for users. To keep the response time down, as well as prep incase Riot's CDN servers are ever slow/down, all the images are saved locally in the repo.The image responses themselves aren't tested exactly, but instead the size is checked to make sure the majority of the information is filled compared to it being a nearly blank screenshot.
The express endpoints that are used by the views are limited to localhost only, a 401 is returned for anything else.
In the
scripts
folder you'll find scripts that help manage keep data up to date, for example the league items and champs command. I'm against adding something like gulp as simple vanilla scripts get the jobs done.To add to that, all npm commands have been cleaned up and improved.
npm run dev
now gives debug information on both express and horseman (wrapper for PhantomJS). You'll also be able to access the Phantom web inspector on port9000
.NOTE: On OSX due to a bug in PhantomJS, rendering images can go up to 3000ms. Again, this only happens on OSX and won't on Windows and Linux.
Screenshots