diff --git a/packages/core/src/api/guild.ts b/packages/core/src/api/guild.ts index c1b6a9cac..fc5c6e461 100644 --- a/packages/core/src/api/guild.ts +++ b/packages/core/src/api/guild.ts @@ -92,6 +92,8 @@ import { type RESTPostAPIGuildsMFAResult, type RESTPostAPIGuildsResult, type RESTPutAPIGuildBanJSONBody, + type RESTPutAPIGuildMemberJSONBody, + type RESTPutAPIGuildMemberResult, type RESTPutAPIGuildOnboardingJSONBody, type RESTPutAPIGuildOnboardingResult, type RESTPutAPIGuildTemplateSyncResult, @@ -167,6 +169,27 @@ export class GuildsAPI { await this.rest.delete(Routes.guild(guildId), { reason, signal }); } + /** + * Adds user to the guild + * + * @see {@link https://discord.com/developers/docs/resources/guild#add-guild-member} + * @param guildId - The id of the guild to add the user to + * @param userId - The id of the user to add + * @param body - The data for adding users to the guild + * @param options - The options for adding users to the guild + */ + public async addMember( + guildId: Snowflake, + userId: Snowflake, + body: RESTPutAPIGuildMemberJSONBody, + { signal }: Pick = {}, + ) { + return this.rest.put(Routes.guildMember(guildId, userId), { + body, + signal, + }) as Promise; + } + /** * Fetches all the members of a guild *