Files
discord-decomp/modules/premium/PremiumGiftingUtils.tsx
T
2026-11-01 12:12:55 +02:00

50 lines
1.6 KiB
TypeScript

// Metro module 7857 (f7858).
import ChannelStore from "../../stores/ChannelStore";
import { MessageSendLocation } from "../messages/MessageConstants";
import ChannelActionCreators from "../../actions/ChannelActionCreators";
import Module38 from "../../_bundle/Module38";
import { getGiftCodeURL } from "../../utils/GiftCodeUtils";
import MessageActionCreators from "../../actions/MessageActionCreators";
import MessageParser from "../messages/MessageParser";
let env4961 = {};
const r20 = {
ACTION: "action",
LOOP: "loop",
IDLE: "idle"
};
export { r20 as AnimationState };
export async function sendGiftMessage(c26044_0, c26044_1) {
let env29857;
const r30 = env4961;
let c26044_3 = r30;
const r10 = env29857 = {
$parent: r30
};
let c26044_2 = r10;
env29857[0] = c26044_1;
env29857[1] = void 0;
env29857[2] = void 0;
if (c26044_1 == null) {
throw new Error("giftCode must be defined");
}
if (c26044_0 == null) {
throw new Error("Recipient must be defined");
}
env29857[1] = await ChannelActionCreators.openPrivateChannel({
recipientIds: c26044_0.id
}).then((result) => {
const channel = ChannelStore.getChannel(result);
Module38(channel != null, "PrivateChannel is null");
if (channel == null) {
throw new Error("Channel must be defined");
}
return channel;
});
env29857[2] = getGiftCodeURL(env29857[0]);
return MessageActionCreators.sendMessage(env29857[1].id, MessageParser.parse(env29857[1], env29857[2]), void 0, {
isGiftLinkSentOnBehalfOfUser: true,
location: MessageSendLocation.GIFTING
});
}
export function unhandledGiftIntent() {}