decord/alpha/source/modules/autocompleter/createAutocompleterResultForChannelId.tsx
2026-10-12 06:59:38 +00:00

59 lines
2.3 KiB
TypeScript

// Module ID: 8713
// Function ID: 8714
// Name: createAutocompleterResultForChannelId
// Dependencies: [2065, 4760, 1390, 6093, 1085, 5421, 2]
// Exports: default
// Module 8713 (createAutocompleterResultForChannelId)
import Constants from "Constants" /* 1085 */;
import useChannelName from "useChannelName" /* 5421 */;
import autocompleter_AutocompleterConstants from "autocompleter/AutocompleterConstants" /* 6093 */;
import ChannelStore from "ChannelStore" /* 2065 */;
import RelationshipStore from "RelationshipStore" /* 4760 */;
import UserStore from "UserStore" /* 1390 */;
import size from "module_2" /* 2 */;
const AutocompleterResultTypes = autocompleter_AutocompleterConstants.AutocompleterResultTypes;
const ChannelTypes = Constants.ChannelTypes;
const result = size.fileFinishedImporting("modules/autocompleter/createAutocompleterResultForChannelId.tsx");
export default function createAutocompleterResultForChannelId(arg0, arg1, UserStore, RelationshipStore) {
let obj = arg1;
if (arg1 === undefined) {
obj = ChannelStore;
}
let obj2 = UserStore;
if (UserStore === undefined) {
obj2 = UserStore;
}
let tmp = RelationshipStore;
if (RelationshipStore === undefined) {
tmp = RelationshipStore;
}
const channel = obj.getChannel(arg0);
if (null == channel) {
return null;
} else {
const obj8 = useChannelName;
const channelName = obj8.computeChannelName(channel, obj2, tmp);
const type = channel.type;
if (ChannelTypes.DM === type) {
const user = obj2.getUser(channel.getRecipientId());
let tmp6 = null;
if (null != user) {
tmp6 = { type: AutocompleterResultTypes.USER, record: user, score: 0, comparator: channelName };
const obj3 = { type: AutocompleterResultTypes.USER, record: user, score: 0, comparator: channelName };
}
return tmp6;
} else if (ChannelTypes.GROUP_DM === type) {
return { type: AutocompleterResultTypes.GROUP_DM, record: channel, score: 0, comparator: channelName };
} else {
if (ChannelTypes.GUILD_VOICE !== type) {
if (ChannelTypes.GUILD_STAGE_VOICE !== type) {
return { type: AutocompleterResultTypes.TEXT_CHANNEL, record: channel, score: 0, comparator: channelName };
}
}
return { type: AutocompleterResultTypes.VOICE_CHANNEL, record: channel, score: 0, comparator: channelName };
}
}
};