chore(Threads): general fixup and catch up on features (#5959)

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
This commit is contained in:
ckohen
2021-06-29 10:58:51 -07:00
committed by GitHub
parent 63a8df1c1f
commit bbc48fdad6
6 changed files with 43 additions and 22 deletions

View File

@@ -63,8 +63,8 @@ class ThreadManager extends BaseManager {
* A number that is allowed to be the duration in minutes before a thread is automatically archived. This can be:
* * `60` (1 hour)
* * `1440` (1 day)
* * `4320` (3 days)
* * `10080` (7 days)
* * `4320` (3 days) <warn>This is only available when the guild has the `THREE_DAY_THREAD_ARCHIVE` feature.</warn>
* * `10080` (7 days) <warn>This is only available when the guild has the `SEVEN_DAY_THREAD_ARCHIVE` feature.</warn>
* @typedef {number} ThreadAutoArchiveDuration
*/
@@ -76,8 +76,8 @@ class ThreadManager extends BaseManager {
* @property {ThreadAutoArchiveDuration} autoArchiveDuration How long before the thread is automatically archived
* @property {MessageResolvable} [startMessage] The message to start a public or news thread from,
* creates a private thread if not provided
* @property {ThreadChannelType|number} [type] The type of thread to create
* <warn>When creating threads in a `news` channel this is always `news_thread`</warn>
* @property {ThreadChannelType|number} [type='public_thread'] The type of thread to create
* <warn>When creating threads in a `news` channel this is ignored and is always `news_thread`</warn>
* @param {string} [reason] Reason for creating the thread
*/
@@ -89,16 +89,21 @@ class ThreadManager extends BaseManager {
* // Create a new public thread
* channel.threads
* .create({
* name: 'food-talk'
* name: 'food-talk',
* autoArchiveDuration: 60,
* startMessage: channel.lastMessageID,
* reason: 'Needed a separate thread for food',
* })
* .then(console.log)
* .catch(console.error);
* @example
* // Create a new private thread
* channel.threads
* .create({ name: 'mod-talk', autoArchiveDuration: 60, reason: 'Needed a separate thread for moderation' })
* .create({
* name: 'mod-talk',
* autoArchiveDuration: 60,
* type: 'private_thread',
* reason: 'Needed a separate thread for moderation',
* })
* .then(console.log)
* .catch(console.error);
*/
@@ -113,7 +118,7 @@ class ThreadManager extends BaseManager {
if (!startMessageID) throw new TypeError('INVALID_TYPE', 'startMessage', 'MessageResolvable');
path = path.messages(startMessageID);
} else if (this.channel.type !== 'news') {
resolvedType = typeof type === 'string' ? ChannelTypes[type.toUpperCase()] : type;
resolvedType = typeof type === 'string' ? ChannelTypes[type.toUpperCase()] : type ?? resolvedType;
}
const data = await path.threads.post({