Skip to content

Commit

Permalink
Fix set Member XP + Shortcuts
Browse files Browse the repository at this point in the history
Merge pull request #63 from raphckrman/dev
  • Loading branch information
pakkographic authored May 10, 2024
2 parents a4a35a4 + 51f2f2f commit 668e4f3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/routes/Guilds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export class Guilds {
async setMemberXP(guildID: string, memberID: string, amount: PUTGuildMemberXPBody["total"]): Promise<number>{
if (typeof amount !== "number") throw new TypeError("amount must be an integer/number.");
return this.#manager.authRequest<PUTGuildMemberXPResponse>({
method: "POST",
method: "PUT",
path: endpoints.GUILD_MEMBER_XP(guildID, memberID),
json: { total: amount }
}).then(data => Number(data.total));
Expand Down
24 changes: 24 additions & 0 deletions lib/structures/Guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,28 @@ export class Guild extends Base<string> {
async deleteCategory(categoryID: number): Promise<GuildCategory> {
return this.client.rest.guilds.deleteCategory(this.id as string, categoryID);
}

/** Award a member using the built-in EXP system.
* @param memberID ID of the member to award.
* @param amount Amount of experience to give.
*/
async awardMember(memberID: string, amount: number): Promise<number>{
return this.client.rest.guilds.awardMember(this.id as string, memberID, amount);
}

/** Set member's experience using the built-in EXP system.
* @param memberID ID of the member to award.
* @param amount Amount of experience to set.
*/
async setMemberXP(memberID: string, amount: number): Promise<number>{
return this.client.rest.guilds.setMemberXP(this.id as string, memberID, amount);
}

/** Award every members of a guild having a role using the built-in EXP system.
* @param roleID ID of a role.
* @param amount Amount of experience.
*/
async awardRole(roleID: number, amount: number): Promise<void> {
return this.client.rest.guilds.awardRole(this.id as string, roleID, amount);
}
}

0 comments on commit 668e4f3

Please sign in to comment.