197 lines
6.4 KiB
TypeScript
197 lines
6.4 KiB
TypeScript
// Module ID: 7252
|
|
// Function ID: 7253
|
|
// Name: vibegrationsAppIdFromTopic
|
|
// Dependencies: [1981, 1910, 4024, 676, 7253, 589, 2]
|
|
// Exports: canManageVibegrations, findVibegrationChannelId, isVibegrationsChannelCandidate, isVibegrationsProjectInGuild, useCanManageVibegrations, useIsVibegrationsChannelCandidate, vibegrationsTopicForApp
|
|
|
|
// Module 7252 (vibegrationsAppIdFromTopic)
|
|
import useIsVibegrationsGuildEnabled from "useIsVibegrationsGuildEnabled" /* 7253 */;
|
|
import closure_2 from "comparator" /* 1981 */;
|
|
import { GUILD_SELECTABLE_CHANNELS_KEY as closure_3 } from "comparator" /* 1981 */;
|
|
import closure_4 from "createGuildRecordFromRust" /* 1910 */;
|
|
import closure_5 from "getUncachedChannelPermissions" /* 4024 */;
|
|
import ME from "ME" /* 676 */;
|
|
|
|
require = arg1;
|
|
function vibegrationsAppIdFromTopic(topic) {
|
|
if (null != topic) {
|
|
if (topic.startsWith(c9)) {
|
|
const substr = topic.slice(28);
|
|
let tmp4 = null;
|
|
if (regex.test(substr)) {
|
|
tmp4 = substr;
|
|
}
|
|
return tmp4;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
function vibegrationsTextChannelsIn(guild_id) {
|
|
return channels.getChannels(guild_id)[closure_3].filter((channel) => channel.channel.type === constants.GUILD_TEXT);
|
|
}
|
|
({ Permissions: closure_6, ChannelTypes: error, GuildFeatures: closure_8 } = ME);
|
|
let c9 = "vibegrations_application_id=";
|
|
const re10 = /^\d{17,20}$/;
|
|
let result = require("set").fileFinishedImporting("modules/vibegrations/lib/VibegrationsUtils.tsx");
|
|
|
|
export { vibegrationsAppIdFromTopic };
|
|
export const vibegrationsTopicForApp = function vibegrationsTopicForApp(arg0) {
|
|
return "" + c9 + arg0;
|
|
};
|
|
export const isVibegrationsProjectInGuild = function isVibegrationsProjectInGuild(guild_id, closure_0) {
|
|
let tmp = null != guild_id;
|
|
if (tmp) {
|
|
let tmp3 = guild_id.guild_id === closure_0 || guild_id.preview_guild_id === closure_0;
|
|
if (!tmp3) {
|
|
tmp3 = null == guild_id.guild_id && null == guild_id.preview_guild_id;
|
|
const tmp4 = null == guild_id.guild_id && null == guild_id.preview_guild_id;
|
|
}
|
|
tmp = tmp3;
|
|
}
|
|
return tmp;
|
|
};
|
|
export { vibegrationsTextChannelsIn };
|
|
export const findVibegrationChannelId = function findVibegrationChannelId(guild_id, application_id) {
|
|
for (const item10009 of tmp) {
|
|
let channel = item10009.channel;
|
|
let tmp2 = channel;
|
|
let tmp3 = vibegrationsAppIdFromTopic;
|
|
if (vibegrationsAppIdFromTopic(channel.topic) === arg1) {
|
|
let tmp4 = obj;
|
|
obj.return();
|
|
return channel.id;
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
export const canManageVibegrations = function canManageVibegrations(closure_2, isAccessibleChannelOrThreadPath) {
|
|
let obj = useIsVibegrationsGuildEnabled;
|
|
obj = { guildId: closure_2.id, location: isAccessibleChannelOrThreadPath };
|
|
let result = obj.isVibegrationsGuildEnabled(obj);
|
|
if (result) {
|
|
result = closure_5.can(constants.MANAGE_CHANNELS, closure_2);
|
|
}
|
|
if (result) {
|
|
result = closure_5.can(constants.MANAGE_GUILD, closure_2);
|
|
}
|
|
if (result) {
|
|
const features = closure_2.features;
|
|
result = !features.has(constants3.INTERNAL_EMPLOYEE_ONLY);
|
|
}
|
|
return result;
|
|
};
|
|
export const useCanManageVibegrations = function useCanManageVibegrations(guildId, useGuildActionRows) {
|
|
const _require = guildId;
|
|
let obj = _require(589);
|
|
const items = [closure_5];
|
|
const items1 = [guildId];
|
|
const stateFromStores = obj.useStateFromStores(items, () => closure_1_5.can(closure_1_6.MANAGE_CHANNELS, closure_0) && closure_1_5.can(closure_1_6.MANAGE_GUILD, closure_0), items1);
|
|
obj = { guildId: guildId.id, location: useGuildActionRows };
|
|
let isVibegrationsGuildEnabled = _require(7253).useIsVibegrationsGuildEnabled(obj);
|
|
const features = guildId.features;
|
|
const hasItem = features.has(constants3.INTERNAL_EMPLOYEE_ONLY);
|
|
if (isVibegrationsGuildEnabled) {
|
|
isVibegrationsGuildEnabled = stateFromStores;
|
|
}
|
|
if (isVibegrationsGuildEnabled) {
|
|
isVibegrationsGuildEnabled = !hasItem;
|
|
}
|
|
return isVibegrationsGuildEnabled;
|
|
};
|
|
export const isVibegrationsChannelCandidate = function isVibegrationsChannelCandidate(channel, ActivitySounds) {
|
|
let guild_id;
|
|
if (channel != null) {
|
|
guild_id = channel.guild_id;
|
|
}
|
|
guild = guild.getGuild(guild_id);
|
|
let result = null != channel;
|
|
if (result) {
|
|
result = channel.type === constants2.GUILD_TEXT;
|
|
}
|
|
if (result) {
|
|
const topic = channel.topic;
|
|
let tmp6 = null;
|
|
if (null != topic) {
|
|
tmp6 = null;
|
|
if (topic.startsWith(c9)) {
|
|
const substr = topic.slice(28);
|
|
let tmp10 = null;
|
|
if (regex.test(substr)) {
|
|
tmp10 = substr;
|
|
}
|
|
tmp6 = tmp10;
|
|
}
|
|
}
|
|
result = null != tmp6;
|
|
}
|
|
if (result) {
|
|
let hasItem;
|
|
if (guild != null) {
|
|
const features = guild.features;
|
|
hasItem = features.has(constants3.INTERNAL_EMPLOYEE_ONLY);
|
|
}
|
|
result = !hasItem;
|
|
}
|
|
if (result) {
|
|
let obj = useIsVibegrationsGuildEnabled;
|
|
let guild_id1;
|
|
if (channel != null) {
|
|
guild_id1 = channel.guild_id;
|
|
}
|
|
obj = { guildId: null, location: null };
|
|
obj[0] = guild_id1;
|
|
obj[1] = ActivitySounds;
|
|
result = obj.isVibegrationsGuildEnabled(obj);
|
|
}
|
|
return result;
|
|
};
|
|
export const useIsVibegrationsChannelCandidate = function useIsVibegrationsChannelCandidate(channel, ChannelActions) {
|
|
const _require = channel;
|
|
let obj = _require(589);
|
|
const items = [closure_4];
|
|
const stateFromStores = obj.useStateFromStores(items, () => {
|
|
let guild_id;
|
|
if (guild_id != null) {
|
|
guild_id = guild_id.guild_id;
|
|
}
|
|
return closure_1_4.getGuild(guild_id);
|
|
});
|
|
let guild_id;
|
|
if (channel != null) {
|
|
guild_id = channel.guild_id;
|
|
}
|
|
obj = { guildId: guild_id, location: ChannelActions };
|
|
let tmp4 = null != channel;
|
|
const isVibegrationsGuildEnabled = _require(7253).useIsVibegrationsGuildEnabled(obj);
|
|
if (tmp4) {
|
|
tmp4 = channel.type === constants2.GUILD_TEXT;
|
|
}
|
|
if (tmp4) {
|
|
const topic = channel.topic;
|
|
let tmp6 = null;
|
|
if (null != topic) {
|
|
tmp6 = null;
|
|
if (topic.startsWith(c9)) {
|
|
const substr = topic.slice(28);
|
|
let tmp10 = null;
|
|
if (regex.test(substr)) {
|
|
tmp10 = substr;
|
|
}
|
|
tmp6 = tmp10;
|
|
}
|
|
}
|
|
tmp4 = null != tmp6;
|
|
}
|
|
if (tmp4) {
|
|
let hasItem;
|
|
if (stateFromStores != null) {
|
|
const features = stateFromStores.features;
|
|
hasItem = features.has(constants3.INTERNAL_EMPLOYEE_ONLY);
|
|
}
|
|
tmp4 = !hasItem;
|
|
}
|
|
if (tmp4) {
|
|
tmp4 = isVibegrationsGuildEnabled;
|
|
}
|
|
return tmp4;
|
|
};
|