decord/beta/source/modules/channel/getChannelIcon.tsx
2026-10-07 22:43:51 +00:00

59 lines
2.1 KiB
TypeScript

// Module ID: 12853
// Function ID: 12854
// Name: getChannelIcon
// Dependencies: [32, 1377, 1085, 1375, 1402, 2]
// Exports: getChannelIconSource, getChannelIconURL
// Module 12853 (getChannelIcon)
import Constants from "Constants" /* 1085 */;
import GlobalUtils from "GlobalUtils" /* 1375 */;
import AvatarUtilsDefault from "AvatarUtils" /* 1402 */;
import _slicedToArray from "_slicedToArray" /* 32 */;
import UserStore from "UserStore" /* 1377 */;
import size from "module_2" /* 2 */;
const ChannelTypes = Constants.ChannelTypes;
const result = size.fileFinishedImporting("modules/channel/getChannelIcon.tsx");
export const getChannelIconURL = function getChannelIconURL(type) {
let num = arg1;
if (arg1 === undefined) {
num = 32;
}
type = type.type;
if (ChannelTypes.DM === type) {
const recipients = type.recipients;
const mapped = recipients.map(UserStore.getUser);
const first = _slicedToArray(mapped.filter(GlobalUtils.isNotNullish), 1)[0];
let avatarURL = null;
if (null != first) {
avatarURL = first.getAvatarURL(undefined, num, arg2);
}
return avatarURL;
} else if (tmp.GROUP_DM === type) {
const obj = { id: null, icon: null, applicationId: type.getApplicationId(), size: num };
({ id: obj.id, icon: obj.icon } = type);
const getChannelIconURL = AvatarUtilsDefault.getChannelIconURL;
AvatarUtilsDefault;
return getChannelIconURL(obj);
}
};
export const getChannelIconSource = function getChannelIconSource(type) {
type = type.type;
if (ChannelTypes.DM === type) {
const recipients = type.recipients;
const mapped = recipients.map(UserStore.getUser);
const first = _slicedToArray(mapped.filter(GlobalUtils.isNotNullish), 1)[0];
let avatarSource = null;
if (null != first) {
avatarSource = first.getAvatarSource(undefined);
}
return avatarSource;
} else if (tmp.GROUP_DM === type) {
const obj = { id: null, icon: null, applicationId: type.getApplicationId(), size: 128 };
({ id: obj.id, icon: obj.icon } = type);
const getChannelIconSource = AvatarUtilsDefault.getChannelIconSource;
AvatarUtilsDefault;
return getChannelIconSource(obj);
}
};