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

30 lines
1.2 KiB
TypeScript

// Metro module 7783 (f7784).
import UserStore from "../../stores/UserStore";
import { WELCOME_STICKERS } from "./WelcomeCTAConstants";
import { AnalyticEvents } from "../../Constants";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import MessageActionCreators from "../../actions/MessageActionCreators";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
export function pickHelloSticker() {
const id = UserStore.getCurrentUser()?.id;
return WELCOME_STICKERS[(id != null ? SnowflakeUtils.extractTimestamp(id) : 0) % WELCOME_STICKERS.length];
}
export function pickWelcomeSticker(a0) {
const id = UserStore.getCurrentUser()?.id;
return WELCOME_STICKERS[((id != null ? SnowflakeUtils.extractTimestamp(id) : 0) + SnowflakeUtils.extractTimestamp(a0)) % WELCOME_STICKERS.length];
}
export function handleWelcomeCtaClicked(a0, a1, a2) {
MessageActionCreators.sendGreetMessage(a0.id, a2, MessageActionCreators.getSendMessageOptionsForReply({
channel: a0,
message: a1,
shouldMention: true,
showMentionToggle: true
}));
AnalyticsUtils.track(AnalyticEvents.WELCOME_CTA_CLICKED, {
is_reply: true,
sticker_id: a2,
target_user: a1.author.id,
sender: UserStore.getCurrentUser()?.id
});
}