/** @module Routes/Channels */ import type { AddGroupRecipientOptions, AnyChannel, AnyTextChannelWithoutGroup, ArchivedThreads, CreateInviteOptions, CreateMessageOptions, EditChannelOptions, EditMessageOptions, EditPermissionOptions, FollowedChannel, GetChannelMessagesOptions, GetArchivedThreadsOptions, GetReactionsOptions, InviteChannel, ThreadMember, StartThreadFromMessageOptions, StartThreadInForumOptions, StartThreadWithoutMessageOptions, GetInviteWithCountsAndExpirationOptions, GetInviteWithCountsOptions, GetInviteWithExpirationOptions, GetInviteWithNoneOptions, InviteInfoTypes, AnyEditableChannel, PartialInviteChannel, PurgeOptions, AnyGuildTextChannel } from "../types/channels"; import Message from "../structures/Message"; import type { CreateGroupChannelOptions } from "../types/users"; import Invite from "../structures/Invite"; import type AnnouncementThreadChannel from "../structures/AnnouncementThreadChannel"; import type PublicThreadChannel from "../structures/PublicThreadChannel"; import type PrivateThreadChannel from "../structures/PrivateThreadChannel"; import type AnnouncementChannel from "../structures/AnnouncementChannel"; import type { VoiceRegion } from "../types/voice"; import type RESTManager from "../rest/RESTManager"; import type PrivateChannel from "../structures/PrivateChannel"; import type GroupChannel from "../structures/GroupChannel"; import type User from "../structures/User"; import type { Uncached } from "../types/shared"; import type { CreateStageInstanceOptions, EditStageInstanceOptions } from "../types/guilds"; import StageInstance from "../structures/StageInstance"; /** Various methods for interacting with channels. */ export default class Channels { #private; constructor(manager: RESTManager); /** * Add a user to a group channel. * @param groupID The ID of the group to add the user to. * @param options The options for adding the recipient. */ addGroupRecipient(groupID: string, options: AddGroupRecipientOptions): Promise; /** * Add a member to a thread. * @param channelID The ID of the thread to add them to. * @param userID The ID of the user to add to the thread. */ addThreadMember(channelID: string, userID: string): Promise; /** * Create a direct message. This will not create a new channel if you have already started a dm with the user. * @param recipient The ID of the recipient of the direct message. */ createDM(recipient: string): Promise; /** * Create a group dm. * @param options The options for creating the group dm. */ createGroupDM(options: CreateGroupChannelOptions): Promise; /** * Create an invite for a channel. * @param channelID The ID of the channel to create an invite for. * @param options The options for creating the invite. */ createInvite(channelID: string, options: CreateInviteOptions): Promise>; /** * Create a message in a channel. * @param channelID The ID of the channel to create the message in. * @param options The options for creating the message. */ createMessage(channelID: string, options: CreateMessageOptions): Promise>; /** * Add a reaction to a message. * @param channelID The ID of the channel the message is in. * @param messageID The ID of the message to add a reaction to. * @param emoji The reaction to add to the message. `name:id` for custom emojis, and the unicode codepoint for default emojis. */ createReaction(channelID: string, messageID: string, emoji: string): Promise; /** * Create a stage instance. * @param channelID The ID of the channel to create the stage instance on. * @param options The options for creating the stage instance. */ createStageInstance(channelID: string, options: CreateStageInstanceOptions): Promise; /** * Crosspost a message in an announcement channel. * @param channelID The ID of the channel to crosspost the message in. * @param messageID The ID of the message to crosspost. */ crosspostMessage(channelID: string, messageID: string): Promise>; /** * Delete or close a channel. * @param channelID The ID of the channel to delete or close. * @param reason The reason to be displayed in the audit log. */ delete(channelID: string, reason?: string): Promise; /** * Delete an invite. * @param code The code of the invite to delete. * @param reason The reason for deleting the invite. */ deleteInvite(code: string, reason?: string): Promise>; /** * Delete a message. * @param channelID The ID of the channel to delete the message in. * @param messageID The ID of the message to delete. * @param reason The reason for deleting the message. */ deleteMessage(channelID: string, messageID: string, reason?: string): Promise; /** * Bulk delete messages. * @param channelID The ID of the channel to delete the messages in. * @param messageIDs The IDs of the messages to delete. Any duplicates or messages older than two weeks will cause an error. * @param reason The reason for deleting the messages. */ deleteMessages(channelID: string, messageIDs: Array, reason?: string): Promise; /** * Delete a permission overwrite. * @param channelID The ID of the channel to delete the permission overwrite in. * @param overwriteID The ID of the permission overwrite to delete. * @param reason The reason for deleting the permission overwrite. */ deletePermission(channelID: string, overwriteID: string, reason?: string): Promise; /** * Remove a reaction from a message. * @param channelID The ID of the channel the message is in. * @param messageID The ID of the message to remove a reaction from. * @param emoji The reaction to remove from the message. `name:id` for custom emojis, and the unicode codepoint for default emojis. * @param user The user to remove the reaction from, `@me` for the current user (default). */ deleteReaction(channelID: string, messageID: string, emoji: string, user?: string): Promise; /** * Remove all, or a specific emoji's reactions from a message. * @param channelID The ID of the channel the message is in. * @param messageID The ID of the message to remove reactions from. * @param emoji The reaction to remove from the message. `name:id` for custom emojis, and the unicode codepoint for default emojis. Omit to remove all reactions. */ deleteReactions(channelID: string, messageID: string, emoji?: string): Promise; /** * Delete a stage instance. * @param channelID The ID of the channel to delete the stage instance on. * @param reason The reason for deleting the stage instance. */ deleteStageInstance(channelID: string, reason?: string): Promise; /** * Edit a channel. * @param channelID The ID of the channel to edit. * @param options The options for editing the channel. */ edit(channelID: string, options: EditChannelOptions): Promise; /** * Edit a message. * @param channelID The ID of the channel the message is in. * @param messageID The ID of the message to edit. * @param options The options for editing the message. */ editMessage(channelID: string, messageID: string, options: EditMessageOptions): Promise>; /** * Edit a permission overwrite. * @param channelID The ID of the channel to edit the permission overwrite for. * @param overwriteID The ID of the permission overwrite to edit. * @param options The options for editing the permission overwrite. */ editPermission(channelID: string, overwriteID: string, options: EditPermissionOptions): Promise; /** * Edit a stage instance. * @param channelID The ID of the channel to edit the stage instance on. * @param options The options for editing the stage instance. */ editStageInstance(channelID: string, options: EditStageInstanceOptions): Promise; /** * Follow an announcement channel. * @param channelID The ID of the channel to follow the announcement channel to. * @param webhookChannelID The ID of the channel to follow the announcement channel to. */ followAnnouncement(channelID: string, webhookChannelID: string): Promise; /** * Get a channel. * @param channelID The ID of the channel to get. */ get(channelID: string): Promise; /** * Get an invite. * @param code The code of the invite to get. * @param options The options for getting the invite. */ getInvite(code: string, options: GetInviteWithNoneOptions): Promise>; getInvite(code: string, options: GetInviteWithCountsAndExpirationOptions): Promise>; getInvite(code: string, options: GetInviteWithCountsOptions): Promise>; getInvite(code: string, options: GetInviteWithExpirationOptions): Promise>; /** * Get the invites of a channel. * @param channelID The ID of the channel to get the invites of. */ getInvites(channelID: string): Promise>>; /** * Get the private archived threads the current user has joined in a channel. * @param channelID The ID of the channel to get the archived threads from. * @param options The options for getting the archived threads. */ getJoinedPrivateArchivedThreads(channelID: string, options?: GetArchivedThreadsOptions): Promise>; /** * Get a message in a channel. * @param channelID The ID of the channel the message is in * @param messageID The ID of the message to get. */ getMessage(channelID: string, messageID: string): Promise>; /** * Get messages in a channel. * @param channelID The ID of the channel to get messages from. * @param options The options for getting messages. `before`, `after`, and `around `All are mutually exclusive. */ getMessages(channelID: string, options?: GetChannelMessagesOptions): Promise>>; /** * Get the pinned messages in a channel. * @param channelID The ID of the channel to get the pinned messages from. */ getPinnedMessages(channelID: string): Promise>>; /** * Get the private archived threads in a channel. * @param channelID The ID of the channel to get the archived threads from. * @param options The options for getting the archived threads. */ getPrivateArchivedThreads(channelID: string, options?: GetArchivedThreadsOptions): Promise>; /** * Get the public archived threads in a channel. * @param channelID The ID of the channel to get the archived threads from. * @param options The options for getting the archived threads. */ getPublicArchivedThreads(channelID: string, options?: GetArchivedThreadsOptions): Promise>; /** * Get the users who reacted with a specific emoji on a message. * @param channelID The ID of the channel the message is in. * @param messageID The ID of the message to get reactions from. * @param emoji The reaction to remove from the message. `name:id` for custom emojis, and the unicode codepoint for default emojis. * @param options The options for getting the reactions. */ getReactions(channelID: string, messageID: string, emoji: string, options?: GetReactionsOptions): Promise>; /** * Get the stage instance associated with a channel. * @param channelID The ID of the channel to get the stage instance on. */ getStageInstance(channelID: string): Promise; /** * Get a thread member. * @param channelID The ID of the thread. * @param userID The ID of the user to get the thread member of. */ getThreadMember(channelID: string, userID: string): Promise; /** * Get the members of a thread. * @param channelID The ID of the thread. */ getThreadMembers(channelID: string): Promise>; /** @deprecated Get the list of usable voice regions. Moved to `misc`. */ getVoiceRegions(): Promise>; /** * Join a thread. * @param channelID The ID of the thread to join. */ joinThread(channelID: string): Promise; /** * Leave a thread. * @param channelID The ID of the thread to leave. */ leaveThread(channelID: string): Promise; /** * Pin a message in a channel. * @param channelID The ID of the channel to pin the message in. * @param messageID The ID of the message to pin. * @param reason The reason for pinning the message. */ pinMessage(channelID: string, messageID: string, reason?: string): Promise; /** * Purge an amount of messages from a channel. * @param channelID The ID of the channel to purge. * @param options The options to purge. `before`, `after`, and `around `All are mutually exclusive. */ purgeMessages(channelID: string, options: PurgeOptions): Promise; /** * Remove a user from the group channel. * @param groupID The ID of the group to remove the user from. * @param userID The ID of the user to remove. */ removeGroupRecipient(groupID: string, userID: string): Promise; /** * Remove a member from a thread. * @param channelID The ID of the thread to remove them from. * @param userID The ID of the user to remove from the thread. */ removeThreadMember(channelID: string, userID: string): Promise; /** * Show a typing indicator in a channel. How long users see this varies from client to client. * @param channelID The ID of the channel to show the typing indicator in. */ sendTyping(channelID: string): Promise; /** * Create a thread from an existing message. * @param channelID The ID of the channel to create the thread in. * @param messageID The ID of the message to create the thread from. * @param options The options for starting the thread. */ startThreadFromMessage(channelID: string, messageID: string, options: StartThreadFromMessageOptions): Promise; /** * Create a thread in a forum channel. * @param channelID The ID of the channel to start the thread in. * @param options The options for starting the thread. */ startThreadInForum(channelID: string, options: StartThreadInForumOptions): Promise; /** * Create a thread without an existing message. * @param channelID The ID of the channel to start the thread in. * @param options The options for starting the thread. */ startThreadWithoutMessage(channelID: string, options: StartThreadWithoutMessageOptions): Promise; /** * Unpin a message in a channel. * @param channelID The ID of the channel to unpin the message in. * @param messageID The ID of the message to unpin. * @param reason The reason for unpinning the message. */ unpinMessage(channelID: string, messageID: string, reason?: string): Promise; }