From a3799f9ebb027904830457119708d550e2009200 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Wed, 22 Jun 2022 10:23:39 +0100 Subject: [PATCH] types: Use `ThreadAutoArchiveDuration` from discord-api-types (#8145) --- packages/discord.js/src/structures/Message.js | 12 +----------- packages/discord.js/src/structures/ThreadChannel.js | 4 ++-- packages/discord.js/src/util/APITypes.js | 5 +++++ packages/discord.js/typings/index.d.ts | 3 +-- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/packages/discord.js/src/structures/Message.js b/packages/discord.js/src/structures/Message.js index c54b5c32a953..fe2347bc8f4b 100644 --- a/packages/discord.js/src/structures/Message.js +++ b/packages/discord.js/src/structures/Message.js @@ -793,22 +793,12 @@ class Message extends Base { return this.channel.send(data); } - /** - * A number that is allowed to be the duration (in minutes) of inactivity after which a thread is automatically - * archived. This can be: - * * `60` (1 hour) - * * `1440` (1 day) - * * `4320` (3 days) - * * `10080` (7 days) - * @typedef {number|string} ThreadAutoArchiveDuration - */ - /** * Options for starting a thread on a message. * @typedef {Object} StartThreadOptions * @property {string} name The name of the new thread * @property {ThreadAutoArchiveDuration} [autoArchiveDuration=this.channel.defaultAutoArchiveDuration] The amount of - * time (in minutes) after which the thread should automatically archive in case of no recent activity + * time after which the thread should automatically archive in case of no recent activity * @property {string} [reason] Reason for creating the thread * @property {number} [rateLimitPerUser] The rate limit per user (slowmode) for the thread in seconds */ diff --git a/packages/discord.js/src/structures/ThreadChannel.js b/packages/discord.js/src/structures/ThreadChannel.js index df0ae0ad0224..c7c429367672 100644 --- a/packages/discord.js/src/structures/ThreadChannel.js +++ b/packages/discord.js/src/structures/ThreadChannel.js @@ -292,7 +292,7 @@ class ThreadChannel extends Channel { * @typedef {Object} ThreadEditData * @property {string} [name] The new name for the thread * @property {boolean} [archived] Whether the thread is archived - * @property {ThreadAutoArchiveDuration} [autoArchiveDuration] The amount of time (in minutes) after which the thread + * @property {ThreadAutoArchiveDuration} [autoArchiveDuration] The amount of time after which the thread * should automatically archive in case of no recent activity * @property {number} [rateLimitPerUser] The rate limit per user (slowmode) for the thread in seconds * @property {boolean} [locked] Whether the thread is locked @@ -344,7 +344,7 @@ class ThreadChannel extends Channel { /** * Sets the duration after which the thread will automatically archive in case of no recent activity. - * @param {ThreadAutoArchiveDuration} autoArchiveDuration The amount of time (in minutes) after which the thread + * @param {ThreadAutoArchiveDuration} autoArchiveDuration The amount of time after which the thread * should automatically archive in case of no recent activity * @param {string} [reason] Reason for changing the auto archive duration * @returns {Promise} diff --git a/packages/discord.js/src/util/APITypes.js b/packages/discord.js/src/util/APITypes.js index bf48fcfc5bfa..45634bf3f1e5 100644 --- a/packages/discord.js/src/util/APITypes.js +++ b/packages/discord.js/src/util/APITypes.js @@ -338,6 +338,11 @@ * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/TextInputStyle} */ +/** + * @external ThreadAutoArchiveDuration + * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ThreadAutoArchiveDuration} + */ + /** * @external UserFlags * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/UserFlags} diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 7fd47174df74..8fa5126b647d 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -120,6 +120,7 @@ import { MessageActivityType, APIAttachment, APIChannel, + ThreadAutoArchiveDuration, } from 'discord-api-types/v10'; import { ChildProcess } from 'node:child_process'; import { EventEmitter } from 'node:events'; @@ -5409,8 +5410,6 @@ export type TextChannelResolvable = Snowflake | TextChannel; export type TextBasedChannelResolvable = Snowflake | TextBasedChannel; -export type ThreadAutoArchiveDuration = 60 | 1440 | 4320 | 10080; - export type ThreadChannelResolvable = AnyThreadChannel | Snowflake; export type ThreadChannelType =