This repository has been archived by the owner on Aug 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Try to fix invite in a non-breaking way since d.js constants changed * Fix lint? * Update package.json
- Loading branch information
1 parent
6c6cda0
commit b04228e
Showing
2 changed files
with
3 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,3 @@ | ||
const permFlags = require("discord.js/src/util/Constants.js").PermissionFlags; | ||
const { Permissions } = require("discord.js"); | ||
|
||
module.exports = (client) => { | ||
const genObject = {}; | ||
|
||
for (const key in permFlags) { | ||
genObject[key] = false; | ||
} | ||
|
||
genObject.READ_MESSAGES = true; | ||
genObject.SEND_MESSAGES = true; | ||
|
||
client.commands.forEach((command) => { | ||
if (command.conf.botPerms.length > 0) { | ||
command.conf.botPerms.forEach((val) => { | ||
if (genObject.hasOwnProperty(val)) genObject[val] = true; | ||
}); | ||
} | ||
}); | ||
|
||
let permNumber = 0; | ||
for (const key in genObject) { | ||
if (genObject[key] === true) { | ||
permNumber += permFlags[key]; | ||
} | ||
} | ||
return permNumber; | ||
}; | ||
module.exports = client => Permissions.resolve([...new Set(client.commands.reduce((a, b) => a.concat(b.conf.botPerms), ["READ_MESSAGES", "SEND_MESSAGES"]))]); |
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