decord/alpha/source/modules/vibegrations/lib/vibegrationsTopicChannel.tsx
2026-10-03 08:58:59 +00:00

114 lines
3 KiB
TypeScript

// Module ID: 2059
// Function ID: 2060
// Name: vibegrationsTopicChannel
// Dependencies: [1085, 2]
// Exports: isVibegrationsLegacyTopicChannel, normalizeVibegrationsTopicChannel, normalizeVibegrationsTopicChannelRecord, vibegrationsAppIdFromTopic, vibegrationsTopicForApp
// Module 2059 (vibegrationsTopicChannel)
import Constants from "Constants" /* 1085 */;
import size from "module_2" /* 2 */;
const ChannelTypes = Constants.ChannelTypes;
let c1 = "vibegrations_application_id=";
const re2 = /^\d{17,20}$/;
const result = size.fileFinishedImporting("modules/vibegrations/lib/vibegrationsTopicChannel.tsx");
export const vibegrationsAppIdFromTopic = function vibegrationsAppIdFromTopic(topic_) {
if (null != topic_) {
if (topic_.startsWith(c1)) {
const substr = topic_.slice(28);
let tmp4 = null;
if (re2.test(substr)) {
tmp4 = substr;
}
return tmp4;
}
}
return null;
};
export const vibegrationsTopicForApp = function vibegrationsTopicForApp(arg0) {
return "" + c1 + arg0;
};
export const normalizeVibegrationsTopicChannel = function normalizeVibegrationsTopicChannel(arg0) {
let topic;
let type;
({ type, topic } = arg0);
if (type == null) {
type = ChannelTypes.GUILD_TEXT;
}
let tmp3 = null;
const tmp2 = ChannelTypes;
if (type === ChannelTypes.GUILD_TEXT) {
let tmp4 = null;
if (null != topic) {
tmp4 = null;
if (topic.startsWith(c1)) {
const substr = topic.slice(28);
let tmp8 = null;
if (re2.test(substr)) {
tmp8 = substr;
}
tmp4 = tmp8;
}
}
tmp3 = tmp4;
}
let tmp9 = arg0;
if (null != tmp3) {
const obj = { type: tmp2.GUILD_APP, application_id: tmp3 };
const merged = Object.assign(arg0);
tmp9 = obj;
}
return tmp9;
};
export const normalizeVibegrationsTopicChannelRecord = function normalizeVibegrationsTopicChannelRecord(arg0) {
let topic_;
let type;
({ type, topic_ } = arg0);
if (type == null) {
type = ChannelTypes.GUILD_TEXT;
}
let tmp3 = null;
const tmp2 = ChannelTypes;
if (type === ChannelTypes.GUILD_TEXT) {
let tmp4 = null;
if (null != topic_) {
tmp4 = null;
if (topic_.startsWith(c1)) {
const substr = topic_.slice(28);
let tmp8 = null;
if (re2.test(substr)) {
tmp8 = substr;
}
tmp4 = tmp8;
}
}
tmp3 = tmp4;
}
let tmp9 = arg0;
if (null != tmp3) {
const obj = { type: tmp2.GUILD_APP, application_id: tmp3 };
const merged = Object.assign(arg0);
tmp9 = obj;
}
return tmp9;
};
export const isVibegrationsLegacyTopicChannel = function isVibegrationsLegacyTopicChannel(type, topic_) {
let tmp = type === ChannelTypes.GUILD_APP;
if (tmp) {
let tmp4 = null;
if (null != topic_) {
tmp4 = null;
if (topic_.startsWith(c1)) {
const substr = topic_.slice(28);
let tmp8 = null;
if (re2.test(substr)) {
tmp8 = substr;
}
tmp4 = tmp8;
}
}
tmp = null != tmp4;
}
return tmp;
};