decord/alpha/source/actions/CreateChannelActionCreators.tsx

183 lines
6.3 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 8602
// Function ID: 8603
// Name: CreateChannelActionCreators
2026-10-12 06:59:38 +00:00
// Dependencies: [5966, 1085, 1095, 584, 5938, 1273, 2077, 1295, 6809, 6804, 7028, 2]
2026-07-20 16:05:17 +00:00
2026-10-12 06:59:38 +00:00
// Module 8602 (CreateChannelActionCreators)
2026-10-03 08:58:59 +00:00
import UserSettingsConstants from "UserSettingsConstants" /* 1095 */;
2026-10-09 10:00:15 +00:00
import discord_common_AnalyticsUtils from "discord_common/AnalyticsUtils" /* 1273 */;
import HTTPUtils from "HTTPUtils" /* 1295 */;
2026-10-10 08:08:14 +00:00
import TypeUtils from "TypeUtils" /* 2077 */;
import TrackedHTTPUtilsDefault from "TrackedHTTPUtils" /* 5938 */;
2026-10-12 06:59:38 +00:00
import NotificationSettingsUtils from "NotificationSettingsUtils" /* 6804 */;
import NotificationSettingsModalActionCreatorsDefault from "NotificationSettingsModalActionCreators" /* 6809 */;
import GuildTemplateTooltipActionCreatorsDefault from "GuildTemplateTooltipActionCreators" /* 7028 */;
2026-10-10 08:08:14 +00:00
import UserGuildSettingsStore from "UserGuildSettingsStore" /* 5966 */;
2026-10-03 08:58:59 +00:00
import Constants from "Constants" /* 1085 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let closure_4;
let hasOwnProperty;
let metroRequire;
({ BITRATE_DEFAULT: closure_4, ChannelTypes: hasOwnProperty, Endpoints: metroRequire } = Constants);
2026-10-03 08:58:59 +00:00
let closure_7 = UserSettingsConstants.ChannelNotificationSettingsFlags;
let obj = {
2026-07-20 16:05:17 +00:00
createChannel(guildId) {
2026-10-03 08:58:59 +00:00
let applicationId;
let availableTags;
let bitrate;
let flags;
let gameId;
let obj3;
let obj5;
let parentId;
let permissionOverwrites;
let skuId;
let type;
let userLimit;
2026-07-20 16:05:17 +00:00
guildId = guildId.guildId;
({ type, permissionOverwrites } = guildId);
2026-10-03 08:58:59 +00:00
const name = guildId.name;
2026-07-20 16:05:17 +00:00
if (permissionOverwrites === undefined) {
permissionOverwrites = [];
}
2026-09-02 09:53:35 +00:00
({ bitrate, userLimit, parentId, skuId, applicationId, flags, availableTags, gameId } = guildId);
2026-10-03 08:58:59 +00:00
const branchId = guildId.branchId;
const tmp = permissionOverwrites;
let obj = permissionOverwrites(584);
obj.dispatch({ type: "CREATE_CHANNEL_MODAL_SUBMIT", guildId, channelType: type });
let obj2 = { type, name, permission_overwrites: permissionOverwrites };
2026-07-29 08:29:29 +00:00
let tmp4 = null != bitrate;
if (tmp4) {
tmp4 = bitrate !== closure_4;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp4) {
obj2.bitrate = bitrate;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const tmp6 = null != userLimit && userLimit > 0;
2026-07-29 08:29:29 +00:00
if (tmp6) {
obj2.user_limit = userLimit;
2026-07-20 16:05:17 +00:00
}
if (null != parentId) {
obj2.parent_id = parentId;
2026-07-20 16:05:17 +00:00
}
if (null != flags) {
obj2.flags = flags;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const tmp7 = null != availableTags && availableTags.length > 0;
2026-07-29 08:29:29 +00:00
if (tmp7) {
obj2.available_tags = availableTags.map((name) => ({ name: name.name, emoji_id: name.emojiId, emoji_name: name.emojiName, moderated: name.moderated }));
2026-07-20 16:05:17 +00:00
}
2026-08-07 06:50:47 +00:00
if (null != gameId) {
obj2.game_id = gameId;
2026-08-07 06:50:47 +00:00
}
2026-10-03 08:58:59 +00:00
const tmp8 = constants;
2026-07-20 16:05:17 +00:00
if (type === constants.GUILD_STORE) {
if (null == skuId) {
2026-09-02 09:53:35 +00:00
const _Error2 = Error;
2026-10-03 08:58:59 +00:00
const self3 = this;
const self4 = this;
const error = new Error("Unexpected missing SKU");
2026-07-20 16:05:17 +00:00
throw error;
} else {
obj2.sku_id = skuId;
2026-10-03 08:58:59 +00:00
obj2.branch_id = branchId;
2026-07-20 16:05:17 +00:00
}
}
2026-09-02 09:53:35 +00:00
if (type === tmp8.GUILD_APP) {
if (null == applicationId) {
const _Error = Error;
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
2026-09-02 09:53:35 +00:00
const error1 = new Error("Unexpected missing application");
throw error1;
} else {
obj2.application_id = applicationId;
2026-09-02 09:53:35 +00:00
}
}
2026-10-10 08:08:14 +00:00
const tmpResult = tmp(5938);
2026-10-03 08:58:59 +00:00
const request = { url: closure_6.GUILD_CHANNELS(guildId), body: obj2, oldFormErrors: true, trackedActionData: obj3, rejectWithError: obj5.rejectWithMigratedError() };
const post = tmpResult.post;
obj3 = {
2026-10-09 10:00:15 +00:00
event: guildId(1273).NetworkActionNames.CHANNEL_CREATE,
2026-07-20 16:05:17 +00:00
properties(body) {
let id;
let type;
2026-10-03 08:58:59 +00:00
const obj = { is_private: permissionOverwrites.length > 0, channel_id: id, channel_type: type };
id = undefined;
const exact = TypeUtils.exact;
TypeUtils;
2026-07-29 08:29:29 +00:00
if (body != null) {
2026-07-20 16:05:17 +00:00
body = body.body;
2026-07-29 08:29:29 +00:00
if (body != null) {
2026-07-20 16:05:17 +00:00
id = body.id;
}
}
2026-10-03 08:58:59 +00:00
type = undefined;
2026-07-29 08:29:29 +00:00
if (body != null) {
2026-07-20 16:05:17 +00:00
const body2 = body.body;
2026-07-29 08:29:29 +00:00
if (body2 != null) {
2026-07-20 16:05:17 +00:00
type = body2.type;
}
}
2026-10-03 08:58:59 +00:00
return exact(obj);
2026-07-20 16:05:17 +00:00
}
};
2026-10-09 10:00:15 +00:00
obj5 = guildId(1295);
2026-10-03 08:58:59 +00:00
const postResult = post(request);
return postResult.then((body) => {
let obj2;
if (UserGuildSettingsStore.isOptInEnabled(guildId)) {
2026-10-03 08:58:59 +00:00
const obj = { guildId, channelId: body.body.id, settings: obj2, label: NotificationSettingsUtils.NotificationLabels.OptedIn };
obj2 = { flags: constants.OPT_IN_ENABLED };
const updateChannelOverrideSettings = NotificationSettingsModalActionCreatorsDefault.updateChannelOverrideSettings;
NotificationSettingsModalActionCreatorsDefault;
const result = updateChannelOverrideSettings(obj);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const obj3 = GuildTemplateTooltipActionCreatorsDefault;
const result1 = obj3.checkGuildTemplateDirty(tmp);
2026-07-20 16:05:17 +00:00
return body;
}, (body) => {
2026-10-03 08:58:59 +00:00
const obj = permissionOverwrites(dependencyMap[3]);
const obj2 = { type: "CREATE_CHANNEL_MODAL_SUBMIT_FAILURE", errors: body.body };
obj.dispatch(obj2);
2026-07-20 16:05:17 +00:00
throw body;
});
},
createRoleSubscriptionTemplateChannel(guildId, name, type, topic) {
2026-10-03 08:58:59 +00:00
let obj;
let obj4;
function properties(body) {
let type;
let id;
const exact = TypeUtils.exact;
TypeUtils;
if (body != null) {
body = body.body;
2026-07-29 08:29:29 +00:00
if (body != null) {
2026-10-03 08:58:59 +00:00
id = body.id;
2026-07-20 16:05:17 +00:00
}
}
2026-10-03 08:58:59 +00:00
const obj = { is_private: true, channel_id: id, channel_type: type };
type = undefined;
if (body != null) {
const body2 = body.body;
if (body2 != null) {
type = body2.type;
2026-07-20 16:05:17 +00:00
}
}
2026-10-03 08:58:59 +00:00
return exact(obj);
}
const tmp = TrackedHTTPUtilsDefault;
const request = { url: metroRequire.GUILD_CHANNELS(guildId), body: obj, oldFormErrors: true, trackedActionData: { event: discord_common_AnalyticsUtils.NetworkActionNames.CHANNEL_CREATE, properties }, rejectWithError: obj4.rejectWithMigratedError() };
const post = tmp.post;
obj = { name, type, topic };
({ event: discord_common_AnalyticsUtils.NetworkActionNames.CHANNEL_CREATE, properties });
obj4 = HTTPUtils;
return post(request);
2026-07-20 16:05:17 +00:00
}
};
2026-10-03 08:58:59 +00:00
let result = size.fileFinishedImporting("actions/CreateChannelActionCreators.tsx");
export default obj;