Skip to content
This repository has been archived by the owner on Oct 6, 2019. It is now read-only.

Commit

Permalink
Fix error due to uncached member
Browse files Browse the repository at this point in the history
  • Loading branch information
robflop committed Mar 5, 2018
1 parent 5fb9e1c commit 6e3715b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"name": "robbot",
"version": "4.3.1",
"version": "4.3.2",
"description": "Discord bot to along with the website megumin.love, built with discord.js",
"main": "./src/robbot",
"dependencies": {
"chalk": "^2.3.0",
"discord.js": "^11.3.0",
"chalk": "^2.3.2",
"discord.js": "^11.3.2",
"erlpack": "^0.1.2",
"moment": "^2.20.1",
"moment": "^2.21.0",
"opusscript": "^0.0.6",
"prism-media": "github:hydrabolt/prism-media",
"snekfetch": "^3.6.1",
"snekfetch": "^4.0.0-beta.0",
"uws": "^9.14.0",
"zlib-sync": "^0.1.4"
},
"devDependencies": {
"eslint": "^4.15.0"
"eslint": "^4.18.2"
},
"scripts": {
"test": "eslint src"
Expand Down
4 changes: 3 additions & 1 deletion src/controllers/CommandController.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class CommandController {
});
}

permissionsCheck(command, message) {
async permissionsCheck(command, message) {
let type = '';
const clientMember = message.guild.me;
const { perms } = command;
Expand All @@ -101,6 +101,8 @@ class CommandController {
}
}

if (!message.member) message.member = await message.guild.fetchMember(message.author);

if ('client' in perms && !clientMember.permissions.has(perms.client)) type = 'client';
if ('member' in perms && !message.member.permissions.has(perms.member)) type = 'member';
if (!type || (owners.includes(message.member.user.id) && type !== 'client')) return true;
Expand Down

0 comments on commit 6e3715b

Please sign in to comment.