mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-07 11:07:19 +00:00
almeida reviews
Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
parent
3898a06c71
commit
a250366b02
2 changed files with 5 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { PermissionsBitField, Snowflake } from "discord.js";
|
import { Snowflake } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import humanizeDuration from "humanize-duration";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
|
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
|
||||||
|
@ -91,7 +91,6 @@ export async function muteUser(
|
||||||
rolesToRestore = currentUserRoles.filter((x) => (<string[]>restoreRoles).includes(x));
|
rolesToRestore = currentUserRoles.filter((x) => (<string[]>restoreRoles).includes(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
const zep = await pluginData.guild.members.fetchMe();
|
|
||||||
if (muteType === MuteTypes.Role) {
|
if (muteType === MuteTypes.Role) {
|
||||||
// Verify the configured mute role is valid
|
// Verify the configured mute role is valid
|
||||||
const actualMuteRole = pluginData.guild.roles.cache.get(muteRole!);
|
const actualMuteRole = pluginData.guild.roles.cache.get(muteRole!);
|
||||||
|
@ -104,6 +103,7 @@ export async function muteUser(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify the mute role is not above Zep's roles
|
// Verify the mute role is not above Zep's roles
|
||||||
|
const zep = await pluginData.guild.members.fetchMe();
|
||||||
const zepRoles = pluginData.guild.roles.cache.filter((x) => zep.roles.cache.has(x.id));
|
const zepRoles = pluginData.guild.roles.cache.filter((x) => zep.roles.cache.has(x.id));
|
||||||
if (zepRoles.size === 0 || !zepRoles.some((zepRole) => zepRole.position > actualMuteRole.position)) {
|
if (zepRoles.size === 0 || !zepRoles.some((zepRole) => zepRole.position > actualMuteRole.position)) {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
@ -125,7 +125,7 @@ export async function muteUser(
|
||||||
throw new RecoverablePluginError(ERRORS.USER_ABOVE_ZEP, pluginData.guild);
|
throw new RecoverablePluginError(ERRORS.USER_ABOVE_ZEP, pluginData.guild);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!member.moderatable || member.permissions.has(PermissionsBitField.Flags.Administrator)) {
|
if (!member.moderatable) {
|
||||||
// redundant safety, since canActOn already checks this
|
// redundant safety, since canActOn already checks this
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
logs.logBotAlert({
|
logs.logBotAlert({
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { PermissionsBitField, Snowflake } from "discord.js";
|
import { Snowflake } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import humanizeDuration from "humanize-duration";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { CaseTypes } from "../../../data/CaseTypes";
|
import { CaseTypes } from "../../../data/CaseTypes";
|
||||||
|
@ -55,8 +55,7 @@ export async function unmuteUser(
|
||||||
|
|
||||||
// Update timeout
|
// Update timeout
|
||||||
if (member && (existingMute?.type === MuteTypes.Timeout || createdMute?.type === MuteTypes.Timeout)) {
|
if (member && (existingMute?.type === MuteTypes.Timeout || createdMute?.type === MuteTypes.Timeout)) {
|
||||||
if (!member.manageable || !member.moderatable || member.permissions.has(PermissionsBitField.Flags.Administrator))
|
if (!member.moderatable) return null;
|
||||||
return null;
|
|
||||||
|
|
||||||
await member.disableCommunicationUntil(timeoutExpiresAt);
|
await member.disableCommunicationUntil(timeoutExpiresAt);
|
||||||
await pluginData.state.mutes.updateTimeoutExpiresAt(userId, timeoutExpiresAt);
|
await pluginData.state.mutes.updateTimeoutExpiresAt(userId, timeoutExpiresAt);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue