decord/source/utils/GuildUtils.tsx

168 lines
4.8 KiB
TypeScript
Raw Normal View History

2026-07-31 08:44:05 +00:00
// Module ID: 5108
// Function ID: 5109
2026-07-29 08:29:29 +00:00
// Name: getGuildNameSuggestion
2026-07-31 08:44:05 +00:00
// Dependencies: [1862, 1874, 1386, 687, 5109, 4032, 1236, 2]
2026-07-20 16:05:17 +00:00
// Exports: getGuildNameSuggestion
2026-07-31 08:44:05 +00:00
// Module 5108 (getGuildNameSuggestion)
2026-07-29 08:29:29 +00:00
import createGuildRecordFromRust from "createGuildRecordFromRust";
import mergeGuildAvatar from "mergeGuildAvatar";
2026-07-23 10:11:24 +00:00
import importDefaultResult from "priv";
const 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-07-31 08:44:05 +00:00
let obj = importAll(4032);
2026-07-20 16:05:17 +00:00
const name = obj.getName(currentUser);
let str = "";
if (null != name) {
str = "";
if (0 !== name.length) {
2026-07-29 08:29:29 +00:00
const intl = require(1236) /* getSystemLocale */.intl;
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;
str = intl.formatToPlainString(require(1236) /* 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 };
obj[0] = require("set").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-07-23 10:11:24 +00:00
let 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-07-29 08:29:29 +00:00
let closure_1;
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;
const value = outer1_7.get(combined);
if (null == value) {
const result = outer1_7.set(combined, true);
}
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 = [];
HermesBuiltin.arraySpread(outer1_5.getGuildIds(), 0);
HermesBuiltin.apply(items1, items);
} else {
const _Array = Array;
if (Array.isArray(arr2)) {
const item = arr2.forEach((arg0) => {
const guild = outer1_5.getGuild(arg0);
if (null != guild) {
items.push(guild.id);
}
});
} else {
let guild = outer1_5.getGuild(arr2);
if (null != guild) {
const arr = items.push(guild.id);
}
}
}
if (items.length > 0) {
const members = arr(outer1_3[4]).requestMembers(items, arr.toLocaleLowerCase(), num);
const obj = arr(outer1_3[4]);
}
}, 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 = [];
HermesBuiltin.arraySpread(outer1_5.getGuildIds(), 0);
HermesBuiltin.apply(items1, items);
} else {
const _Array = Array;
if (Array.isArray(arr2)) {
const item = arr2.forEach((arg0) => {
const guild = outer1_5.getGuild(arg0);
if (null != guild) {
items.push(guild.id);
}
});
} else {
let guild = outer1_5.getGuild(arr2);
if (null != guild) {
const arr = items.push(guild.id);
}
}
}
if (items.length > 0) {
const members = arr(outer1_3[4]).requestMembers(items, arr.toLocaleLowerCase(), num);
const obj = arr(outer1_3[4]);
}
}, 200);
2026-07-20 16:05:17 +00:00
}
}
};
2026-07-23 10:11:24 +00:00
let result = require("priv").fileFinishedImporting("utils/GuildUtils.tsx");
2026-07-20 16:05:17 +00:00
export default obj;
export { getGuildNameSuggestion };