Skip to content

Commit

Permalink
feat: add guild member (#9877)
Browse files Browse the repository at this point in the history
* feat: add guild member

* slightly change the description for the guildId and userId parameters in the addMember function

* fix description syntax

* Update packages/core/src/api/guild.ts

Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com>

* add jsdoc for options param

* fix formatting

* add missed semicolon

Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com>

* style: prettier

---------

Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
4 people committed Nov 5, 2023
1 parent c2349d4 commit c051ed9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/core/src/api/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ import {
type RESTPostAPIGuildsMFAResult,
type RESTPostAPIGuildsResult,
type RESTPutAPIGuildBanJSONBody,
type RESTPutAPIGuildMemberJSONBody,
type RESTPutAPIGuildMemberResult,
type RESTPutAPIGuildOnboardingJSONBody,
type RESTPutAPIGuildOnboardingResult,
type RESTPutAPIGuildTemplateSyncResult,
Expand Down Expand Up @@ -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<RequestData, 'signal'> = {},
) {
return this.rest.put(Routes.guildMember(guildId, userId), {
body,
signal,
}) as Promise<RESTPutAPIGuildMemberResult>;
}

/**
* Fetches all the members of a guild
*
Expand Down

0 comments on commit c051ed9

Please sign in to comment.