114 lines
3.8 KiB
TypeScript
114 lines
3.8 KiB
TypeScript
// Module ID: 16609
|
|
// Function ID: 16610
|
|
// Name: openVibegrationsPublishDestination
|
|
// Dependencies: [5118, 4507, 1377, 1085, 8704, 4903, 1112, 6845, 8994, 8986, 2]
|
|
// Exports: openVibegrationsProductionDm, openVibegrationsPublishDestination
|
|
|
|
// Module 16609 (openVibegrationsPublishDestination)
|
|
import Constants from "Constants" /* 1085 */;
|
|
import router_utils from "router_utils" /* 1112 */;
|
|
import ChannelActionCreatorsDefault from "ChannelActionCreators" /* 4903 */;
|
|
import transitionToGuild from "transitionToGuild" /* 6845 */;
|
|
import FramesConstants from "FramesConstants" /* 8704 */;
|
|
import FramesActionCreatorsDefault from "FramesActionCreators" /* 8986 */;
|
|
import canLaunchContextlessFrame from "canLaunchContextlessFrame" /* 8994 */;
|
|
import ApplicationStore from "ApplicationStore" /* 5118 */;
|
|
import GuildChannelStore from "GuildChannelStore" /* 4507 */;
|
|
import UserStore from "UserStore" /* 1377 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
const Routes = Constants.Routes;
|
|
const MAIN_SURFACE = FramesConstants.MAIN_SURFACE;
|
|
const result = size.fileFinishedImporting("modules/vibegrations/lib/openVibegrationsPublishDestination.tsx");
|
|
|
|
export const openVibegrationsProductionDm = function openVibegrationsProductionDm(arg0) {
|
|
const application = ApplicationStore.getApplication(arg0);
|
|
let recipientIds;
|
|
if (application != null) {
|
|
const bot = application.bot;
|
|
if (bot != null) {
|
|
recipientIds = bot.id;
|
|
}
|
|
}
|
|
if (recipientIds == null) {
|
|
recipientIds = arg0;
|
|
}
|
|
const obj = ChannelActionCreatorsDefault;
|
|
return obj.openPrivateChannel({ recipientIds });
|
|
};
|
|
export const openVibegrationsPublishDestination = function openVibegrationsPublishDestination(destination, arg1) {
|
|
let appChannelId;
|
|
let applicationId;
|
|
let guildId;
|
|
let openAutomodSettings;
|
|
({ applicationId, guildId, appChannelId, openAutomodSettings } = arg1);
|
|
if ("launch" === destination) {
|
|
const obj = canLaunchContextlessFrame;
|
|
if (obj.canLaunchContextlessFrame(ApplicationStore.getApplication(applicationId))) {
|
|
const obj6 = { applicationId, surface: MAIN_SURFACE };
|
|
const obj5 = FramesActionCreatorsDefault;
|
|
const launchFrameResult = obj5.launchFrame(obj6);
|
|
launchFrameResult.catch(() => {
|
|
|
|
});
|
|
return Promise.resolve();
|
|
}
|
|
} else if ("profile" === destination) {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
let id;
|
|
if (currentUser != null) {
|
|
id = currentUser.id;
|
|
}
|
|
if (null != id) {
|
|
tmp(id);
|
|
return Promise.resolve();
|
|
}
|
|
} else if ("channel" === destination) {
|
|
if (null != guildId) {
|
|
if (null != appChannelId) {
|
|
const obj7 = router_utils;
|
|
obj7.transitionTo(Routes.CHANNEL(guildId, appChannelId));
|
|
return Promise.resolve();
|
|
}
|
|
}
|
|
} else if ("automod" === destination) {
|
|
if (null != guildId) {
|
|
if (null != openAutomodSettings) {
|
|
openAutomodSettings(guildId);
|
|
return Promise.resolve();
|
|
}
|
|
}
|
|
}
|
|
if ("dm" !== destination) {
|
|
let resolved;
|
|
if (null != guildId) {
|
|
const defaultChannel = GuildChannelStore.getDefaultChannel(guildId);
|
|
let id1;
|
|
if (defaultChannel != null) {
|
|
id1 = defaultChannel.id;
|
|
}
|
|
if (null == id1) {
|
|
const obj4 = transitionToGuild;
|
|
obj4.transitionToGuild(guildId);
|
|
} else {
|
|
const obj3 = router_utils;
|
|
obj3.transitionTo(Routes.CHANNEL(guildId, id1));
|
|
}
|
|
resolved = Promise.resolve();
|
|
}
|
|
return resolved;
|
|
}
|
|
const application = ApplicationStore.getApplication(applicationId);
|
|
let id2;
|
|
if (application != null) {
|
|
const bot = application.bot;
|
|
if (bot != null) {
|
|
id2 = bot.id;
|
|
}
|
|
}
|
|
if (id2 == null) {
|
|
id2 = applicationId;
|
|
}
|
|
const obj2 = ChannelActionCreatorsDefault;
|
|
resolved = obj2.openPrivateChannel({ recipientIds: id2 });
|
|
};
|