mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-07 11:07:19 +00:00
Timeouts: better validations (#438)
* better timeout validations Signed-off-by: GitHub <noreply@github.com> * almeida reviews Signed-off-by: GitHub <noreply@github.com> * better error handling Signed-off-by: GitHub <noreply@github.com> * add missing catch noops Signed-off-by: GitHub <noreply@github.com> --------- Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
parent
047ab872df
commit
8860d4fb22
5 changed files with 49 additions and 9 deletions
|
@ -5,7 +5,7 @@ import { CaseTypes } from "../../../data/CaseTypes";
|
|||
import { AddMuteParams } from "../../../data/GuildMutes";
|
||||
import { MuteTypes } from "../../../data/MuteTypes";
|
||||
import { Mute } from "../../../data/entities/Mute";
|
||||
import { resolveMember, resolveUser } from "../../../utils";
|
||||
import { noop, resolveMember, resolveUser } from "../../../utils";
|
||||
import { CasesPlugin } from "../../Cases/CasesPlugin";
|
||||
import { CaseArgs } from "../../Cases/types";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
|
@ -54,8 +54,10 @@ export async function unmuteUser(
|
|||
}
|
||||
|
||||
// Update timeout
|
||||
if (existingMute?.type === MuteTypes.Timeout || createdMute?.type === MuteTypes.Timeout) {
|
||||
await member?.disableCommunicationUntil(timeoutExpiresAt);
|
||||
if (member && (existingMute?.type === MuteTypes.Timeout || createdMute?.type === MuteTypes.Timeout)) {
|
||||
if (!member.moderatable) return null;
|
||||
|
||||
await member.disableCommunicationUntil(timeoutExpiresAt).catch(noop);
|
||||
await pluginData.state.mutes.updateTimeoutExpiresAt(userId, timeoutExpiresAt);
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue