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:
parent
5d49a3b5eb
commit
4eb28c3bd8
2 changed files with 24 additions and 9 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue