decord/alpha/source/modules/stickers/StickerSendability.tsx

79 lines
3 KiB
TypeScript
Raw Normal View History

2026-10-03 08:58:59 +00:00
// Module ID: 6840
// Function ID: 6841
// Name: StickerSendability
2026-10-03 08:58:59 +00:00
// Dependencies: [2112, 5689, 1085, 4528, 5428, 4514, 2]
2026-07-20 16:05:17 +00:00
// Exports: isSendableSticker
2026-10-03 08:58:59 +00:00
// Module 6840 (StickerSendability)
import Constants from "Constants" /* 1085 */;
import PermissionUtilsAll from "PermissionUtils" /* 4514 */;
import PremiumUtilsDefault from "PremiumUtils" /* 4528 */;
import StickersUtils from "StickersUtils" /* 5428 */;
import GuildMemberStore from "GuildMemberStore" /* 2112 */;
import StickersPackStore from "StickersPackStore" /* 5689 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
function getStickerSendability(item10030, currentUser, channel) {
2026-10-03 08:58:59 +00:00
let obj;
if (null == currentUser) {
2026-07-20 16:05:17 +00:00
return obj.NONSENDABLE;
} else {
2026-10-03 08:58:59 +00:00
let NONSENDABLE;
const obj4 = PremiumUtilsDefault;
const result = obj4.canUseCustomStickersEverywhere(currentUser);
const obj5 = StickersUtils;
const tmp19 = require;
if (obj5.isStandardSticker(item10030)) {
2026-10-03 08:58:59 +00:00
let SENDABLE;
if (null == StickersPackStore.getStickerPack(item10030.pack_id)) {
2026-10-03 08:58:59 +00:00
SENDABLE = obj.NONSENDABLE;
2026-07-20 16:05:17 +00:00
} else {
2026-10-03 08:58:59 +00:00
SENDABLE = obj.SENDABLE;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
NONSENDABLE = SENDABLE;
2026-07-20 16:05:17 +00:00
} else {
2026-10-03 08:58:59 +00:00
const tmp19Result = tmp19(5428);
if (tmp19Result.isGuildSticker(item10030)) {
2026-07-20 16:05:17 +00:00
if (null != channel) {
2026-10-03 08:58:59 +00:00
let SENDABLE_WITH_BOOSTED_GUILD;
if (null == GuildMemberStore.getSelfMember(item10030.guild_id)) {
2026-10-03 08:58:59 +00:00
SENDABLE_WITH_BOOSTED_GUILD = obj.NONSENDABLE;
} else if (item10030.available) {
2026-10-03 08:58:59 +00:00
let NONSENDABLE2;
2026-07-20 16:05:17 +00:00
if (null != channel.guild_id) {
if ("" !== channel.guild_id) {
2026-10-03 08:58:59 +00:00
if (channel.guild_id === item10030.guild_id) {
NONSENDABLE2 = obj.SENDABLE;
}
SENDABLE_WITH_BOOSTED_GUILD = NONSENDABLE2;
2026-07-20 16:05:17 +00:00
}
}
if (null != channel.guild_id) {
obj = { permission: Permissions.USE_EXTERNAL_STICKERS, user: currentUser, context: channel };
2026-10-03 08:58:59 +00:00
const obj2 = PermissionUtilsAll;
2026-07-20 16:05:17 +00:00
if (!obj2.can(obj)) {
2026-10-03 08:58:59 +00:00
NONSENDABLE2 = obj.NONSENDABLE;
2026-07-20 16:05:17 +00:00
}
}
2026-10-03 08:58:59 +00:00
NONSENDABLE2 = result ? tmp8.SENDABLE : tmp8.SENDABLE_WITH_PREMIUM;
2026-07-20 16:05:17 +00:00
} else {
SENDABLE_WITH_BOOSTED_GUILD = obj.SENDABLE_WITH_BOOSTED_GUILD;
}
2026-10-03 08:58:59 +00:00
NONSENDABLE = SENDABLE_WITH_BOOSTED_GUILD;
2026-07-20 16:05:17 +00:00
}
}
2026-10-03 08:58:59 +00:00
NONSENDABLE = obj.NONSENDABLE;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return NONSENDABLE;
2026-07-20 16:05:17 +00:00
}
}
2026-10-03 08:58:59 +00:00
const Permissions = Constants.Permissions;
const StickerSendability = { SENDABLE: 0, [0]: "SENDABLE", SENDABLE_WITH_PREMIUM: 1, [1]: "SENDABLE_WITH_PREMIUM", NONSENDABLE: 2, [2]: "NONSENDABLE", SENDABLE_WITH_BOOSTED_GUILD: 3, [3]: "SENDABLE_WITH_BOOSTED_GUILD" };
let result = size.fileFinishedImporting("modules/stickers/StickerSendability.tsx");
2026-07-20 16:05:17 +00:00
export { StickerSendability };
2026-07-20 16:05:17 +00:00
export { getStickerSendability };
2026-07-29 08:29:29 +00:00
export const isSendableSticker = function isSendableSticker(id, currentUser, channel) {
return getStickerSendability(id, currentUser, channel) === obj.SENDABLE;
2026-07-20 16:05:17 +00:00
};