decord/source/modules/channel_text_area/ChatInputContentCallbacks.tsx

111 lines
3.3 KiB
TypeScript
Raw Normal View History

2026-09-02 09:53:35 +00:00
// Module ID: 11790
// Function ID: 11791
2026-07-29 08:29:29 +00:00
// Name: tryUpdateSubscriptionForHereMention
2026-09-02 09:53:35 +00:00
// Dependencies: [32, 19, 6134, 6165, 6140, 8168, 12, 2]
2026-07-29 08:29:29 +00:00
// Exports: tryUpdateSubscriptionForHereMention, useHereMentionCallback
2026-07-20 16:05:17 +00:00
2026-09-02 09:53:35 +00:00
// Module 11790 (tryUpdateSubscriptionForHereMention)
import reset from "reset" /* 6140 */;
import subscribeMembers from "subscribeMembers" /* 6165 */;
import useMessageMaxLengthDefault from "useMessageMaxLength" /* 8168 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "_slicedToArray" /* 32 */;
import closure_4 from "noop" /* 19 */;
2026-09-02 09:53:35 +00:00
import closure_5 from "getMemberListId" /* 6134 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
let c6 = "@here";
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/channel_text_area/ChatInputContentCallbacks.tsx");
2026-07-29 08:29:29 +00:00
export const tryUpdateSubscriptionForHereMention = function tryUpdateSubscriptionForHereMention(arr, maxMessageLength, guild_id, id) {
const groups = props.getProps(guild_id, id).groups;
2026-07-20 16:05:17 +00:00
let tmp = groups.length > 1;
if (!tmp) {
let tmp2 = 1 === groups.length;
if (tmp2) {
tmp2 = "unknown" === groups[0].id;
}
tmp = !tmp2;
}
2026-07-29 08:29:29 +00:00
let tmp3 = tmp;
if (!tmp3) {
let tmp5 = arr.length < 5;
if (!tmp5) {
tmp5 = arr.length > maxMessageLength;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp7 = !tmp5;
if (!tmp5) {
2026-07-23 10:11:24 +00:00
let flag = -1 !== arr.indexOf(c6);
2026-07-20 16:05:17 +00:00
if (flag) {
2026-08-24 06:08:38 +00:00
subscribeMembers.subscribeChannel(guild_id, id, reset.DEFAULT_RANGES);
2026-07-20 16:05:17 +00:00
flag = true;
2026-08-24 06:08:38 +00:00
const obj = subscribeMembers;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp7 = flag;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp3 = tmp7;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp3;
};
2026-07-20 16:05:17 +00:00
export const useHereMentionCallback = function useHereMentionCallback(arg0, arg1, arg2) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
importDefault = arg1;
dependencyMap = arg2;
let tmp = useMessageMaxLengthDefault();
2026-07-20 16:05:17 +00:00
const callback = tmp;
2026-07-29 08:29:29 +00:00
let tmp2 = callback(first.useState(false), 2);
2026-07-23 10:11:24 +00:00
first = tmp2[0];
2026-08-24 06:08:38 +00:00
closure_5 = tmp2[1];
2026-07-20 16:05:17 +00:00
const items = [tmp, arg1, arg2];
2026-07-29 08:29:29 +00:00
const memo = first.useMemo(() => callback(table[6]).debounce((arr) => {
2026-08-24 06:08:38 +00:00
const groups = closure_1_5.getProps(closure_1, closure_2).groups;
2026-07-29 08:29:29 +00:00
let tmp4 = groups.length > 1;
if (!tmp4) {
let tmp5 = 1 === groups.length;
if (tmp5) {
tmp5 = "unknown" === groups[0].id;
}
tmp4 = !tmp5;
}
let tmp6 = tmp4;
if (!tmp6) {
let tmp9 = !tmp8;
2026-08-24 06:08:38 +00:00
if (!(arr.length < 5 || arr.length > closure_3)) {
let flag = -1 !== arr.indexOf(closure_1_6);
2026-07-29 08:29:29 +00:00
if (flag) {
2026-08-24 06:08:38 +00:00
closure_1_0(closure_1_2[3]).subscribeChannel(closure_1, closure_2, closure_1_0(closure_1_2[4]).DEFAULT_RANGES);
2026-07-29 08:29:29 +00:00
flag = true;
2026-08-24 06:08:38 +00:00
const obj = closure_1_0(closure_1_2[3]);
2026-07-29 08:29:29 +00:00
}
tmp9 = flag;
}
tmp6 = tmp9;
}
if (tmp6) {
callback(true);
2026-07-20 16:05:17 +00:00
}
}, 200, { maxWait: 500 }), items);
const items1 = [first, memo, arg0, arg1, arg2];
2026-07-23 10:11:24 +00:00
const effect = first.useEffect(() => {
2026-07-29 08:29:29 +00:00
const groups = props.getProps(closure_1, closure_2).groups;
2026-07-23 10:11:24 +00:00
if (null != closure_1) {
2026-07-29 08:29:29 +00:00
let tmp = groups.length > 1;
if (!tmp) {
let tmp2 = 1 === groups.length;
if (tmp2) {
tmp2 = "unknown" === groups[0].id;
}
tmp = !tmp2;
}
if (!tmp) {
2026-07-20 16:05:17 +00:00
if (!first) {
2026-07-23 10:11:24 +00:00
closure_0.addListener("text-changed", memo);
2026-07-20 16:05:17 +00:00
return () => {
2026-07-29 08:29:29 +00:00
closure_0.removeListener("text-changed", closure_6);
closure_6.cancel();
2026-07-20 16:05:17 +00:00
};
}
}
}
}, items1);
};