decord/source/utils/GuildUtils.tsx

171 lines
5 KiB
TypeScript
Raw Normal View History

// Module ID: 5519
// Function ID: 5520
2026-07-29 08:29:29 +00:00
// Name: getGuildNameSuggestion
// Dependencies: [1979, 1371, 1437, 1090, 5520, 4404, 1114, 2]
2026-07-20 16:05:17 +00:00
// Exports: getGuildNameSuggestion
// Module 5519 (getGuildNameSuggestion)
import setDefault from "set" /* 1090 */;
import getSystemLocale from "getSystemLocale" /* 1114 */;
import nameFromUserAll from "nameFromUser" /* 4404 */;
import closure_5 from "createGuildRecordFromRust" /* 1979 */;
import closure_6 from "mergeGuildAvatar" /* 1371 */;
import importDefaultResult from "priv" /* 1437 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function getGuildNameSuggestion(truncateUsername) {
2026-07-23 10:11:24 +00:00
currentUser = currentUser.getCurrentUser();
2026-08-24 06:08:38 +00:00
let obj = nameFromUserAll;
2026-07-20 16:05:17 +00:00
const name = obj.getName(currentUser);
let str = "";
if (null != name) {
str = "";
if (0 !== name.length) {
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
2026-07-29 08:29:29 +00:00
truncateUsername = undefined;
if (truncateUsername != null) {
truncateUsername = truncateUsername.truncateUsername;
}
2026-07-20 16:05:17 +00:00
let substr = name;
2026-07-29 08:29:29 +00:00
if (truncateUsername) {
substr = name.slice(0, 20);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { username: null };
obj[0] = substr;
2026-08-24 06:08:38 +00:00
str = intl.formatToPlainString(getSystemLocale.t.Y6Qfju, obj);
2026-07-20 16:05:17 +00:00
}
}
return str;
}
2026-07-29 08:29:29 +00:00
let obj = { maxAge: null };
2026-08-24 06:08:38 +00:00
obj[0] = setDefault.Millis.MINUTE;
2026-07-20 16:05:17 +00:00
importDefaultResult = new importDefaultResult(obj);
2026-07-29 08:29:29 +00:00
const error = importDefaultResult;
2026-07-20 16:05:17 +00:00
obj = {
getGuildNameSuggestion,
requestMembers(arr) {
2026-08-24 06:08:38 +00:00
closure_0 = arg1;
2026-07-29 08:29:29 +00:00
let num = arg2;
2026-07-20 16:05:17 +00:00
if (arg2 === undefined) {
num = 10;
}
2026-08-24 06:08:38 +00:00
closure_1 = undefined;
2026-07-20 16:05:17 +00:00
const isArray = Array.isArray(arr);
2026-07-29 08:29:29 +00:00
let items = [];
closure_1 = items;
2026-07-20 16:05:17 +00:00
if (isArray) {
2026-07-29 08:29:29 +00:00
let item = arr.forEach((arg0) => {
let str = arg0;
if (arg0 == null) {
str = "";
}
const combined = "" + str + ":" + closure_0;
2026-08-24 06:08:38 +00:00
const value = closure_1_7.get(combined);
2026-07-29 08:29:29 +00:00
if (null == value) {
2026-08-24 06:08:38 +00:00
const result = closure_1_7.set(combined, true);
2026-07-29 08:29:29 +00:00
}
if (null == value) {
arr = arr.push(arg0);
2026-07-20 16:05:17 +00:00
}
});
2026-07-29 08:29:29 +00:00
let flag2 = false;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
let str = arr;
if (arr == null) {
str = "";
}
const _HermesInternal = HermesInternal;
let combined = "" + str + ":" + arg1;
let value = importDefaultResult.get(combined);
if (null == value) {
let result = obj.set(combined, true);
}
flag2 = false;
if (null == value) {
flag2 = true;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = importDefaultResult;
2026-07-20 16:05:17 +00:00
}
if (items.length > 0) {
if (isArray) {
2026-07-29 08:29:29 +00:00
closure_0 = items;
closure_1 = arg1;
if (null != timeout) {
const _clearTimeout2 = clearTimeout;
clearTimeout(timeout);
}
const _setTimeout2 = setTimeout;
timeout = setTimeout(() => {
const items = [];
if (null == items) {
const push = items.push;
const items1 = [];
2026-08-24 06:08:38 +00:00
HermesBuiltin.arraySpread(closure_1_5.getGuildIds(), 0);
2026-07-29 08:29:29 +00:00
HermesBuiltin.apply(items1, items);
} else {
const _Array = Array;
if (Array.isArray(arr2)) {
const item = arr2.forEach((arg0) => {
2026-08-24 06:08:38 +00:00
const guild = closure_1_5.getGuild(arg0);
2026-07-29 08:29:29 +00:00
if (null != guild) {
items.push(guild.id);
}
});
} else {
2026-08-24 06:08:38 +00:00
let guild = closure_1_5.getGuild(arr2);
2026-07-29 08:29:29 +00:00
if (null != guild) {
2026-08-24 06:08:38 +00:00
arr = items.push(guild.id);
2026-07-29 08:29:29 +00:00
}
}
}
if (items.length > 0) {
2026-08-24 06:08:38 +00:00
const members = arr(closure_1_3[4]).requestMembers(items, arr.toLocaleLowerCase(), num);
const obj = arr(closure_1_3[4]);
2026-07-29 08:29:29 +00:00
}
}, 200);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if (flag2) {
closure_0 = arr;
closure_1 = arg1;
if (null != timeout) {
const _clearTimeout = clearTimeout;
clearTimeout(timeout);
}
const _setTimeout = setTimeout;
timeout = setTimeout(() => {
const items = [];
if (null == items) {
const push = items.push;
const items1 = [];
2026-08-24 06:08:38 +00:00
HermesBuiltin.arraySpread(closure_1_5.getGuildIds(), 0);
2026-07-29 08:29:29 +00:00
HermesBuiltin.apply(items1, items);
} else {
const _Array = Array;
if (Array.isArray(arr2)) {
const item = arr2.forEach((arg0) => {
2026-08-24 06:08:38 +00:00
const guild = closure_1_5.getGuild(arg0);
2026-07-29 08:29:29 +00:00
if (null != guild) {
items.push(guild.id);
}
});
} else {
2026-08-24 06:08:38 +00:00
let guild = closure_1_5.getGuild(arr2);
2026-07-29 08:29:29 +00:00
if (null != guild) {
2026-08-24 06:08:38 +00:00
arr = items.push(guild.id);
2026-07-29 08:29:29 +00:00
}
}
}
if (items.length > 0) {
2026-08-24 06:08:38 +00:00
const members = arr(closure_1_3[4]).requestMembers(items, arr.toLocaleLowerCase(), num);
const obj = arr(closure_1_3[4]);
2026-07-29 08:29:29 +00:00
}
}, 200);
2026-07-20 16:05:17 +00:00
}
}
};
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("utils/GuildUtils.tsx");
2026-07-20 16:05:17 +00:00
export default obj;
export { getGuildNameSuggestion };