From f8b74f2ebcf25eaad754762f3585b2278831aa4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl?= <41128238+raphckrman@users.noreply.github.com> Date: Sat, 11 May 2024 00:37:35 +0200 Subject: [PATCH 1/3] fix set member XP --- lib/routes/Guilds.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/routes/Guilds.ts b/lib/routes/Guilds.ts index 1b0846c..a5f3656 100644 --- a/lib/routes/Guilds.ts +++ b/lib/routes/Guilds.ts @@ -326,7 +326,7 @@ export class Guilds { async setMemberXP(guildID: string, memberID: string, amount: PUTGuildMemberXPBody["total"]): Promise{ if (typeof amount !== "number") throw new TypeError("amount must be an integer/number."); return this.#manager.authRequest({ - method: "POST", + method: "PUT", path: endpoints.GUILD_MEMBER_XP(guildID, memberID), json: { total: amount } }).then(data => Number(data.total)); From 92887517dcaed572383a9f67553006e4d207882e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl?= <41128238+raphckrman@users.noreply.github.com> Date: Sat, 11 May 2024 00:49:35 +0200 Subject: [PATCH 2/3] Add Shortcuts --- lib/routes/Guilds.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/routes/Guilds.ts b/lib/routes/Guilds.ts index a5f3656..076e0e3 100644 --- a/lib/routes/Guilds.ts +++ b/lib/routes/Guilds.ts @@ -768,4 +768,28 @@ export class Guilds { path: endpoints.GUILD_CATEGORY_ROLE_PERMISSION(guildID, categoryID, targetID) }); } + + /** 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{ + 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{ + 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 { + return this.client.rest.guilds.awardRole(this.id as string, roleID, amount); + } } From 51f2f2f3a20ebde58b3e0e5f3d6f61147cd4b15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl?= <41128238+raphckrman@users.noreply.github.com> Date: Sat, 11 May 2024 00:56:34 +0200 Subject: [PATCH 3/3] Ooooops --- lib/routes/Guilds.ts | 24 ------------------------ lib/structures/Guild.ts | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/routes/Guilds.ts b/lib/routes/Guilds.ts index 076e0e3..a5f3656 100644 --- a/lib/routes/Guilds.ts +++ b/lib/routes/Guilds.ts @@ -768,28 +768,4 @@ export class Guilds { path: endpoints.GUILD_CATEGORY_ROLE_PERMISSION(guildID, categoryID, targetID) }); } - - /** 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{ - 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{ - 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 { - return this.client.rest.guilds.awardRole(this.id as string, roleID, amount); - } } diff --git a/lib/structures/Guild.ts b/lib/structures/Guild.ts index efa2a80..fd1f0f7 100644 --- a/lib/structures/Guild.ts +++ b/lib/structures/Guild.ts @@ -237,4 +237,28 @@ export class Guild extends Base { async deleteCategory(categoryID: number): Promise { 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{ + 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{ + 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 { + return this.client.rest.guilds.awardRole(this.id as string, roleID, amount); + } }