Skip to content

Commit

Permalink
allow different permissions to count as bot admin
Browse files Browse the repository at this point in the history
  • Loading branch information
drcatdoctor committed Nov 21, 2020
1 parent 626a414 commit fe1dae1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/bot/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ export class FCBot {

const originator = message.member;

var isAdmin = originator ? originator.hasPermission('ADMINISTRATOR') : false;

if (!originator) {
var isAdmin = false;
if (originator) {
// any of these perms counts as bot admin.
isAdmin = originator.hasPermission('ADMINISTRATOR')
|| originator.hasPermission('MANAGE_GUILD')
|| originator.hasPermission('MANAGE_CHANNELS');
}
else {
console.log("message.member was null");
}

Expand Down

0 comments on commit fe1dae1

Please sign in to comment.