diff --git a/rest/Endpoints.ts b/rest/Endpoints.ts index 8114a62..c560b91 100644 --- a/rest/Endpoints.ts +++ b/rest/Endpoints.ts @@ -363,6 +363,67 @@ export default class Endpoints { return `/guilds/${guildID}/templates/${code}`; } + // Threads + /** + * `/channels/:channelID/messages/:messageID/threads` + * - POST - Start Thread with Message + */ + public static START_THREAD_WITH_MESSAGE(channelID: string, messageID: string) { + return `/channels/${channelID}/messages/${messageID}/threads`; + } + /** + * `/channels/:channelID/threads` + * - POST - Start Thread without Message + */ + public static START_THREAD_WITHOUT_MESSAGE(channelID: string) { + return `/channels/${channelID}/threads`; + } + /** + * `/channels/:channelID/thread-members/@me` + * - PUT - Join Thread + * - DELETE - Leave Thread + */ + public static THREAD(channelID: string) { + return `/channels/${channelID}/thread-members/@me`; + } + /** + * `/channels/:channelID/thread-members/:userID` + * - PUT - Add Thread Member + * - DELETE - Remove Thread Member + */ + public static THREAD_MEMBER(channelID: string, userID: string) { + return `/channels/${channelID}/thread-members/${userID}`; + } + /** + * `/channels/:channelID/thread-members` + * - GET - List Thread Members + */ + public static LIST_THREAD_MEMBERS(channelID: string) { + return `/channels/${channelID}/thread-members`; + } + /** + * `/channels/:channelID/threads/active` + * - GET - List Active Threads + */ + public static LIST_ACTIVE_THREADS(channelID: string) { + return `/channels/${channelID}/threads/active`; + } + /** + * `/channels/:channelID}/threads/archived/public OR private` + * - GET & type = public - List Public Archived Threads + * - GET & type = private - List Private Archived Threads + */ + public static LIST_ARCHIVED_THREADS(channelID: string, type: 'public' | 'private') { + return `/channels/${channelID}/threads/archived/${type}`; + } + /** + * `/channels/:channelID/users/@me/threads/archived/private` + * - GET - List Joined Private Archived Threads + */ + public static LIST_JOINED_PRIVATE_ARCHIVED_THREADS(channelID: string) { + return `/channels/${channelID}/users/@me/threads/archived/private`; + } + // User /** * `/users/:userID` diff --git a/rest/RESTClient.ts b/rest/RESTClient.ts index 0a8285c..50b1ffa 100644 --- a/rest/RESTClient.ts +++ b/rest/RESTClient.ts @@ -9,7 +9,7 @@ import { REST_CONSTANTS } from '../src/util/Constants'; const { version, repository } = require('../../package.json'); export default class RESTClient { - version = 'v8'; + version = 'v9'; apiURL = `/api/${this.version}`;// eslint-disable-line @typescript-eslint/member-ordering readonly client: Client; globallyRateLimited = false; diff --git a/structures/Guild.ts b/structures/Guild.ts index 1ef28bf..2f70b18 100644 --- a/structures/Guild.ts +++ b/structures/Guild.ts @@ -42,6 +42,7 @@ export default interface Guild extends Base { splash: string | null; system_channel_flags: SystemChannelFlags; system_channel_id: string | null; + threads?: Channel[]; unavailable?: boolean; vanity_url_code: string | null; verification_level: VerificationLevel; diff --git a/ws/constants.ts b/ws/constants.ts index 1f1f355..2cb900a 100644 --- a/ws/constants.ts +++ b/ws/constants.ts @@ -31,6 +31,12 @@ export const EVENTS = { MESSAGE_REACTION_REMOVE_EMOJI: 'messageReactionRemoveEmoji', PRESENCE_UPDATE: 'presenceUpdate', TYPING_START: 'typingStart', + THREAD_CREATE: 'threadCreate', + THREAD_UPDATE: 'threadUpdate', + THREAD_DELETE: 'threadDelete', + THREAD_LIST_SYNC: 'threadListSync', + THREAD_MEMBER_UPDATE: 'threadMemberUpdate', + THREAD_MEMBERS_UPDATE: 'threadMembersUpdate', USER_UPDATE: 'userUpdate', VOICE_STATE_UPDATE: 'voiceStateUpdate', VOICE_SERVER_UPDATE: 'guildServerUpdate',