decord/source/modules/threads/native/useCreateThread.tsx

127 lines
4.6 KiB
TypeScript
Raw Normal View History

2026-09-02 09:53:35 +00:00
// Module ID: 10354
// Function ID: 10355
2026-07-20 16:05:17 +00:00
// Name: useCreateThread
2026-09-02 09:53:35 +00:00
// Dependencies: [5, 19, 4854, 4471, 5961, 8169, 7210, 7436, 8173, 8171, 7593, 5131, 5086, 8174, 2]
2026-07-20 16:05:17 +00:00
// Exports: default, useCreateForumPost
2026-09-02 09:53:35 +00:00
// Module 10354 (useCreateThread)
import contextDefault from "context" /* 5961 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "noop" /* 19 */;
2026-09-01 10:26:29 +00:00
import { DraftType } from "handleChanged" /* 4854 */;
import { MessageSendLocation } from "MESSAGE_GROUP_SPACING" /* 4471 */;
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/threads/native/useCreateThread.tsx");
2026-07-20 16:05:17 +00:00
export default function useCreateThread(arg0) {
2026-07-29 08:29:29 +00:00
let analyticsLocations;
2026-07-20 16:05:17 +00:00
({ parentChannel, parentMessageId, threadSettings, privateThreadMode, location: _location, onThreadCreated, useDefaultThreadName } = arg0);
2026-08-24 06:08:38 +00:00
analyticsLocations = contextDefault().analyticsLocations;
2026-09-02 09:53:35 +00:00
let obj = analyticsLocations(8169);
2026-07-20 16:05:17 +00:00
obj = {
parentChannel,
parentMessageId,
threadSettings,
privateThreadMode,
location: _location,
onThreadCreated,
useDefaultThreadName,
uploadHandler(id, attachmentsToUpload) {
2026-08-24 06:08:38 +00:00
closure_0 = id;
closure_1 = attachmentsToUpload;
let obj = closure_1_1(closure_1_2[6]);
2026-07-20 16:05:17 +00:00
obj = {
2026-08-24 06:08:38 +00:00
location: closure_1_6.THREAD_CREATION,
2026-07-20 16:05:17 +00:00
attachmentsToUpload,
onAttachmentUploadError(file, code, reason) {
2026-08-24 06:08:38 +00:00
let obj = analyticsLocations(closure_2_2[8]);
2026-07-23 10:11:24 +00:00
obj = { file, guildId: guildId.getGuildId(), analyticsLocations: guildId, code, reason };
2026-07-20 16:05:17 +00:00
if (obj.handleUploadMessageAttachmentsErrors(obj)) {
2026-07-29 08:29:29 +00:00
obj = { channelId: null, uploads: null, draftType: null, resetState: true };
obj[0] = guildId.id;
obj[1] = closure_1;
2026-08-24 06:08:38 +00:00
obj[2] = closure_2_5.FirstThreadMessage;
closure_2_1(closure_2_2[9]).setUploads(obj);
const obj3 = closure_2_1(closure_2_2[9]);
2026-07-20 16:05:17 +00:00
}
}
};
2026-08-24 06:08:38 +00:00
obj.sendMessage(id.id, closure_1_1(closure_1_2[7]).parse(id, arg2), undefined, obj);
2026-07-20 16:05:17 +00:00
}
};
return obj.useCreateThreadCommon(obj);
};
export const useCreateForumPost = function useCreateForumPost(parentChannel) {
parentChannel = parentChannel.parentChannel;
2026-07-29 08:29:29 +00:00
let _require = parentChannel;
2026-07-20 16:05:17 +00:00
const threadSettings = parentChannel.threadSettings;
2026-07-29 08:29:29 +00:00
let analyticsLocations;
2026-07-20 16:05:17 +00:00
({ appliedTags, onThreadCreated } = parentChannel);
2026-09-02 09:53:35 +00:00
analyticsLocations = analyticsLocations(5961)().analyticsLocations;
2026-07-29 08:29:29 +00:00
_require = undefined;
_require = callback((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c2 = 0;
c3 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0) {
2026-08-04 21:03:28 +00:00
let obj7 = tmp4;
2026-08-24 06:08:38 +00:00
obj7 = new analyticsLocations(closure_2_2[10])();
const kestrelConfig = guildId(closure_2_2[11]).getKestrelConfig({ location: "native.useCreateForumPost" });
const obj8 = guildId(closure_2_2[11]);
const maxFileSizeResult = guildId(closure_2_2[12]).maxFileSize(guildId.getGuildId());
const obj9 = guildId(closure_2_2[12]);
2026-08-04 21:03:28 +00:00
obj7.on("progress", (currentSize) => {
if (currentSize.currentSize > c3) {
obj7.cancel();
2026-09-02 09:53:35 +00:00
let obj = closure_2_1(8171);
2026-08-04 21:03:28 +00:00
obj = { channelId: null, uploads: null, draftType: null, resetState: true };
obj[0] = guildId.id;
obj[1] = guildId;
2026-08-24 06:08:38 +00:00
obj[2] = closure_2_5.FirstThreadMessage;
2026-08-04 21:03:28 +00:00
obj.setUploads(obj);
obj = { file: null, maxSize: null, baseMaxSize: null, guildId: null, analyticsLocations: null };
obj[0] = currentSize;
obj[1] = tmp;
obj[2] = dependencyMap;
obj[3] = guildId.getGuildId();
obj[4] = obj7;
2026-09-02 09:53:35 +00:00
closure_2_1(8174)(obj);
const tmp10 = closure_2_1(8174);
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
});
2026-08-24 06:08:38 +00:00
closure_4 = yield obj7.uploadFiles(guildId);
2026-08-04 21:03:28 +00:00
let obj = { uploaderFile: null, files: null };
obj[0] = obj7._file;
2026-08-24 06:08:38 +00:00
obj[1] = closure_4;
2026-08-04 21:03:28 +00:00
return obj;
2026-07-29 08:29:29 +00:00
})();
});
2026-07-20 16:05:17 +00:00
const items = [analyticsLocations, parentChannel];
2026-07-29 08:29:29 +00:00
callback = React.useCallback(function() {
const self = this;
const apply = closure_0.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
}, items);
2026-09-02 09:53:35 +00:00
let obj = _require(8169);
2026-07-29 08:29:29 +00:00
obj = { parentChannel, name: null, appliedTags: null, analyticsLocations: null, onThreadCreated: null, upload: null };
let str;
if (threadSettings != null) {
str = threadSettings.name;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (str == null) {
str = "";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = str;
obj[2] = appliedTags;
obj[3] = analyticsLocations;
obj[4] = onThreadCreated;
obj[5] = callback;
2026-07-20 16:05:17 +00:00
return obj.useCreateForumPostCommon(obj);
};