decord/source/modules/channel_text_area/ChatInputContentCallbacks.tsx

108 lines
3.2 KiB
TypeScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 11172
// Function ID: 11173
// Name: tryUpdateSubscriptionForHereMention
// Dependencies: [32, 19, 6055, 6071, 6058, 6182, 12, 2]
// Exports: tryUpdateSubscriptionForHereMention, useHereMentionCallback
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
// Module 11172 (tryUpdateSubscriptionForHereMention)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
2026-07-29 08:29:29 +00:00
import noop from "noop";
import getMemberListId from "getMemberListId";
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
let c6 = "@here";
const result = require("getMemberListId").fileFinishedImporting("modules/channel_text_area/ChatInputContentCallbacks.tsx");
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-07-29 08:29:29 +00:00
require(6071) /* subscribeMembers */.subscribeChannel(guild_id, id, require(6058) /* reset */.DEFAULT_RANGES);
2026-07-20 16:05:17 +00:00
flag = true;
2026-07-29 08:29:29 +00:00
const obj = require(6071) /* 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-07-23 10:11:24 +00:00
let closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const importDefault = arg1;
const dependencyMap = arg2;
2026-07-29 08:29:29 +00:00
let tmp = importDefault(6182)();
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-07-29 08:29:29 +00:00
let getMemberListId = 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) => {
const groups = outer1_5.getProps(closure_1, closure_2).groups;
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;
if (!(arr.length < 5 || arr.length > _slicedToArray)) {
let flag = -1 !== arr.indexOf(outer1_6);
if (flag) {
outer1_0(outer1_2[3]).subscribeChannel(closure_1, closure_2, outer1_0(outer1_2[4]).DEFAULT_RANGES);
flag = true;
const obj = outer1_0(outer1_2[3]);
}
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);
};