mutes: fix error when member to unmute cannot be found

This commit is contained in:
Dragory 2020-06-04 02:32:27 +03:00
parent 69feccbcab
commit 69db410808
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -1044,7 +1044,7 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
if (!user) return this.sendErrorMessage(msg.channel, `User not found`);
const memberToUnmute = await this.getMember(user.id);
const mutesPlugin = this.getPlugin<MutesPlugin>("mutes");
const hasMuteRole = mutesPlugin.hasMutedRole(memberToUnmute);
const hasMuteRole = memberToUnmute && mutesPlugin.hasMutedRole(memberToUnmute);
// Check if they're muted in the first place
if (!(await this.mutes.isMuted(args.user)) && !hasMuteRole) {