Issue #1126 fix data initialization error

This commit is contained in:
Elizabeth Cray 2024-04-03 22:18:43 -04:00
parent 20241ade25
commit 1cafa029f0

View File

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