Files
discord-decomp/utils/NicknameUtils.tsx
T
2026-11-01 12:12:55 +02:00

59 lines
1.6 KiB
TypeScript

// Metro module 4379 (f4380).
import ChannelStore from "../stores/ChannelStore";
import GuildMemberStore from "../stores/GuildMemberStore";
import RelationshipStore from "../stores/RelationshipStore";
import { intl, t } from "../intl/index.native";
import UserUtils from "./UserUtils";
import { useStateFromStores } from "../_bundle/Module589";
let getName;
export function getNickname(a0, a1, a2) {
if (a2 == null) {
return null;
}
if (a0 != null) {
return GuildMemberStore.getNick(a0, a2.id);
}
if (a1 != null) {
const channel = ChannelStore.getChannel(a1);
if (channel == null ? void 0 : channel.isPrivate()) {
return RelationshipStore.getNickname(a2.id);
}
}
return null;
}
getName = function getName(a0, id, a2) {
let r2;
if (a2 == null) {
r2 = intl.string(t.sKdZ6U);
} else {
const r1 = a2 == null;
r2 = null;
if (!r1) {
if (a0 != null) {
r2 = GuildMemberStore.getNick(a0, a2.id);
} else {
const r9 = id != null;
r2 = null;
if (r9) {
const channel = ChannelStore.getChannel(id);
r2 = (channel == null ? void 0 : channel.isPrivate()) ? RelationshipStore.getNickname(a2.id) : null;
}
}
}
if (r2 == null) {
r2 = UserUtils.getName(a2);
}
}
return r2;
};
export function useName(c14149_0, c14149_1, c14149_2) {
return useStateFromStores([GuildMemberStore, ChannelStore, RelationshipStore], () => getName(c14149_0, c14149_1, c14149_2));
}
const r21 = {
getNickname,
getName,
useName
};
export default r21;
export { getName };