Remove manual mutes (#33)

The unmute command can now unmute users who have had the mute role manually applied to them
This commit is contained in:
roflmaoqwerty 2020-01-29 07:20:05 +11:00 committed by Miikka
parent 5d49a3b5eb
commit 4eb28c3bd8
2 changed files with 24 additions and 9 deletions

View file

@ -892,16 +892,16 @@ export class ModActionsPlugin extends ZeppelinPlugin<TConfigSchema> {
async unmuteCmd(msg: Message, args: { user: string; time?: number; reason?: string; mod?: Member }) {
const user = await this.resolveUser(args.user);
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);
// Check if they're muted in the first place
if (!(await this.mutes.isMuted(args.user))) {
if (!(await this.mutes.isMuted(args.user)) && !hasMuteRole) {
this.sendErrorMessage(msg.channel, "Cannot unmute: member is not muted");
return;
}
// Find the server member to unmute
const memberToUnmute = await this.getMember(user.id);
if (!memberToUnmute) {
const isBanned = await this.isBanned(user.id);
const prefix = this.guildConfig.prefix;