Skip to content

Commit

Permalink
Adding roles
Browse files Browse the repository at this point in the history
  • Loading branch information
brunitob committed Dec 15, 2020
1 parent a1a6156 commit 4c24dd2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ const handlePublicMessage = async (message) => {
};

const botCommands = async (message) => {
if (message.member.permissions.has(Discord.Permissions.FLAGS.MANAGE_GUILD)) {
let allowedRole = message.guild.roles.cache.find(x => x.name === 'POAP MASTER')
if (message.member.permissions.has(Discord.Permissions.FLAGS.MANAGE_GUILD) || (allowedRole && message.member.roles.has(allowedRole.id))) {
// Check that user is an admin in this guild
if (message.content.includes("!setup") && state.state !== states.SETUP) {
//
if (message.content.toLowerCase().includes("!setup") && state.state !== states.SETUP) {
// one at a time
logger.info(`[BOT] user has permission`);
// Get any current record for this guild
Expand Down

0 comments on commit 4c24dd2

Please sign in to comment.