decord/source/modules/guild_communication_disabled/useCommunicationDisabledCountdownCleanup.tsx

63 lines
1.9 KiB
TypeScript
Raw Normal View History

// Module ID: 12557
// Function ID: 12558
2026-07-20 16:05:17 +00:00
// Name: useCommunicationDisabledCountdownCleanup
// Dependencies: [19, 7513, 12558, 2]
2026-07-20 16:05:17 +00:00
// Exports: useCommunicationDisabledCountdownCleanup
// Module 12557 (useCommunicationDisabledCountdownCleanup)
import noop from "module_19" /* 19 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
({ useEffect: c2, useRef: c3 } = noop);
let result = size.fileFinishedImporting("modules/guild_communication_disabled/useCommunicationDisabledCountdownCleanup.tsx");
2026-07-20 16:05:17 +00:00
export const useCommunicationDisabledCountdownCleanup = function useCommunicationDisabledCountdownCleanup(guildMember) {
2026-08-24 06:08:38 +00:00
importDefault = guildMember;
2026-07-20 16:05:17 +00:00
let obj = guildMember;
2026-07-29 08:29:29 +00:00
if (guildMember == null) {
2026-07-20 16:05:17 +00:00
obj = {};
}
({ communicationDisabledUntil, userId } = obj);
const guildId = obj.guildId;
if (null != communicationDisabledUntil) {
const _Date2 = Date;
let parsed = Date.parse(communicationDisabledUntil);
} else {
const _Date = Date;
parsed = Date.now();
}
const tmpResult = require("useCountdown")(parsed);
2026-07-20 16:05:17 +00:00
const seconds = tmpResult.seconds;
seconds(null);
2026-07-20 16:05:17 +00:00
const items = [guildId, userId, seconds, communicationDisabledUntil, guildMember];
guildId(() => {
2026-07-23 10:11:24 +00:00
if (null != closure_0) {
2026-07-20 16:05:17 +00:00
if (null != guildId) {
if (null != userId) {
let tmp5 = seconds <= 0;
if (tmp5) {
tmp5 = null == ref.current;
}
if (tmp5) {
const _setTimeout = setTimeout;
ref.current = setTimeout(() => {
const result = closure_0(userId[2]).clearGuildMemberTimeout(guildId, closure_1_1);
2026-07-20 16:05:17 +00:00
}, 1000);
}
return () => {
2026-07-29 08:29:29 +00:00
if (null != ref.current) {
2026-07-20 16:05:17 +00:00
const _clearTimeout = clearTimeout;
2026-07-29 08:29:29 +00:00
clearTimeout(tmp.current);
tmp.current = null;
2026-07-20 16:05:17 +00:00
}
};
}
}
}
clearTimeout(ref.current);
}, items);
return tmpResult;
};