diff --git a/packages/rest/src/manager.ts b/packages/rest/src/manager.ts index bd7d26981..984d8f6ac 100644 --- a/packages/rest/src/manager.ts +++ b/packages/rest/src/manager.ts @@ -16,6 +16,7 @@ import type { CreateGuild, CreateGuildChannel, CreateGuildEmoji, + CreateGuildFromTemplate, CreateGuildRole, CreateGuildStickerOptions, CreateMessageOptions, @@ -922,622 +923,6 @@ export function createRestManager(options: CreateRestManagerOptions): RestManage return camelize(await rest.makeRequest('PUT', url, body, options)) as Camelize }, - channels: { - messages: { - async delete(channelId, messageId, reason?) { - return await rest.deleteMessage(channelId, messageId, reason) - }, - async edit(channelId, messageId, options) { - return await rest.editMessage(channelId, messageId, options) - }, - - async send(channelId, options) { - return await rest.sendMessage(channelId, options) - }, - - async publish(channelId, messageId) { - return await rest.publishMessage(channelId, messageId) - }, - - reactions: { - async add(channelId, messageId, reaction) { - return await rest.addReaction(channelId, messageId, reaction) - }, - - async bulk(channelId, messageId, reactions, ordered) { - return await rest.addReactions(channelId, messageId, reactions, ordered) - }, - }, - }, - - async get(id) { - return await rest.getChannel(id) - }, - - async create(guildId, options) { - return await rest.createChannel(guildId, options) - }, - - async delete(id, reason) { - return await rest.deleteChannel(id, reason) - }, - - async edit(id, options) { - return await rest.editChannel(id, options) - }, - - async follow(sourceChannelId, targetChannelId) { - return await rest.followAnnouncement(sourceChannelId, targetChannelId) - }, - - forums: { - async post(channelId, options) { - return await rest.createForumThread(channelId, options) - }, - }, - - permissions: { - async edit(channelId, options) { - return await rest.editChannelPermissionOverrides(channelId, options) - }, - - async delete(channelId, id) { - return await rest.deleteChannelPermissionOverride(channelId, id) - }, - }, - - async positions(guildId, channelPositions) { - return await rest.editChannelPositions(guildId, channelPositions) - }, - - async invites(id) { - return await rest.getChannelInvites(id) - }, - - stages: { - async create(options) { - return await rest.createStageInstance(options) - }, - - async delete(channelId, reason) { - return await rest.deleteStageInstance(channelId, reason) - }, - - async edit(channelId, data) { - return await rest.editStageInstance(channelId, data) - }, - - async get(channelId) { - return await rest.getStageInstance(channelId) - }, - }, - - threads: { - create: { - with: { - async message(channelId, messageId, options) { - return await rest.startThreadWithMessage(channelId, messageId, options) - }, - }, - without: { - async message(channelId, options) { - return await rest.startThreadWithoutMessage(channelId, options) - }, - }, - }, - - get: { - async active(guildId) { - return await rest.getActiveThreads(guildId) - }, - - archived: { - async private(channelId, options) { - return await rest.getPrivateArchivedThreads(channelId, options) - }, - - async joined(channelId, options) { - return await rest.getPrivateJoinedArchivedThreads(channelId, options) - }, - - async public(channelId, options) { - return await rest.getPublicArchivedThreads(channelId, options) - }, - }, - - async member(channelId, userId) { - return await rest.getThreadMember(channelId, userId) - }, - - async members(channelId) { - return await rest.getThreadMembers(channelId) - }, - }, - - async join(channelId) { - return await rest.joinThread(channelId) - }, - - async leave(channelId) { - return await rest.leaveThread(channelId) - }, - - async kick(channelId, userId) { - return await rest.removeThreadMember(channelId, userId) - }, - }, - - async typing(id) { - return await rest.triggerTypingIndicator(id) - }, - }, - - emojis: { - async create(guildId, options) { - return await rest.createEmoji(guildId, options) - }, - - async delete(guildId, id, reason) { - return await rest.deleteEmoji(guildId, id, reason) - }, - - async edit(guildId, id, options) { - return await rest.editEmoji(guildId, id, options) - }, - - async get(guildId, emojiId) { - return await rest.getEmoji(guildId, emojiId) - }, - }, - - guilds: { - async auditlogs(guildId, options) { - return await rest.getAuditLog(guildId, options) - }, - - automod: { - async create(guildId, options) { - return await rest.createAutomodRule(guildId, options) - }, - - async delete(guildId, eventId) { - return await rest.deleteAutomodRule(guildId, eventId) - }, - - async edit(guildId, ruleId, options) { - return await rest.editAutomodRule(guildId, ruleId, options) - }, - - get: { - async rule(guildId, ruleId) { - return await rest.getAutomodRule(guildId, ruleId) - }, - - async rules(guildId) { - return await rest.getAutomodRules(guildId) - }, - }, - }, - - async ban(guildId, userId) { - return await rest.getBan(guildId, userId) - }, - - async bans(guildId, options) { - return await rest.getBans(guildId, options) - }, - - async create(options) { - return await rest.createGuild(options) - }, - - async channels(id) { - return await rest.getChannels(id) - }, - - async delete(id) { - return await rest.deleteGuild(id) - }, - - async edit(guildId, options) { - return await rest.editGuild(guildId, options) - }, - - async emojis(id) { - return await rest.getEmojis(id) - }, - - events: { - async create(guildId, options) { - return await rest.createScheduledEvent(guildId, options) - }, - - async delete(guildId, eventId) { - return await rest.deleteScheduledEvent(guildId, eventId) - }, - - async edit(guildId, eventId, options) { - return await rest.editScheduledEvent(guildId, eventId, options) - }, - - get: { - async event(guildId, eventId, options) { - return await rest.getScheduledEvent(guildId, eventId, options) - }, - - async events(guildId, options) { - return await rest.getScheduledEvents(guildId, options) - }, - - async users(guildId, eventId, options) { - return await rest.getScheduledEventUsers(guildId, eventId, options) - }, - }, - }, - - async get(guildId, options = { counts: true }) { - return await rest.get(rest.routes.guilds.guild(guildId, options.counts)) - }, - - integrations: { - async get(guildId) { - return await rest.getIntegrations(guildId) - }, - - async delete(guildId, integrationId) { - return await rest.deleteIntegration(guildId, integrationId) - }, - }, - - invites: { - async create(channelId, options) { - return await rest.createInvite(channelId, options) - }, - - async delete(inviteCode, reason) { - return await rest.deleteInvite(inviteCode, reason) - }, - - async get(inviteCode, options) { - return await rest.getInvite(inviteCode, options) - }, - - async list(guildId) { - return await rest.getInvites(guildId) - }, - }, - - stickers: { - async create(guildId, options) { - return await rest.createGuildSticker(guildId, options) - }, - - async delete(guildId, stickerId, reason) { - return await rest.deleteGuildSticker(guildId, stickerId, reason) - }, - - async edit(guildId, stickerId, options) { - return await rest.editGuildSticker(guildId, stickerId, options) - }, - - async sticker(guildId, stickerId) { - return await rest.getGuildSticker(guildId, stickerId) - }, - - async stickers(guildId) { - return await rest.getGuildStickers(guildId) - }, - }, - - templates: { - async create(guildId, options) { - return await rest.createGuildTemplate(guildId, options) - }, - async delete(guildId, templateCode) { - return await rest.deleteGuildTemplate(guildId, templateCode) - }, - async edit(guildId, templateCode, options) { - return await rest.editGuildTemplate(guildId, templateCode, options) - }, - async get(templateCode) { - return await rest.getGuildTemplate(templateCode) - }, - async list(guildId) { - return await rest.getGuildTemplates(guildId) - }, - async sync(guildId) { - return await rest.syncGuildTemplate(guildId) - }, - }, - - members: { - async ban(guildId, userId, options) { - return await rest.banMember(guildId, userId, options) - }, - async edit(guildId, userId, options) { - return await rest.editMember(guildId, userId, options) - }, - - async editSelf(guildId, options) { - return await rest.editBotMember(guildId, options) - }, - - async get(guildId, userId) { - return await rest.getMember(guildId, userId) - }, - - async dm(userId) { - return await rest.getDmChannel(userId) - }, - - async kick(guildId, userId, reason) { - return await rest.kickMember(guildId, userId, reason) - }, - - async list(guildId, options) { - return await rest.getMembers(guildId, options) - }, - - async prune(guildId, options) { - return await rest.pruneMembers(guildId, options) - }, - - async search(guildId, query, options) { - return await rest.searchMembers(guildId, query, options) - }, - - async unban(guildId, userId) { - return await rest.unbanMember(guildId, userId) - }, - }, - - interactions: { - commands: { - create: { - async global(command) { - return await rest.createGlobalApplicationCommand(command) - }, - - async guild(command, guildId) { - return await rest.createGuildApplicationCommand(command, guildId) - }, - }, - - delete: { - async global(commandId) { - return await rest.deleteGlobalApplicationCommand(commandId) - }, - - async guild(commandId, guildId) { - return await rest.deleteGuildApplicationCommand(commandId, guildId) - }, - }, - - edit: { - async global(commandId, options) { - return await rest.editGlobalApplicationCommand(commandId, options) - }, - - async guild(commandId, guildId, options) { - return await rest.editGuildApplicationCommand(commandId, guildId, options) - }, - - async permissions(guildId, commandId, bearerToken, options) { - return await rest.editApplicationCommandPermissions(guildId, commandId, bearerToken, options) - }, - }, - - get: { - global: { - async all() { - return await rest.getGlobalApplicationCommands() - }, - - async one(commandId) { - return await rest.getGlobalApplicationCommand(commandId) - }, - }, - - guilds: { - async all(guildId) { - return await rest.getGuildApplicationCommands(guildId) - }, - - async one(commandId, guildId) { - return await rest.getGuildApplicationCommand(commandId, guildId) - }, - }, - - async permission(guildId, commandId) { - return await rest.getApplicationCommandPermission(guildId, commandId) - }, - - async permissions(guildId) { - return await rest.getApplicationCommandPermissions(guildId) - }, - }, - - replace: { - async global(commands) { - return await rest.upsertGlobalApplicationCommands(commands) - }, - - async guild(guildId, commands) { - return await rest.upsertGuildApplicationCommands(guildId, commands) - }, - }, - }, - - responses: { - create: { - async followup(token, options) { - return await rest.sendFollowupMessage(token, options) - }, - - async original(interactionId, token, options) { - return await rest.sendInteractionResponse(interactionId, token, options) - }, - }, - - delete: { - async followup(token, messageId) { - return await rest.deleteFollowupMessage(token, messageId) - }, - - async original(token) { - return await rest.deleteOriginalInteractionResponse(token) - }, - }, - - edit: { - async followup(token, messageId, options) { - return await rest.editFollowupMessage(token, messageId, options) - }, - - async original(token, options) { - return await rest.editOriginalInteractionResponse(token, options) - }, - }, - - get: { - async followup(token, messageId) { - return await rest.getFollowupMessage(token, messageId) - }, - - async original(token) { - return await rest.getOriginalInteractionResponse(token) - }, - }, - }, - }, - - roles: { - async add(guildId, userId, roleId, reason) { - return await rest.addRole(guildId, userId, roleId, reason) - }, - - async create(guildId, options, reason) { - return await rest.createRole(guildId, options, reason) - }, - - async delete(guildId, roleId) { - return await rest.deleteRole(guildId, roleId) - }, - - async edit(guildId, roleId, options) { - return await rest.editRole(guildId, roleId, options) - }, - - async list(guildId) { - return await rest.getRoles(guildId) - }, - - async positions(guildId, options) { - return await rest.editRolePositions(guildId, options) - }, - - async remove(guildId, userId, roleId, reason) { - return await rest.removeRole(guildId, userId, roleId, reason) - }, - }, - - async vanity(guildId) { - return await rest.getVanityUrl(guildId) - }, - - async regions(guildId) { - return await rest.getVoiceRegions(guildId) - }, - }, - - async sticker(stickerId) { - return await rest.getSticker(stickerId) - }, - - users: { - async channel(userId) { - return await rest.getDmChannel(userId) - }, - }, - - webhooks: { - async create(channelId, options) { - return await rest.createWebhook(channelId, options) - }, - - delete: { - with: { - async id(id, reason) { - return await rest.deleteWebhook(id, reason) - }, - - async token(id, token) { - return await rest.deleteWebhookWithToken(id, token) - }, - }, - }, - - edit: { - with: { - async id(webhookId, options) { - return await rest.editWebhook(webhookId, options) - }, - - async token(id, token, options) { - return await rest.editWebhookWithToken(id, token, options) - }, - }, - }, - - async execute(webhookId, token, options) { - return await rest.executeWebhook(webhookId, token, options) - }, - - get: { - async channel(channelId) { - return await rest.getChannelWebhooks(channelId) - }, - - async guild(guildId) { - return await rest.getGuildWebhooks(guildId) - }, - - async message(webhookId, token, messageId, options) { - return await rest.getWebhookMessage(webhookId, token, messageId, options) - }, - - with: { - async id(webhookId) { - return await rest.getWebhook(webhookId) - }, - - async token(webhookId, token) { - return await rest.getWebhookWithToken(webhookId, token) - }, - }, - }, - - messages: { - async delete(webhookId, token, messageId, options) { - return await rest.deleteWebhookMessage(webhookId, token, messageId, options) - }, - - // js hack making it possible to do webhooks.messages.edit() as well as webhooks.messages.edit.original() - edit: Object.assign( - // The base function for webhooks.messages.edit() - (async (webhookId, token, messageId, options) => { - return await rest.editWebhookMessage(webhookId, token, messageId, options) - }) as WebhookMessageEditor, - // The properties that webhooks.messages.edit.xxx will have are listed in this object - { - original: async (webhookId, token, options) => { - return await rest.editOriginalWebhookMessage(webhookId, token, options) - }, - } as WebhookMessageEditor, - ), - }, - }, - async addReaction(channelId, messageId, reaction) { if (reaction.startsWith('<:')) { reaction = reaction.substring(2, reaction.length - 1) @@ -1593,6 +978,14 @@ export function createRestManager(options: CreateRestManagerOptions): RestManage return await rest.post(rest.routes.interactions.commands.guilds.all(rest.applicationId, guildId), command) }, + async createGuildFromTemplate(templateCode, options) { + if (options.icon) { + options.icon = await urlToBase64(options.icon) + } + + return await rest.post(rest.routes.guilds.templates.code(templateCode), options) + }, + async createGuildSticker(guildId, options) { return await rest.post(rest.routes.guilds.stickers(guildId), options) }, @@ -2442,1982 +1835,6 @@ export interface RestManager { delete: (url: string, body?: Record) => Promise /** Make a patch request to the api. */ patch: (url: string, body?: Record) => Promise> - /** Helper methods related to channels */ - channels: { - /** Methods related to messages in a channel */ - messages: { - /** - * Sends a message to a channel. - * - * @param channelId - The ID of the channel to send the message in. - * @param options - The parameters for the creation of the message. - * @returns An instance of the created {@link DiscordMessage}. - * - * @remarks - * Requires that the bot user be able to see the contents of the channel the message is to be sent in. - * - * If sending a message to a guild channel: - * - Requires the `SEND_MESSAGES` permission. - * - * If sending a TTS message: - * - Requires the `SEND_TTS_MESSAGES` permission. - * - * If sending a message as a reply to another message: - * - Requires the `READ_MESSAGE_HISTORY` permission. - * - The message being replied to cannot be a system message. - * - * ⚠️ The maximum size of a request (accounting for any attachments and message content) for bot users is _8 MiB_. - * - * Fires a _Message Create_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#create-message} - */ - send: (channelId: BigString, options: CreateMessageOptions) => Promise> - /** - * Edits a message. - * - * @param channelId - The ID of the channel to edit the message in. - * @param messageId - The IDs of the message to edit. - * @param options - The parameters for the edit of the message. - * @returns An instance of the edited {@link Message}. - * - * @remarks - * If editing another user's message: - * - Requires the `MANAGE_MESSAGES` permission. - * - Only the {@link EditMessage.flags | flags} property of the {@link options} object parameter can be edited. - * - * Fires a _Message Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#edit-message} - */ - edit: (channelId: BigString, messageId: BigString, options: EditMessage) => Promise> - /** - * Cross-posts a message posted in an announcement channel to subscribed channels. - * - * @param channelId - The ID of the announcement channel. - * @param messageId - The ID of the message to cross-post. - * @returns An instance of the cross-posted {@link Message}. - * - * @remarks - * Requires the `SEND_MESSAGES` permission. - * - * If not cross-posting own message: - * - Requires the `MANAGE_MESSAGES` permission. - * - * Fires a _Message Create_ event in the guilds the subscribed channels are in. - * - * @see {@link https://discord.com/developers/docs/resources/channel#crosspost-message} - */ - publish: (channelId: BigString, messageId: BigString) => Promise> - /** - * Deletes a message from a channel. - * - * @param channelId - The ID of the channel to delete the message from. - * @param messageId - The ID of the message to delete from the channel. - * - * @remarks - * If not deleting own message: - * - Requires the `MANAGE_MESSAGES` permission. - * - * Fires a _Message Delete_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#delete-message} - */ - delete: (channelId: BigString, messageId: BigString, reason?: string) => Promise - /** Handlers related to reactions on a message. */ - reactions: { - /** - * Adds a reaction to a message. - * - * @param channelId - The ID of the channel the message to add a reaction to is in. - * @param messageId - The ID of the message to add a reaction to. - * @param reaction - The reaction to add to the message. - * @returns - * - * @remarks - * Requires the `READ_MESSAGE_HISTORY` permission. - * - * If nobody else has reacted to the message: - * - Requires the `ADD_REACTIONS` permission. - * - * Fires a _Message Reaction Add_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#create-reaction} - */ - add: (channelId: BigString, messageId: BigString, reaction: string) => Promise - /** - * Adds multiple a reaction to a message. - * - * This function uses the `addReaction()` helper behind the scenes. - * - * @param channelId - The ID of the channel the message to add reactions to is in. - * @param messageId - The ID of the message to add the reactions to. - * @param reactions - The reactions to add to the message. - * @param ordered - Whether the reactions must be added in order or not. - * - * @remarks - * Requires the `READ_MESSAGE_HISTORY` permission. - * - * If nobody else has reacted to the message: - * - Requires the `ADD_REACTIONS` permission. - * - * Fires a _Message Reaction Add_ gateway event for every reaction added. - */ - bulk: (channelId: BigString, messageId: BigString, reactions: string[], ordered?: boolean) => Promise - } - } - /** - * Gets a channel by its ID. - * - * @param id - The ID of the channel to get. - * @returns An instance of {@link DiscordChannel}. - * - * @remarks - * If the channel is a thread, a {@link ThreadMember} object is included in the result. - * - * @see {@link https://discord.com/developers/docs/resources/channel#get-channel} - */ - get: (id: BigString) => Promise> - /** - * Creates a channel within a guild. - * - * @param guildId - The ID of the guild to create the channel within. - * @param options - The parameters for the creation of the channel. - * @returns An instance of the created {@link DiscordChannel}. - * - * @remarks - * Requires the `MANAGE_CHANNELS` permission. - * - * If setting permission overwrites, only the permissions the bot user has in the guild can be allowed or denied. - * - * Setting the `MANAGE_ROLES` permission is only possible for guild administrators. - * - * Fires a _Channel Create_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#create-guild-channel} - */ - create: (guildId: BigString, options: CreateGuildChannel) => Promise> - /** - * Deletes a channel from within a guild. - * - * @param channelId - The ID of the channel to delete. - * @returns An instance of the deleted {@link Channel}. - * - * @remarks - * For community guilds, the _Rules_, _Guidelines_ and _Community Update_ channels cannot be deleted. - * - * If the channel is a thread: - * - Requires the `MANAGE_THREADS` permission. - * - * - Fires a _Thread Delete_ gateway event. - * - * Otherwise: - * - Requires the `MANAGE_CHANNELS` permission. - * - * - ⚠️ Deleting a category channel does not delete its child channels. - * Instead, they will have their `parent_id` property removed, and a `Channel Update` gateway event will fire for each of them. - * - * - Fires a _Channel Delete_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#deleteclose-channel} - */ - delete: (channelId: BigString, reason?: string) => Promise - /** - * Edits a channel's settings. - * - * @param channelId - The ID of the channel to edit. - * @param options - The parameters for the edit of the channel. - * @returns An instance of the edited {@link DiscordChannel}. - * - * @remarks - * If editing a channel of type {@link ChannelTypes.GroupDm}: - * - Fires a _Channel Update_ gateway event. - * - * If editing a thread channel: - * - Requires the `MANAGE_THREADS` permission __unless__ if setting the `archived` property to `false` when the `locked` property is also `false`, in which case only the `SEND_MESSAGES` permission is required. - * - * - Fires a _Thread Update_ gateway event. - * - * If editing a guild channel: - * - Requires the `MANAGE_CHANNELS` permission. - * - * - If modifying permission overrides: - * - Requires the `MANAGE_ROLES` permission. - * - * - Only permissions the bot user has in the guild or parent channel can be allowed/denied __unless__ the bot user has a `MANAGE_ROLES` permission override in the channel. - * - * - If modifying a channel of type {@link ChannelTypes.GuildCategory}: - * - Fires a _Channel Update_ gateway event for each child channel impacted in this change. - * - Otherwise: - * - Fires a _Channel Update_ gateway event. - */ - edit: (channelId: BigString, options: ModifyChannel) => Promise> - /** - * Follows an announcement channel, allowing messages posted within it to be cross-posted into the target channel. - * - * @param sourceChannelId - The ID of the announcement channel to follow. - * @param targetChannelId - The ID of the target channel - the channel to cross-post to. - * @returns An instance of {@link DiscordFollowedChannel}. - * - * @remarks - * Requires the `MANAGE_WEBHOOKS` permission in the __target channel__. - * - * Fires a _Webhooks Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#follow-announcement-channel} - */ - follow: (sourceChannelId: BigString, targetChannelId: BigString) => Promise> - /** Forum related helpers in a channel */ - forums: { - /** - * Creates a new thread in a forum channel, and sends a message within the created thread. - * - * @param channelId - The ID of the forum channel to create the thread within. - * @param options - The parameters for the creation of the thread. - * @returns An instance of {@link DiscordChannel} with a nested {@link Message} object. - * - * @remarks - * Requires the `CREATE_MESSAGES` permission. - * - * Fires a _Thread Create_ gateway event. - * Fires a _Message Create_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#start-thread-in-forum-channel} - * - * @experimental - */ - post: (channelId: BigString, options: CreateForumPostWithMessage) => Promise> - } - /** Permission related helpers in a channel */ - permissions: { - /** - * Edits the permission overrides for a user or role in a channel. - * - * @param channelId - The ID of the channel to edit the permission overrides of. - * @param options - The permission override. - * - * @remarks - * Requires the `MANAGE_ROLES` permission. - * - * Only permissions the bot user has in the guild or parent channel can be allowed/denied __unless__ the bot user has a `MANAGE_ROLES` permission override in the channel. - * - * Fires a _Channel Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#edit-channel-permissions} - */ - edit: (channelId: BigString, options: EditChannelPermissionOverridesOptions) => Promise - /** - * Deletes a permission override for a user or role in a channel. - * - * @param channelId - The ID of the channel to delete the permission override of. - * @param overwriteId - The ID of the permission override to delete. - * - * @remarks - * Requires the `MANAGE_ROLES` permission. - * - * Fires a _Channel Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#delete-channel-permission} - */ - delete: (channelId: BigString, overwriteId: BigString, reason?: string) => Promise - } - threads: { - get: { - /** - * Gets the list of all active threads for a guild. - * - * @param guildId - The ID of the guild to get the threads of. - * @returns An instance of {@link DiscordActiveThreads}. - * - * @remarks - * Returns both public and private threads. - * - * Threads are ordered by the `id` property in descending order. - * - * @see {@link https://discord.com/developers/docs/resources/guild#list-active-guild-threads} - */ - active: (guildId: BigString) => Promise> - /** Methods related to getting archived threads. */ - archived: { - /** - * Gets the list of private archived threads for a channel. - * - * @param channelId - The ID of the channel to get the archived threads for. - * @param options - The parameters for the fetching of threads. - * @returns An instance of {@link DiscordArchivedThreads}. - * - * @remarks - * Requires the `READ_MESSAGE_HISTORY` permission. - * Requires the `MANAGE_THREADS` permission. - * - * Returns threads of type {@link ChannelTypes.GuildPrivateThread}. - * - * Threads are ordered by the `archive_timestamp` property included in the metadata of the object in descending order. - * - * @see {@link https://discord.com/developers/docs/resources/channel#list-private-archived-threads} - */ - private: (channelId: BigString, options?: ListArchivedThreads) => Promise> - /** - * Gets the list of private archived threads the bot is a member of for a channel. - * - * @param channelId - The ID of the channel to get the archived threads for. - * @param options - The parameters for the fetching of threads. - * @returns An instance of {@link DiscordArchivedThreads}. - * - * @remarks - * Requires the `READ_MESSAGE_HISTORY` permission. - * - * Returns threads of type {@link ChannelTypes.GuildPrivateThread}. - * - * Threads are ordered by the `id` property in descending order. - * - * @see {@link https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads} - */ - joined: (channelId: BigString, options?: ListArchivedThreads) => Promise> - /** - * Gets the list of public archived threads for a channel. - * - * @param channelId - The ID of the channel to get the archived threads for. - * @param options - The parameters for the fetching of threads. - * @returns An instance of {@link ArchivedThreads}. - * - * @remarks - * Requires the `READ_MESSAGE_HISTORY` permission. - * - * If called on a channel of type {@link ChannelTypes.GuildText}, returns threads of type {@link ChannelTypes.GuildPublicThread}. - * If called on a channel of type {@link ChannelTypes.GuildNews}, returns threads of type {@link ChannelTypes.GuildNewsThread}. - * - * Threads are ordered by the `archive_timestamp` property included in the metadata of the object in descending order. - * - * @see {@link https://discord.com/developers/docs/resources/channel#list-public-archived-threads} - */ - public: (channelId: BigString, options?: ListArchivedThreads) => Promise> - } - /** - * Gets a thread member by their user ID. - * - * @param channelId - The ID of the thread to get the thread member of. - * @param userId - The user ID of the thread member to get. - * @returns An instance of {@link DiscordThreadMember}. - * - * @see {@link https://discord.com/developers/docs/resources/channel#get-thread-member} - */ - member: (channelId: BigString, userId: BigString) => Promise> - /** - * Gets the list of thread members for a thread. - * - * @param channelId - The ID of the thread to get the thread members of. - * @returns A collection of {@link DiscordThreadMember} assorted by user ID. - * - * @remarks - * Requires the application to have the `GUILD_MEMBERS` privileged intent enabled. - * - * @see {@link https://discord.com/developers/docs/resources/channel#list-thread-members} - */ - members: (channelId: BigString) => Promise> - } - /** - * Adds the bot user to a thread. - * - * @param channelId - The ID of the thread to add the bot user to. - * - * @remarks - * Requires the thread not be archived. - * - * Fires a _Thread Members Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#join-thread} - */ - join: (channelId: BigString) => Promise - /** - * Removes the bot user from a thread. - * - * @param channelId - The ID of the thread to remove the bot user from. - * - * @remarks - * Requires the thread not be archived. - * - * Fires a _Thread Members Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#leave-thread} - */ - leave: (channelId: BigString) => Promise - /** - * Removes a member from a thread. - * - * @param channelId - The ID of the thread to remove the thread member of. - * @param userId - The user ID of the thread member to remove. - * - * @remarks - * If the thread is of type {@link ChannelTypes.GuildPrivateThread}, requires to be the creator of the thread. - * Otherwise, requires the `MANAGE_THREADS` permission. - * - * Requires the thread not be archived. - * - * Fires a _Thread Members Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#remove-thread-member} - */ - kick: (channelId: BigString, userId: BigString) => Promise - /** Methods related to creating a thread. */ - create: { - with: { - /** - * Creates a thread, using an existing message as its point of origin. - * - * @param channelId - The ID of the channel in which to create the thread. - * @param messageId - The ID of the message to use as the thread's point of origin. - * @param options - The parameters to use for the creation of the thread. - * @returns An instance of the created {@link Channel | Thread}. - * - * @remarks - * If called on a channel of type {@link ChannelTypes.GuildText}, creates a {@link ChannelTypes.GuildPublicThread}. - * If called on a channel of type {@link ChannelTypes.GuildNews}, creates a {@link ChannelTypes.GuildNewsThread}. - * Does not work on channels of type {@link ChannelTypes.GuildForum}. - * - * The ID of the created thread will be the same as the ID of the source message. - * - * Fires a _Thread Create_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#start-thread-from-message} - */ - message: (channelId: BigString, messageId: BigString, options: StartThreadWithMessage) => Promise> - } - without: { - /** - * Creates a thread without using a message as the thread's point of origin. - * - * @param channelId - The ID of the channel in which to create the thread. - * @param options - The parameters to use for the creation of the thread. - * @returns An instance of the created {@link DiscordChannel | Thread}. - * - * @remarks - * Creating a private thread requires the server to be boosted. - * - * Fires a _Thread Create_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#start-thread-without-message} - */ - message: (channelId: BigString, options: StartThreadWithoutMessage) => Promise> - } - } - } - /** - * Edits the positions of a set of channels in a guild. - * - * @param guildId - The ID of the guild in which to edit the positions of the channels. - * @param channelPositions - A set of objects defining the updated positions of the channels. - * - * @remarks - * Requires the `MANAGE_CHANNELS` permission. - * - * Fires a _Channel Update_ gateway event for every channel impacted in this change. - * - * @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions} - */ - positions: (guildId: BigString, channelPositions: ModifyGuildChannelPositions[]) => Promise - /** - * Gets the list of invites for a channel. - * - * @param channelId - The ID of the channel to get the invites of. - * @returns A collection of {@link DiscordInviteMetadata} objects assorted by invite code. - * - * @remarks - * Requires the `MANAGE_CHANNELS` permission. - * - * Only usable for guild channels. - * - * @see {@link https://discord.com/developers/docs/resources/channel#get-channel-invites} - */ - invites: (channelId: BigString) => Promise> - /** Stage related helpers for a channel. */ - stages: { - /** - * Creates a stage instance associated with a stage channel. - * - * @param options - The parameters for the creation of the stage instance. - * @returns An instance of the created {@link DiscordStageInstance}. - * - * @remarks - * Requires the user to be a moderator of the stage channel. - * - * Fires a _Stage Instance Create_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/stage-instance#create-stage-instance} - */ - create: (options: CreateStageInstance) => Promise> - /** - * Deletes the stage instance associated with a stage channel, if one exists. - * - * @param channelId - The ID of the stage channel the stage instance is associated with. - * - * @remarks - * Requires the user to be a moderator of the stage channel. - * - * Fires a _Stage Instance Delete_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/stage-instance#delete-stage-instance} - */ - delete: (channelId: BigString, reason?: string) => Promise - /** - * Edits a stage instance. - * - * @param channelId - The ID of the stage channel the stage instance is associated with. - * @returns An instance of the updated {@link DiscordStageInstance}. - * - * @remarks - * Requires the user to be a moderator of the stage channel. - * - * Fires a _Stage Instance Update_ event. - * - * @see {@link https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance} - */ - edit: (channelId: BigString, data: EditStageInstanceOptions) => Promise> - /** - * Gets the stage instance associated with a stage channel, if one exists. - * - * @param channelId - The ID of the stage channel the stage instance is associated with. - * @returns An instance of {@link DiscordStageInstance}. - * - * @see {@link https://discord.com/developers/docs/resources/stage-instance#get-stage-instance} - */ - get: (channelId: BigString) => Promise> - } - /** - * Triggers a typing indicator for the bot user. - * - * @param channelId - The ID of the channel in which to trigger the typing indicator. - * - * @remarks - * Generally, bots should _not_ use this route. - * - * Fires a _Typing Start_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#trigger-typing-indicator} - */ - typing: (channelId: BigString) => Promise - } - /** Emoji related helper methods. */ - emojis: { - /** - * Creates an emoji in a guild. - * - * @param guildId - The ID of the guild in which to create the emoji. - * @param options - The parameters for the creation of the emoji. - * @returns An instance of the created {@link DiscordEmoji}. - * - * @remarks - * Requires the `MANAGE_EMOJIS_AND_STICKERS` permission. - * - * Emojis have a maximum file size of 256 kilobits. Attempting to upload a larger emoji will cause the route to return 400 Bad Request. - * - * Fires a _Guild Emojis Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/emoji#create-guild-emoji} - */ - create: (guildId: BigString, options: CreateGuildEmoji) => Promise> - /** - * Deletes an emoji from a guild. - * - * @param guildId - The ID of the guild from which to delete the emoji. - * @param id - The ID of the emoji to delete. - * - * @remarks - * Requires the `MANAGE_EMOJIS_AND_STICKERS` permission. - * - * Fires a _Guild Emojis Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/emoji#delete-guild-emoji} - */ - delete: (guildId: BigString, id: BigString, reason?: string) => Promise - /** - * Edits an emoji. - * - * @param guildId - The ID of the guild in which to edit the emoji. - * @param id - The ID of the emoji to edit. - * @param options - The parameters for the edit of the emoji. - * @returns An instance of the updated {@link DiscordEmoji}. - * - * @remarks - * Requires the `MANAGE_EMOJIS_AND_STICKERS` permission. - * - * Fires a `Guild Emojis Update` gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/emoji#modify-guild-emoji} - */ - edit: (guildId: BigString, id: BigString, options: ModifyGuildEmoji) => Promise> - /** - * Gets an emoji by its ID. - * - * @param guildId - The ID of the guild from which to get the emoji. - * @param emojiId - The ID of the emoji to get. - * @returns An instance of {@link DiscordEmoji}. - * - * @see {@link https://discord.com/developers/docs/resources/emoji#get-guild-emoji} - */ - get: (guildId: BigString, emojiId: BigString) => Promise> - } - /** Guild related helper methods */ - guilds: { - /** - * Gets a guild's audit log. - * - * @param guildId - The ID of the guild to get the audit log of. - * @param options - The parameters for the fetching of the audit log. - * @returns An instance of {@link AuditLog}. - * - * @remarks - * Requires the `VIEW_AUDIT_LOG` permission. - * - * @see {@link https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log} - */ - auditlogs: (guildId: BigString, options?: GetGuildAuditLog) => Promise> - automod: { - /** - * Creates an automod rule in a guild. - * - * @param guildId - The ID of the guild to create the rule in. - * @param options - The parameters for the creation of the rule. - * @returns An instance of the created {@link DiscordAutoModerationRule}. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * Fires an _Auto Moderation Rule Create_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule} - */ - create: (guildId: BigString, options: CreateAutoModerationRuleOptions) => Promise> - /** - * Deletes a scheduled event from a guild. - * - * @param guildId - The ID of the guild to delete the scheduled event from. - * @param eventId - The ID of the scheduled event to delete. - * - * @remarks - * Requires the `MANAGE_EVENTS` permission. - * - * Fires a _Guild Scheduled Event Delete_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event} - */ - delete: (guildId: BigString, eventId: BigString) => Promise - /** - * Edits an automod rule. - * - * @param guildId - The ID of the guild to edit the rule in. - * @param ruleId - The ID of the rule to edit. - * @param options - The parameters for the edit of the rule. - * @returns An instance of the edited {@link DiscordAutoModerationRule}. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * Fires an _Auto Moderation Rule Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule} - */ - edit: (guildId: BigString, ruleId: BigString, options: Partial) => Promise> - /** Methods related to getting automoderation data in a guild. */ - get: { - /** - * Gets an automod rule by its ID. - * - * @param guildId - The ID of the guild to get the rule of. - * @param ruleId - The ID of the rule to get. - * @returns An instance of {@link DiscordAutoModerationRule}. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * @see {@link https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule} - */ - rule: (guildId: BigString, ruleId: BigString) => Promise> - /** - * Gets the list of automod rules for a guild. - * - * @param guildId - The ID of the guild to get the rules from. - * @returns A collection of {@link DiscordAutoModerationRule} objects assorted by rule ID. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * @see {@link https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild} - */ - rules: (guildId: BigString) => Promise> - } - } - /** - * Gets a ban by user ID. - * - * @param guildId - The ID of the guild to get the ban from. - * @param userId - The ID of the user to get the ban for. - * @returns An instance of {@link DiscordBan}. - * - * @remarks - * Requires the `BAN_MEMBERS` permission. - * - * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-ban} - */ - ban: (guildId: BigString, userId: BigString) => Promise> - /** - * Gets the list of bans for a guild. - * - * @param guildId - The ID of the guild to get the list of bans for. - * @param options - The parameters for the fetching of the list of bans. - * @returns A collection of {@link DiscordBan} objects assorted by user ID. - * - * @remarks - * Requires the `BAN_MEMBERS` permission. - * - * Users are ordered by their IDs in _ascending_ order. - * - * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-bans} - */ - bans: (guildId: BigString, options?: GetBans) => Promise> - /** - * Creates a guild. - * - * @param options - The parameters for the creation of the guild. - * @returns An instance of the created {@link DiscordGuild}. - * - * @remarks - * ⚠️ This route can only be used by bots in __fewer than 10 guilds__. - * - * Fires a _Guild Create_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#create-guild} - */ - create: (options: CreateGuild) => Promise> - /** - * Gets the list of channels for a guild. - * - * @param guildId - The ID of the guild to get the channels of. - * @returns A collection of {@link DiscordChannel} objects assorted by channel ID. - * - * @remarks - * Excludes threads. - * - * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-channels} - */ - channels: (guildId: BigString) => Promise> - /** - * Deletes a guild. - * - * @param guildId - The ID of the guild to delete. - * - * @remarks - * The bot user must be the owner of the guild. - * - * Fires a _Guild Delete_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#delete-guild} - */ - delete: (guildId: BigString) => Promise - /** - * Edits a guild's settings. - * - * @param guildId - The ID of the guild to edit. - * @param shardId - The ID of the shard the guild is in. - * @param options - The parameters for the edit of the guild. - * @returns An instance of the edited {@link Guild}. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * If attempting to add or remove the {@link GuildFeatures.Community} feature: - * - Requires the `ADMINISTRATOR` permission. - * - * Fires a _Guild Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#modify-guild} - */ - edit: (guildId: BigString, options: ModifyGuild) => Promise> - /** - * Gets the list of emojis for a guild. - * - * @param guildId - The ID of the guild which to get the emojis of. - * @returns A collection of {@link DiscordEmoji} objects assorted by emoji ID. - * - * @see {@link https://discord.com/developers/docs/resources/emoji#list-guild-emojis} - */ - emojis: (guildId: BigString) => Promise> - /** Methods related to a guild's scheduled events. */ - events: { - /** - * Creates a scheduled event in a guild. - * - * @param guildId - The ID of the guild to create the scheduled event in. - * @param options - The parameters for the creation of the scheduled event. - * @returns An instance of the created {@link ScheduledEvent}. - * - * @remarks - * Requires the `MANAGE_EVENTS` permission. - * - * A guild can only have a maximum of 100 events with a status of {@link ScheduledEventStatus.Active} or {@link ScheduledEventStatus.Scheduled} (inclusive). - * - * Fires a _Guild Scheduled Event Create_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event} - */ - create: (guildId: BigString, options: CreateScheduledEvent) => Promise> - /** - * Deletes a scheduled event from a guild. - * - * @param guildId - The ID of the guild to delete the scheduled event from. - * @param eventId - The ID of the scheduled event to delete. - * - * @remarks - * Requires the `MANAGE_EVENTS` permission. - * - * Fires a _Guild Scheduled Event Delete_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event} - */ - delete: (guildId: BigString, eventId: BigString) => Promise - /** - * Edits a scheduled event. - * - * @param guildId - The ID of the guild to edit the scheduled event in. - * @param eventId - The ID of the scheduled event to edit. - * @returns An instance of the edited {@link ScheduledEvent}. - * - * @remarks - * Requires the `MANAGE_EVENTS` permission. - * - * To start or end an event, modify the event's `status` property. - * - * The `entity_metadata` property is discarded for events whose `entity_type` is not {@link ScheduledEventEntityType.External}. - * - * Fires a _Guild Scheduled Event Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event} - */ - edit: (guildId: BigString, eventId: BigString, options: Partial) => Promise> - - get: { - /** - * Gets a scheduled event by its ID. - * - * @param guildId - The ID of the guild to get the scheduled event from. - * @param eventId - The ID of the scheduled event to get. - * @param options - The parameters for the fetching of the scheduled event. - * @returns An instance of {@link ScheduledEvent}. - * - * @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event} - */ - event: (guildId: BigString, eventId: BigString, options?: { withUserCount?: boolean }) => Promise> - /** - * Gets the list of scheduled events for a guild. - * - * @param guildId - The ID of the guild to get the scheduled events from. - * @param options - The parameters for the fetching of the scheduled events. - * @returns A collection of {@link ScheduledEvent} objects assorted by event ID. - * - * @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild} - */ - events: (guildId: BigString, options?: GetScheduledEvents) => Promise> - /** - * Gets the list of subscribers to a scheduled event from a guild. - * - * @param guildId - The ID of the guild to get the subscribers to the scheduled event from. - * @param eventId - The ID of the scheduled event to get the subscribers of. - * @param options - The parameters for the fetching of the subscribers. - * @returns A collection of {@link User} objects assorted by user ID. - * - * @remarks - * Requires the `MANAGE_EVENTS` permission. - * - * Users are ordered by their IDs in _ascending_ order. - * - * @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users} - */ - users: ( - guildId: BigString, - eventId: BigString, - options?: GetScheduledEventUsers, - ) => Promise< - Array<{ - user: Camelize - member?: Camelize - }> - > - } - } - /** - * Gets a guild by its ID. - * - * @param guildId - The ID of the guild to get. - * @param options - The parameters for the fetching of the guild. - * @returns An instance of {@link Guild}. - * - * @see {@link https://discord.com/developers/docs/resources/guild#get-guild} - */ - get: (guildId: BigString, options?: { counts?: boolean }) => Promise> - /** Methods related to a guild's integrations. */ - integrations: { - /** - * Gets the list of integrations attached to a guild. - * - * @param guildId - The ID of the guild to get the list of integrations from. - * @returns A collection of {@link Integration} objects assorted by integration ID. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-integrations} - */ - get: (guildId: BigString) => Promise> - /** - * Deletes an integration attached to a guild. - * - * @param guildId - The ID of the guild from which to delete the integration. - * @param integrationId - The ID of the integration to delete from the guild. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * Deletes all webhooks associated with the integration, and kicks the associated bot if there is one. - * - * Fires a _Guild Integrations Update_ gateway event. - * Fires a _Integration Delete_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#delete-guild-integration} - */ - delete: (guildId: BigString, integrationId: BigString) => Promise - } - /** Methods related to a guild's invites. */ - invites: { - /** - * Creates an invite to a channel in a guild. - * - * @param channelId - The ID of the channel to create the invite to. - * @param options - The parameters for the creation of the invite. - * @returns An instance of the created {@link DiscordInvite}. - * - * @remarks - * Requires the `CREATE_INSTANT_INVITE` permission. - * - * Fires an _Invite Create_ gateway event. - * - * @privateRemarks - * The request body is not optional, and an empty JSON object must be sent regardless of whether any fields are being transmitted. - * - * @see {@link https://discord.com/developers/docs/resources/channel#create-channel-invite} - */ - create: (channelId: BigString, options?: CreateChannelInvite) => Promise> - /** - * Deletes an invite to a channel. - * - * @param inviteCode - The invite code of the invite to delete. - * - * @remarks - * Requires the `MANAGE_CHANNELS` permission. - * - * Fires an _Invite Delete_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/channel#delete-channel-invite} - */ - delete: (inviteCode: string, reason?: string) => Promise - /** - * Gets an invite to a channel by its invite code. - * - * @param inviteCode - The invite code of the invite to get. - * @param options - The parameters for the fetching of the invite. - * @returns An instance of {@link DiscordInviteMetadata}. - * - * @see {@link https://discord.com/developers/docs/resources/invite#get-invite} - */ - get: (inviteCode: string, options?: GetInvite) => Promise> - /** - * Gets the list of invites for a guild. - * - * @param guildId - The ID of the guild to get the invites from. - * @returns A collection of {@link DiscordInviteMetadata} objects assorted by invite code. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * @see {@link https://discord.com/developers/docs/resources/invite#get-invites} - */ - list: (guildId: BigString) => Promise> - } - /** Methods related to stickers in a guild. */ - stickers: { - /** - * Create a new sticker for the guild. - * - * @param guildId The ID of the guild to get - * @return A {@link DiscordSticker} - * - * @remarks - * Requires the `MANAGE_EMOJIS_AND_STICKERS` permission. - * Fires a Guild Stickers Update Gateway event. - * Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots. - * Lottie stickers can only be uploaded on guilds that have either the `VERIFIED` and/or the `PARTNERED` guild feature. - * - * @see {@link https://discord.com/developers/docs/resources/sticker#create-guild-sticker} - */ - create: (guildId: BigString, options: CreateGuildStickerOptions) => Promise> - /** - * Delete a new sticker for the guild. - * - * @param guildId The ID of the guild to get - * @return A {@link DiscordSticker} - * - * @remarks - * Requires the `MANAGE_EMOJIS_AND_STICKERS` permission. - * Fires a Guild Stickers Update Gateway event. - * Every guilds has five free sticker slots by default, and each Boost level will grant access to more slots. - * Lottie stickers can only be uploaded on guilds that have either the `VERIFIED` and/or the `PARTNERED` guild feature. - * - * @see {@link https://discord.com/developers/docs/resources/sticker#delete-guild-sticker} - */ - delete: (guildId: BigString, stickerId: BigString, reason?: string) => Promise - /** - * Edit the given sticker. - * - * @param guildId The ID of the guild to get - * @return A {@link DiscordSticker} - * - * @remarks - * Requires the `MANAGE_EMOJIS_AND_STICKERS` permission. - * Fires a Guild Stickers Update Gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/sticker#modify-guild-sticker} - */ - edit: (guildId: BigString, stickerId: BigString, options: AtLeastOne) => Promise> - /** - * Returns a sticker object for the given guild and sticker IDs. - * - * @param guildId The ID of the guild to get - * @param stickerId The ID of the sticker to get - * @return A {@link DiscordSticker} - * - * @remarks Includes the user field if the bot has the `MANAGE_EMOJIS_AND_STICKERS` permission. - * - * @see {@link https://discord.com/developers/docs/resources/sticker#get-guild-sticker} - */ - sticker: (guildId: BigString, stickerId: BigString) => Promise> - /** - * Returns an array of sticker objects for the given guild. - * - * @param guildId The ID of the guild to get - * @returns A collection of {@link DiscordSticker} objects assorted by sticker ID. - * - * @remarks Includes user fields if the bot has the `MANAGE_EMOJIS_AND_STICKERS` permission. - * - * @see {@link https://discord.com/developers/docs/resources/sticker#list-guild-stickers} - */ - stickers: (guildId: BigString) => Promise> - } - /** Methods related to a guild's templates. */ - templates: { - /** - * Creates a template from a guild. - * - * @param guildId - The ID of the guild to create the template from. - * @param options - The parameters for the creation of the template. - * @returns An instance of the created {@link Template}. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * Fires a _Guild Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild-template#create-guild-template} - */ - create: (guildId: BigString, options: CreateTemplate) => Promise> - /** - * Deletes a template from a guild. - * - * @param guildId - The ID of the guild to delete the template from. - * @param templateCode - The code of the template to delete. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * Fires a _Guild Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild-template#delete-guild-template} - */ - delete: (guildId: BigString, templateCode: string) => Promise - /** - * Edits a template's settings. - * - * @param guildId - The ID of the guild to edit a template of. - * @param templateCode - The code of the template to edit. - * @param options - The parameters for the edit of the template. - * @returns An instance of the edited {@link Template}. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * Fires a _Guild Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild-template#modify-guild-template} - */ - edit: (guildId: BigString, templateCode: string, options: ModifyGuildTemplate) => Promise> - /** - * Gets a template by its code. - * - * @param templateCode - The code of the template to get. - * @returns An instance of {@link Template}. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * @see {@link https://discord.com/developers/docs/resources/guild-template#get-guild-template} - */ - get: (templateCode: string) => Promise> - /** - * Gets the list of templates for a guild. - * - * @param guildId - The ID of the guild to get the list of templates for. - * @returns A collection of {@link Template} objects assorted by template code. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * @see {@link https://discord.com/developers/docs/resources/guild-template#get-guild-templates} - */ - list: (guildId: BigString) => Promise> - /** - * Synchronises a template with the current state of a guild. - * - * @param guildId - The ID of the guild to synchronise a template of. - * @returns An instance of the edited {@link Template}. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * Fires a _Guild Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild-template#get-guild-templates} - */ - sync: (guildId: BigString) => Promise> - } - /* Guild Members related helper methods. */ - members: { - /** - * Bans a user from a guild. - * - * @param guildId - The ID of the guild to ban the user from. - * @param userId - The ID of the user to ban from the guild. - * @param options - The parameters for the creation of the ban. - * - * @remarks - * Requires the `BAN_MEMBERS` permission. - * - * Fires a _Guild Ban Add_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#create-guild-ban} - */ - ban: (guildId: BigString, userId: BigString, options?: CreateGuildBan) => Promise - /** - * Edits the nickname of the bot user. - * - * @param guildId - The ID of the guild to edit the nickname of the bot user in. - * @param options - The parameters for the edit of the nickname. - * @returns An instance of the edited {@link DiscordMember} - * - * @remarks - * Fires a _Guild Member Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#modify-current-member} - */ - editSelf: (guildId: BigString, options: EditBotMemberOptions) => Promise> - /** - * Edits a member's properties. - * - * @param guildId - The ID of the guild to edit the member of. - * @param userId - The user ID of the member to edit. - * @param options - The parameters for the edit of the user. - * - * @remarks - * This endpoint requires various permissions depending on what is edited about the member. - * To find out the required permission to enact a change, read the documentation of this endpoint's {@link ModifyGuildMember | parameters}. - * - * Fires a _Guild Member Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-member} - */ - edit: (guildId: BigString, userId: BigString, options: ModifyGuildMember) => Promise> - /** - * Gets or creates a DM channel with a user. - * - * @param userId - The ID of the user to create the DM channel with. - * @returns An instance of {@link Channel}. - * - * @see {@link https://discord.com/developers/docs/resources/user#create-dm} - */ - dm: (userId: BigString) => Promise> - /** - * Gets the member object by user ID. - * - * @param guildId - The ID of the guild to get the member object for. - * @param userId - The ID of the user to get the member object for. - * @returns An instance of {@link DiscordMemberWithUser}. - * - * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-member} - */ - get: (guildId: BigString, userId: BigString) => Promise> - /** - * Gets the list of members for a guild. - * - * @param guildId - The ID of the guild to get the list of members for. - * @param options - The parameters for the fetching of the members. - * @returns A collection of {@link DiscordMemberWithUser} objects assorted by user ID. - * - * @remarks - * Requires the `GUILD_MEMBERS` intent. - * - * ⚠️ It is not recommended to use this endpoint with very large bots. Instead, opt to use `fetchMembers()`: - * REST communication only permits 50 requests to be made per second, while gateways allow for up to 120 requests - * per minute per shard. For more information, read {@link https://discord.com/developers/docs/topics/rate-limits#rate-limits}. - * - * @see {@link https://discord.com/developers/docs/resources/guild#list-guild-members} - * @see {@link https://discord.com/developers/docs/topics/gateway#request-guild-members} - * @see {@link https://discord.com/developers/docs/topics/rate-limits#rate-limits} - */ - list: (guildId: BigString, options: ListGuildMembers) => Promise> - /** - * Kicks a member from a guild. - * - * @param guildId - The ID of the guild to kick the member from. - * @param userId - The user ID of the member to kick from the guild. - * - * @remarks - * Requires the `KICK_MEMBERS` permission. - * - * Fires a _Guild Member Remove_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#remove-guild-member} - */ - kick: (guildId: BigString, userId: BigString, reason?: string) => Promise - /** - * Initiates the process of pruning inactive members. - * - * @param guildId - The ID of the guild to prune the members of. - * @param options - The parameters for the pruning of members. - * @returns A number indicating how many members were pruned. - * - * @remarks - * Requires the `KICK_MEMBERS` permission. - * - * ❗ Requests to this endpoint will time out for large guilds. To prevent this from happening, set the {@link BeginGuildPrune.computePruneCount} property of the {@link options} object parameter to `false`. This will begin the process of pruning, and immediately return `undefined`, rather than wait for the process to complete before returning the actual count of members that have been kicked. - * - * ⚠️ By default, this process will not remove members with a role. To include the members who have a _particular subset of roles_, specify the role(s) in the {@link BeginGuildPrune.includeRoles | includeRoles} property of the {@link options} object parameter. - * - * Fires a _Guild Member Remove_ gateway event for every member kicked. - * - * @see {@link https://discord.com/developers/docs/resources/guild#begin-guild-prune} - */ - prune: (guildId: BigString, options: BeginGuildPrune) => Promise<{ pruned: number | null }> - /** - * Gets the list of members whose usernames or nicknames start with a provided string. - * - * @param guildId - The ID of the guild to search in. - * @param query - The string to match usernames or nicknames against. - * @param options - The parameters for searching through the members. - * @returns A collection of {@link DiscordMember} objects assorted by user ID. - * - * @see {@link https://discord.com/developers/docs/resources/guild#search-guild-members} - */ - search: (guildId: BigString, query: string, options?: Omit) => Promise> - /** - * Unbans a user from a guild. - * - * @param guildId - The ID of the guild to unban the user in. - * @param userId - The ID of the user to unban. - * - * @remarks - * Requires the `BAN_MEMBERS` permission. - * - * Fires a _Guild Ban Remove_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#remove-guild-ban} - */ - unban: (guildId: BigString, userId: BigString) => Promise - } - /** Interaction related helper methods. */ - interactions: { - /** Command related helper methods. */ - commands: { - /** Methods for creating a command. */ - create: { - /** - * Creates an application command accessible globally; across different guilds and channels. - * - * @param command - The command to create. - * @returns An instance of the created {@link ApplicationCommand}. - * - * @remarks - * ⚠️ Creating a command with the same name as an existing command for your application will overwrite the old command. - * ⚠️ Global commands once created are cached for periods of __an hour__, so changes made to existing commands will take an hour to surface. - * ⚠️ You can only create up to 200 _new_ commands daily. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#create-global-application-command} - */ - global: (command: CreateApplicationCommand) => Promise> - /** - * Creates an application command only accessible in a specific guild. - * - * @param command - The command to create. - * @param guildId - The ID of the guild to create the command for. - * @returns An instance of the created {@link ApplicationCommand}. - * - * @remarks - * ⚠️ Creating a command with the same name as an existing command for your application will overwrite the old command. - * ⚠️ You can only create up to 200 _new_ commands daily. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command} - */ - guild: (command: CreateApplicationCommand, guildId: BigString) => Promise> - } - /** Methods for deleting a command. */ - delete: { - /** - * Deletes an application command registered globally. - * - * @param commandId - The ID of the command to delete. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command} - */ - global: (commandId: BigString) => Promise - /** - * Deletes an application command registered in a guild. - * - * @param guildId - The ID of the guild to delete the command from. - * @param commandId - The ID of the command to delete from the guild. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command} - */ - guild: (commandId: BigString, guildId: BigString) => Promise - } - /** Methods for editing a command. */ - edit: { - /** - * Edits a global application command. - * - * @param commandId - The ID of the command to edit. - * @param options - The parameters for the edit of the command. - * @returns An instance of the edited {@link ApplicationCommand}. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command} - */ - global: (commandId: BigString, options: CreateApplicationCommand) => Promise> - /** - * Edits an application command registered in a guild. - * - * @param guildId - The ID of the guild the command is registered in. - * @param commandId - The ID of the command to edit. - * @param options - The parameters for the edit of the command. - * @returns An instance of the edited {@link ApplicationCommand}. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command} - */ - guild: (commandId: BigString, guildId: BigString, options: CreateApplicationCommand) => Promise> - /** - * Edits the permissions for a guild application command. - * - * @param guildId - The ID of the guild the command is registered in. - * @param commandId - The ID of the command to edit the permissions of. - * @param bearerToken - The bearer token to use to make the request. - * @param options - The parameters for the edit of the command permissions. - * @returns An instance of the edited {@link ApplicationCommandPermission}. - * - * @remarks - * The bearer token requires the `applications.commands.permissions.update` scope to be enabled, and to have access to the guild whose ID has been provided in the parameters. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions} - */ - permissions: ( - guildId: BigString, - commandId: BigString, - bearerToken: string, - options: ApplicationCommandPermissions[], - ) => Promise> - } - /** Methods for getting a command. */ - get: { - global: { - /** - * Gets a global application command by its ID. - * - * @param commandId - The ID of the command to get. - * @returns An instance of {@link ApplicationCommand}. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-command} - */ - one: (commandId: BigString) => Promise> - /** - * Gets the list of your bot's global application commands. - * - * @returns A collection of {@link ApplicationCommand} objects assorted by command ID. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands} - */ - all: () => Promise> - } - guilds: { - /** - * Gets a guild application command by its ID. - * - * @param guildId - The ID of the guild the command is registered in. - * @param commandId - The ID of the command to get. - * @returns An instance of {@link ApplicationCommand}. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command} - */ - one: (commandId: BigString, guildId: BigString) => Promise> - /** - * Gets the list of application commands registered by your bot in a guild. - * - * @param guildId - The ID of the guild the commands are registered in. - * @returns A collection of {@link ApplicationCommand} objects assorted by command ID. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-commandss} - */ - all: (guildId: BigString) => Promise> - } - /** - * Gets the permissions of a guild application command. - * - * @param guildId - The ID of the guild the command is registered in. - * @param commandId - The ID of the command to get the permissions of. - * @returns An instance of {@link ApplicationCommandPermission}. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions} - */ - permission: (guildId: BigString, commandId: BigString) => Promise> - /** - * Gets the permissions of all application commands registered in a guild by the ID of the guild. - * - * @param guildId - The ID of the guild to get the permissions objects of. - * @returns A collection of {@link ApplicationCommandPermission} objects assorted by command ID. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions} - */ - permissions: (guildId: BigString) => Promise> - } - /** Methods for replacing existing commands in bulk. */ - replace: { - /** - * Re-registers the list of global application commands, overwriting the previous commands completely. - * - * @param commands - The list of commands to use to overwrite the previous list. - * @returns A collection of {@link ApplicationCommand} objects assorted by command ID. - * - * @remarks - * ❗ Commands that are not present in the `commands` array will be __deleted__. - * - * ⚠️ Commands that do not already exist will count towards the daily limit of _200_ new commands. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands} - */ - global: (commands: CreateApplicationCommand[]) => Promise> - /** - * Re-registers the list of application commands registered in a guild, overwriting the previous commands completely. - * - * @param guildId - The ID of the guild whose list of commands to overwrite. - * @param commands - The list of commands to use to overwrite the previous list. - * @returns A collection of {@link ApplicationCommand} objects assorted by command ID. - * - * @remarks - * ❗ Commands that are not present in the `commands` array will be __deleted__. - * - * ⚠️ Commands that do not already exist will count towards the daily limit of _200_ new commands. - * - * @see {@link https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands} - */ - guild: (guildId: BigString, commands: CreateApplicationCommand[]) => Promise> - } - } - /** Response related helper methods. */ - responses: { - /** Helper methods related to creating a response. */ - create: { - /** - * Sends a follow-up message to an interaction. - * - * @param token - The interaction token to use, provided in the original interaction. - * @param options - The parameters for the creation of the message. - * @returns An instance of the created {@link Message}. - * - * @remarks - * ⚠️ Interaction tokens are only valid for _15 minutes_. - * - * By default, mentions are suppressed. To enable mentions, pass a mention object with the callback data. - * - * Unlike `sendMessage()`, this endpoint allows the bot user to act without: - * - Needing to be able to see the contents of the channel that the message is in. (`READ_MESSAGES` permission.) - * - Requiring the `MESSAGE_CONTENT` intent. - * - * Fires a _Message Create_ event. - * - * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message} - */ - followup: (token: string, options: InteractionCallbackData) => Promise> - /** - * Sends a response to an interaction. - * - * @param interactionId - The ID of the interaction to respond to. - * @param token - The interaction token to use, provided in the original interaction. - * @param options - The parameters for the creation of the message. - * @returns An instance of the created {@link Message}. - * - * @remarks - * ⚠️ Interaction tokens are only valid for _15 minutes_. - * - * By default, mentions are suppressed. To enable mentions, pass a mention object with the callback data. - * - * Unlike `sendMessage()`, this endpoint allows the bot user to act without: - * - Needing to be able to see the contents of the channel that the message is in. (`READ_MESSAGES` permission.) - * - Requiring the `MESSAGE_CONTENT` intent. - * - * Fires a _Message Create_ event. - * - * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response} - */ - original: (interactionId: BigString, token: string, options: InteractionResponse) => Promise - } - /** Helper methods related to deleting a response. */ - delete: { - /** - * Deletes a follow-up message to an interaction. - * - * @param token - The interaction token to use, provided in the original interaction. - * @param messageId - The ID of the message to delete. - * - * @remarks - * Unlike `deleteMessage()`, this endpoint allows the bot user to act without needing to see the channel the message is in. - * - * Fires a _Message Delete_ event. - * - * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message} - */ - followup: (token: string, messageId: BigString) => Promise - /** - * Deletes the initial message response to an interaction. - * - * @param token - The interaction token to use, provided in the original interaction. - * - * @remarks - * Unlike `deleteMessage()`, this endpoint allows the bot user to act without needing to see the channel the message is in. - * - * Fires a _Message Delete_ event. - * - * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response} - */ - original: (token: string) => Promise - } - /** Helper methods related to editing a response. */ - edit: { - /** - * Edits a follow-up message to an interaction. - * - * @param token - The interaction token to use, provided in the original interaction. - * @param messageId - The ID of the message to edit. - * @param options - The parameters for the edit of the message. - * @returns An instance of the edited {@link Message}. - * - * @remarks - * Unlike `editMessage()`, this endpoint allows the bot user to act without needing to see the channel the message is in. - * - * Does not support ephemeral follow-up messages due to these being stateless. - * - * Fires a _Message Update_ event. - * - * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message} - */ - followup: (token: string, messageId: BigString, options: InteractionCallbackData) => Promise> - /** - * Edits the initial message response to an interaction. - * - * @param token - The interaction token to use, provided in the original interaction. - * @param options - The parameters for the edit of the response. - * @returns An instance of the edited {@link Message}. - * - * @remarks - * Unlike `editMessage()`, this endpoint allows the bot user to act without needing to see the channel the message is in. - * - * Does not support ephemeral follow-up messages due to these being stateless. - * - * Fires a _Message Update_ event. - * - * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response} - */ - original: (token: string, options: InteractionCallbackData) => Promise | undefined> - } - /** Helper methods related to getting a response. */ - get: { - /** - * Gets a follow-up message to an interaction by the ID of the message. - * - * @param token - The interaction token to use, provided in the original interaction. - * @param messageId - The ID of the message to get. - * @returns An instance of {@link Message}. - * - * @remarks - * Unlike `getMessage()`, this endpoint allows the bot user to act without: - * - Needing to be able to see the contents of the channel that the message is in. (`READ_MESSAGES` permission.) - * - Requiring the `MESSAGE_CONTENT` intent. - * - * Does not support ephemeral follow-up messages due to these being stateless. - * - * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#get-followup-message} - */ - followup: (token: string, messageId: BigString) => Promise> - /** - * Gets the initial message response to an interaction. - * - * @param token - The interaction token to use, provided in the original interaction. - * @returns An instance of {@link Message}. - * - * @remarks - * Unlike `getMessage()`, this endpoint allows the bot user to act without: - * - Needing to be able to see the contents of the channel that the message is in. (`READ_MESSAGES` permission.) - * - Requiring the `MESSAGE_CONTENT` intent. - * - * Does not support ephemeral follow-up messages due to these being stateless. - * - * @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response} - */ - original: (token: string) => Promise> - } - } - } - /** Role related helpers methods. */ - roles: { - /** - * Adds a role to a member. - * - * @param guildId - The ID of the guild the member to add the role to is in. - * @param userId - The user ID of the member to add the role to. - * @param roleId - The ID of the role to add to the member. - * - * @remarks - * Requires the `MANAGE_ROLES` permission. - * - * Fires a _Guild Member Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#add-guild-member-role} - */ - add: (guildId: BigString, userId: BigString, roleId: BigString, reason?: string) => Promise - /** - * Creates a role in a guild. - * - * @param guildId - The ID of the guild to create the role in. - * @param options - The parameters for the creation of the role. - * @returns An instance of the created {@link DiscordRole}. - * - * @remarks - * Requires the `MANAGE_ROLES` permission. - * - * Fires a _Guild Role Create_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#create-guild-role} - */ - create: (guildId: BigString, options: CreateGuildRole, reason?: string) => Promise> - /** - * Deletes a role from a guild. - * - * @param guildId - The ID of the guild to delete the role from. - * @param roleId - The ID of the role to delete. - * - * @remarks - * Requires the `MANAGE_ROLES` permission. - * - * Fires a _Guild Role Delete_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#delete-guild-role} - */ - delete: (guildId: BigString, roleId: BigString) => Promise - /** - * Edits a role in a guild. - * - * @param guildId - The ID of the guild to edit the role in. - * @param roleId - The ID of the role to edit. - * @param options - The parameters for the edit of the role. - * @returns An instance of the edited {@link DiscordRole}. - * - * @remarks - * Requires the `MANAGE_ROLES` permission. - * - * Fires a _Guild Role Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-role} - */ - edit: (guildId: BigString, roleId: BigString, options: EditGuildRole) => Promise> - /** - * Edits the positions of a set of roles. - * - * @param guildId - The ID of the guild to edit the role positions in. - * @param options - The parameters for the edit of the role positions. - * @returns A collection of {@link DiscordRole} objects assorted by role ID. - * - * @remarks - * Requires the `MANAGE_ROLES` permission. - * - * Fires a _Guild Role Update_ gateway event for every role impacted in this change. - * - * @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-role-positions} - */ - positions: (guildId: BigString, options: ModifyRolePositions[]) => Promise> - /** - * Gets the list of roles for a guild. - * - * @param guildId - The ID of the guild to get the list of roles for. - * @returns A collection of {@link DisorcRole} objects assorted by role ID. - * - * @remarks - * ⚠️ This endpoint should be used sparingly due to {@link User} objects already being included in guild payloads. - * - * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-roles} - */ - list: (guildId: BigString) => Promise> - /** - * Removes a role from a member. - * - * @param guildId - The ID of the guild the member to remove the role from is in. - * @param userId - The user ID of the member to remove the role from. - * @param roleId - The ID of the role to remove from the member. - * - * @remarks - * Requires the `MANAGE_ROLES` permission. - * - * Fires a _Guild Member Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/guild#remove-guild-member-role} - */ - remove: (guildId: BigString, userId: BigString, roleId: BigString, reason?: string) => Promise - } - /** - * Gets information about the vanity url of a guild. - * - * @param guildId - The ID of the guild to get the vanity url information for. - * @returns An instance of {@link VanityUrl}. - * - * @remarks - * Requires the `MANAGE_GUILD` permission. - * - * The `code` property will be `null` if the guild does not have a set vanity url. - * - * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-vanity-url} - */ - vanity: (guildId: BigString) => Promise> - /** - * Gets the list of voice regions for a guild. - * - * @param guildId - The ID of the guild to get the voice regions for. - * @returns A collection of {@link VoiceRegions | VoiceRegion} objects assorted by voice region ID. - * - * @see {@link https://discord.com/developers/docs/resources/guild#get-guild-voice-regions} - */ - regions: (guildId: BigString) => Promise> - } - /** - * Returns a sticker object for the given sticker ID. - * - * @param stickerId The ID of the sticker to get - * @returns A {@link DiscordSticker} - * - * @see {@link https://discord.com/developers/docs/resources/sticker#get-sticker} - */ - sticker: (stickerId: BigString) => Promise> - /** Webhook related helper methods. */ - webhooks: { - /** - * Creates a webhook. - * - * @param channelId - The ID of the channel to create the webhook in. - * @param options - The parameters for the creation of the webhook. - * @returns An instance of the created {@link DiscordWebhook}. - * - * @remarks - * Requires the `MANAGE_WEBHOOKS` permission. - * - * ⚠️ The webhook name must not contain the string 'clyde' (case-insensitive). - * - * Fires a _Webhooks Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/webhook#create-webhook} - */ - create: (channelId: BigString, options: CreateWebhook) => Promise> - /** Methods to delete a webhook. */ - delete: { - with: { - /** - * Deletes a webhook. - * - * @param id - The ID of the webhook to delete. - * - * @remarks - * Requires the `MANAGE_WEBHOOKS` permission. - * - * Fires a _Webhooks Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/webhook#delete-webhook} - */ - id: (id: BigString, reason?: string) => Promise - /** - * Deletes a webhook message using the webhook token, thereby bypassing the need for authentication + permissions. - * - * @param id - The ID of the webhook to delete the message belonging to. - * @param token - The webhook token, used to delete the webhook. - * - * @remarks - * Fires a _Message Delete_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/webhook#delete-webhook-with-token} - */ - token: (id: BigString, token: string) => Promise - } - } - /** Methods related to editing a webhook. */ - edit: { - with: { - /** - * Edits a webhook. - * - * @param webhookId - The ID of the webhook to edit. - * @returns An instance of the edited {@link DiscordWebhook}. - * - * @remarks - * Requires the `MANAGE_WEBHOOKS` permission. - * - * Fires a _Webhooks Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/webhook#edit-webhook} - */ - id: (webhookId: BigString, options: ModifyWebhook) => Promise> - /** - * Edits a webhook using the webhook token, thereby bypassing the need for authentication + permissions. - * - * @param webhookId - The ID of the webhook to edit. - * @param token - The webhook token, used to edit the webhook. - * @returns An instance of the edited {@link DiscordWebhook}. - * - * @remarks - * Requires the `MANAGE_WEBHOOKS` permission. - * - * Fires a _Webhooks Update_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token} - */ - token: (webhookId: BigString, token: string, options: Omit) => Promise> - } - } - /** - * Executes a webhook, causing a message to be posted in the channel configured for the webhook. - * - * @param webhookId - The ID of the webhook to execute. - * @param token - The webhook token, used to execute the webhook. - * @param options - The parameters for the execution of the webhook. - * @returns An instance of the created {@link DiscordMessage}, or `undefined` if the {@link ExecuteWebhook.wait | wait} property of the {@link options} object parameter is set to `false`. - * - * @remarks - * If the webhook channel is a forum channel, you must provide a value for either `threadId` or `threadName`. - * - * @see {@link https://discord.com/developers/docs/resources/webhook#execute-webhook} - */ - execute: (webhookId: BigString, token: string, options: ExecuteWebhook) => Promise | undefined> - /** Methods related to getting webhooks. */ - get: { - /** - * Gets a list of webhooks for a channel. - * - * @param channelId - The ID of the channel which to get the webhooks of. - * @returns A collection of {@link DiscordWebhook} objects assorted by webhook ID. - * - * @remarks - * Requires the `MANAGE_WEBHOOKS` permission. - * - * @see {@link https://discord.com/developers/docs/resources/webhook#get-channel-webhooks} - */ - channel: (channelId: BigString) => Promise> - /** - * Gets the list of webhooks for a guild. - * - * @param guildId - The ID of the guild to get the list of webhooks for. - * @returns A collection of {@link DiscordWebhook} objects assorted by webhook ID. - * - * @remarks - * Requires the `MANAGE_WEBHOOKS` permission. - * - * @see {@link https://discord.com/developers/docs/resources/webhook#get-guild-webhooks} - */ - guild: (guildId: BigString) => Promise> - /** - * Gets a webhook message by its ID. - * - * @param webhookId - The ID of the webhook to get a message of. - * @param token - The webhook token, used to get webhook messages. - * @param messageId - the ID of the webhook message to get. - * @param options - The parameters for the fetching of the message. - * @returns An instance of {@link DiscordMessage}. - * - * @see {@link https://discord.com/developers/docs/resources/webhook#get-webhook-message} - */ - message: (webhookId: BigString, token: string, messageId: BigString, options?: GetWebhookMessageOptions) => Promise> - with: { - /** - * Gets a webhook by its ID. - * - * @param webhookId - The ID of the webhook to get. - * @returns An instance of {@link DiscordWebhook}. - * - * @remarks - * Requires the `MANAGE_WEBHOOKS` permission. - * - * @see {@link https://discord.com/developers/docs/resources/webhook#get-webhook} - */ - id: (webhookId: BigString) => Promise> - /** - * Gets a webhook using the webhook token, thereby bypassing the need for authentication + permissions. - * - * @param webhookId - The ID of the webhook to get. - * @param token - The webhook token, used to get the webhook. - * @returns An instance of {@link DiscordWebhook}. - * - * @see {@link https://discord.com/developers/docs/resources/webhook#get-webhook-with-token} - */ - token: (webhookId: BigString, token: string) => Promise> - } - } - /** Methods related to message sent by a webhook. */ - messages: { - /** - * Deletes a webhook message. - * - * @param webhookId - The ID of the webhook to delete the message belonging to. - * @param token - The webhook token, used to manage the webhook. - * @param messageId - The ID of the message to delete. - * @param options - The parameters for the deletion of the message. - * - * @remarks - * Fires a _Message Delete_ gateway event. - * - * @see {@link https://discord.com/developers/docs/resources/webhook#delete-webhook} - */ - delete: (webhookId: BigString, token: string, messageId: BigString, options?: DeleteWebhookMessageOptions) => Promise - /** Methods related to editing messages sent by a webhook. */ - edit: WebhookMessageEditor - } - } - /** User related helper methods. */ - users: { - /** - * Gets or creates a DM channel with a user. - * - * @param userId - The ID of the user to create the DM channel with. - * @returns An instance of {@link DiscordChannel}. - * - * @see {@link https://discord.com/developers/docs/resources/user#create-dm} - */ - channel: (userId: BigString) => Promise> - } /** * Adds a reaction to a message. * @@ -4597,6 +2014,21 @@ export interface RestManager { * @see {@link https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command} */ createGuildApplicationCommand: (command: CreateApplicationCommand, guildId: BigString) => Promise> + /** + * Creates a guild from a template. + * + * @param templateCode - The code of the template. + * @param options - The parameters for the creation of the guild. + * @returns An instance of the created {@link Guild}. + * + * @remarks + * ⚠️ This route can only be used by bots in __fewer than 10 guilds__. + * + * Fires a _Guild Create_ gateway event. + * + * @see {@link https://discord.com/developers/docs/resources/guild-template#create-guild-from-guild-template} + */ + createGuildFromTemplate: (templateCode: string, options: CreateGuildFromTemplate) => Promise> /** * Create a new sticker for the guild. * diff --git a/packages/types/src/discordeno.ts b/packages/types/src/discordeno.ts index e023e39ed..2e923f4f6 100644 --- a/packages/types/src/discordeno.ts +++ b/packages/types/src/discordeno.ts @@ -1059,3 +1059,11 @@ export interface EditGuildStickerOptions extends WithReason { /** Autocomplete/suggestion tags for the sticker (max 200 characters) */ tags?: string } + +/** https://discord.com/developers/docs/resources/template#create-guild-from-template-json-params */ +export interface CreateGuildFromTemplate { + /** Name of the guild (2-100 characters) */ + name: string + /** base64 128x128 image for the guild icon */ + icon?: string +}