Merge pull request #1127 from sciencegirl100/main

Issue #1126 fix `data` initialization error
This commit is contained in:
Elysia
2024-04-04 11:48:31 +07:00
committed by GitHub

View File

@@ -85,23 +85,23 @@ class GuildForumThreadManager extends ThreadManager {
});
const attachmentsData = await Promise.all(requestPromises);
attachmentsData.sort((a, b) => parseInt(a.id) - parseInt(b.id));
data.attachments = attachmentsData;
if (autoArchiveDuration === 'MAX') autoArchiveDuration = resolveAutoArchiveMaxLimit(this.channel.guild);
const data = await this.client.api.channels(this.channel.id).threads.post({
const post_data = await this.client.api.channels(this.channel.id).threads.post({
data: {
name,
auto_archive_duration: autoArchiveDuration,
rate_limit_per_user: rateLimitPerUser,
applied_tags: appliedTags,
message: body,
attachments: attachmentsData,
},
files: [],
reason,
});
return this.client.actions.ThreadCreate.handle(data).thread;
return this.client.actions.ThreadCreate.handle(post_data).thread;
}
}