With the latest changes to check for multiple permissions simultaneously, it bot crashes when someone with no API key executes !build:
var hasPerm = permission.every(p => (token.permissions.indexOf(p) > -1));
^
TypeError: Cannot read property 'permissions' of null
This PR fixes this issue and also adds an additional check in case db.checkKeyPermission is called with a zero-length permission array (should return true in that case). It also changes the waterfall sequence in builds a little bit, since this will notify the person without an API key with the proper message that the bot doesn't know him/her.
With the latest changes to check for multiple permissions simultaneously, it bot crashes when someone with no API key executes
!build
:This PR fixes this issue and also adds an additional check in case
db.checkKeyPermission
is called with a zero-length permission array (should return true in that case). It also changes the waterfall sequence in builds a little bit, since this will notify the person without an API key with the proper message that the bot doesn't know him/her.