decord/source/modules/saved_messages/SavedMessageUtils.tsx

212 lines
6.7 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 10919
// Function ID: 10920
2026-07-20 16:05:17 +00:00
// Name: _savedMessageJumpToMessage
2026-08-24 06:08:38 +00:00
// Dependencies: [5, 19, 1395, 1391, 676, 1236, 3978, 589, 4775, 7249, 2]
2026-07-20 16:05:17 +00:00
// Exports: savedMessageJumpToMessage, useDueInString, useSavedMessageChannel
2026-08-24 06:08:38 +00:00
// Module 10919 (_savedMessageJumpToMessage)
import getSystemLocale from "getSystemLocale" /* 1236 */;
import tDefault from "t" /* 3978 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "noop" /* 19 */;
import { UnknownChannelRecord } from "createChannelRecord" /* 1395 */;
import closure_6 from "ensureGuildLoaded" /* 1391 */;
import ME from "ME" /* 676 */;
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 _savedMessageJumpToMessage() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback((arg0, arg1) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
c6 = 0;
c7 = 0;
c5 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0, arg1) {
if (constants === 2) {
constants = 3;
HermesBuiltin.throwTypeError();
} else if (tmp7 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
2026-08-24 06:08:38 +00:00
obj = { value: null, done: true };
2026-07-29 08:29:29 +00:00
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
constants = 2;
if (0 === c6) {
if (arg0 === 1) {
constants = 3;
throw arg1;
} else if (arg0 === 2) {
constants = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_3 = tmp3;
closure_2 = tmp5;
2026-07-29 08:29:29 +00:00
closure_2 = undefined;
let type;
if (lib != null) {
type = lib.type;
}
if (type === constants.UNKNOWN) {
if (null == tmp43.saveData.guildId) {
2026-08-24 06:08:38 +00:00
c5 = 1;
2026-07-29 08:29:29 +00:00
c6 = 2;
constants = 1;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: false };
obj1[0] = lib(closure_1_2[8]).fetchChannel(tmp43.saveData.channelId);
2026-07-29 08:29:29 +00:00
return obj1;
}
}
}
} else if (1 === tmp8) {
c5 = 0;
} else if (2 === tmp8) {
if (arg0 === 1) {
constants = 3;
throw arg1;
} else if (arg0 === 2) {
c5 = 0;
constants = 3;
const obj2 = { value: null, done: true };
obj2[0] = arg1;
return obj2;
} else {
closure_2 = arg1;
if (null == closure_2.recipients) {
c5 = 0;
constants = 3;
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
} else if (closure_2.recipients.length > 1) {
c5 = 0;
constants = 3;
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
} else {
obj1 = lib(closure_2[8]);
const recipients = closure_2.recipients;
c6 = 3;
constants = 1;
const obj3 = { value: null, done: false };
obj3[0] = obj1.ensurePrivateChannel(recipients.map((id) => id.id));
return obj3;
}
}
} else if (arg0 === 1) {
constants = 3;
throw arg1;
} else if (arg0 === 2) {
c5 = 0;
constants = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
c5 = 0;
}
let guildId;
if (lib != null) {
guildId = lib.getGuildId();
}
lib(closure_2[9])(closure_8.CHANNEL(guildId, closure_0.saveData.channelId, closure_0.saveData.messageId), { openChannel: true });
constants = 3;
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
} catch (tmp30) {
2026-08-24 06:08:38 +00:00
closure_4 = tmp30;
2026-07-29 08:29:29 +00:00
if (tmp4 === c5) {
constants = tmp2;
throw tmp30;
} else {
c6 = tmp;
}
}
}
})();
});
2026-08-24 06:08:38 +00:00
closure_10 = tmp;
2026-07-29 08:29:29 +00:00
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
({ ChannelTypes: error, Routes: closure_8 } = ME);
2026-07-23 10:11:24 +00:00
let obj = { LONG: 0, [0]: "LONG", SHORT: 1, [1]: "SHORT" };
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/saved_messages/SavedMessageUtils.tsx");
2026-07-20 16:05:17 +00:00
export const DueInStringTypes = obj;
export const useDueInString = function useDueInString(arg0) {
({ dueAt, now, type } = arg0);
if (null == dueAt) {
2026-07-23 10:11:24 +00:00
return { string: "", isOverdue: false };
2026-07-20 16:05:17 +00:00
} else {
if (type === obj.LONG) {
2026-08-24 06:08:38 +00:00
let H4gnX9 = getSystemLocale.t.TjNWNF;
2026-07-29 08:29:29 +00:00
let tmp = require;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
tmp = require;
2026-08-24 06:08:38 +00:00
H4gnX9 = getSystemLocale.t.H4gnX9;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (type === tmp8.LONG) {
Uq7Y_7 = tmp(1236).t.haia16;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
Uq7Y_7 = tmp(1236).t["Uq7Y+7"];
2026-07-20 16:05:17 +00:00
}
if (now > dueAt) {
H4gnX9 = Uq7Y_7;
}
2026-07-29 08:29:29 +00:00
obj = { dueInText: null, isOverdue: null };
const intl = tmp(1236).intl;
obj = { duration: null };
2026-07-20 16:05:17 +00:00
const time = dueAt.getTime();
2026-08-24 06:08:38 +00:00
const obj3 = tDefault;
2026-07-29 08:29:29 +00:00
tmp8 = obj;
2026-08-24 06:08:38 +00:00
obj[0] = tDefault.duration(time - now.getTime(), "millisecond").humanize();
2026-07-29 08:29:29 +00:00
obj[0] = intl.formatToPlainString(H4gnX9, obj);
obj[1] = now > dueAt;
2026-07-20 16:05:17 +00:00
return obj;
}
};
export const useSavedMessageChannel = function useSavedMessageChannel(savedMessage) {
2026-07-23 10:11:24 +00:00
const _require = savedMessage;
2026-08-24 06:08:38 +00:00
const items = [closure_6];
const stateFromStores = _require(589).useStateFromStores(items, () => closure_1_6.getChannel(savedMessage.saveData.channelId));
2026-07-20 16:05:17 +00:00
const items1 = [stateFromStores, savedMessage];
2026-07-23 10:11:24 +00:00
return React.useMemo(() => {
2026-07-29 08:29:29 +00:00
let tmp = stateFromStores;
if (null == stateFromStores) {
let tmp9;
if (null != savedMessage.message) {
2026-08-24 06:08:38 +00:00
obj = { id: null, guild_id: null, type: null, name: null };
2026-07-29 08:29:29 +00:00
obj[0] = tmp10.saveData.channelId;
obj[1] = tmp10.saveData.guildId;
2026-08-24 06:08:38 +00:00
obj[2] = closure_1_7.UNKNOWN;
const intl = savedMessage(closure_1_2[5]).intl;
obj[3] = intl.string(savedMessage(closure_1_2[5]).t.J90oLW);
tmp9 = new closure_1_5(obj);
2026-07-29 08:29:29 +00:00
}
tmp = tmp9;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp;
2026-07-20 16:05:17 +00:00
}, items1);
};
2026-08-24 06:08:38 +00:00
export const savedMessageJumpToMessage = function savedMessageJumpToMessage(closure_1_0, c1) {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _savedMessageJumpToMessage.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
};