diff --git a/lib/routes/Guilds.ts b/lib/routes/Guilds.ts index 011da6c..3565731 100644 --- a/lib/routes/Guilds.ts +++ b/lib/routes/Guilds.ts @@ -41,8 +41,8 @@ import { PATCHGuildGroupBody, PATCHGuildGroupResponse, PATCHGuildRoleBody, - PATCHGuildRoleUpdateBody, - PATCHGuildRoleUpdateResponse, + PATCHGuildRolePermissionUpdateBody, + PATCHGuildRolePermissionUpdateResponse, PATCHUpdateCategoryBody, PATCHUpdateCategoryResponse, Permissions, @@ -56,15 +56,15 @@ import { POSTGuildBanResponse, POSTGuildGroupBody, POSTGuildGroupResponse, - POSTGuildMemberXPBody, - POSTGuildMemberXPResponse, + POSTAwardGuildMemberXPBody, + POSTAwardGuildMemberXPResponse, POSTGuildRoleBody, POSTGuildRoleResponse, - POSTGuildRoleXPBody, + POSTAwardGuildRoleXPBody, POSTGuildWebhookResponse, PUTBulkSetXPResponse, - PUTGuildMemberXPBody, - PUTGuildMemberXPResponse, + PUTAwardGuildMemberXPBody, + PUTAwardGuildMemberXPResponse, PUTGuildWebhookResponse } from "../Constants"; import { AnyChannel, CreateChannelOptions, EditChannelOptions } from "../types/channel"; @@ -392,10 +392,10 @@ export class Guilds { * @param memberID ID of a member. * @param amount Amount of experience. */ - async awardMember(guildID: string, memberID: string, amount: POSTGuildMemberXPBody["amount"]): Promise{ + async awardMember(guildID: string, memberID: string, amount: POSTAwardGuildMemberXPBody["amount"]): Promise{ if (typeof amount !== "number") // check for JS throw new TypeError("amount must be an integer/number."); - return this.#manager.authRequest({ + return this.#manager.authRequest({ method: "POST", path: endpoints.GUILD_MEMBER_XP(guildID, memberID), json: { amount } @@ -407,10 +407,10 @@ export class Guilds { * @param memberID ID of a member. * @param amount Total amount of experience. */ - async setMemberXP(guildID: string, memberID: string, amount: PUTGuildMemberXPBody["total"]): Promise{ + async setMemberXP(guildID: string, memberID: string, amount: PUTAwardGuildMemberXPBody["total"]): Promise{ if (typeof amount !== "number") // check for JS throw new TypeError("amount must be an integer/number."); - return this.#manager.authRequest({ + return this.#manager.authRequest({ method: "PUT", path: endpoints.GUILD_MEMBER_XP(guildID, memberID), json: { total: amount } @@ -422,7 +422,7 @@ export class Guilds { * @param roleID ID of a role. * @param amount Amount of experience. */ - async awardRole(guildID: string, roleID: number, amount: POSTGuildRoleXPBody["amount"]): Promise{ + async awardRole(guildID: string, roleID: number, amount: POSTAwardGuildRoleXPBody["amount"]): Promise{ if (typeof amount !== "number") // check for JS throw new TypeError("amount must be an integer/number."); return this.#manager.authRequest({ @@ -666,7 +666,7 @@ export class Guilds { return this.#manager.authRequest({ method: "GET", path: endpoints.GUILD_MEMBER_PERMISSION(guildID, memberID) - }).then(data => data.permissions); + }).then(data => data.permissions as Array); } /** @@ -675,8 +675,8 @@ export class Guilds { * @param roleID ID of the role. * @param options Permission to edit. */ - async editRolePermission(guildID: string, roleID: number, options: PATCHGuildRoleUpdateBody): Promise { - return this.#manager.authRequest({ + async editRolePermission(guildID: string, roleID: number, options: PATCHGuildRolePermissionUpdateBody): Promise { + return this.#manager.authRequest({ method: "PATCH", path: endpoints.GUILD_ROLE_UPDATE_PERMISSION(guildID, roleID), json: options diff --git a/lib/structures/Client.ts b/lib/structures/Client.ts index 0a7a766..0d49c4a 100644 --- a/lib/structures/Client.ts +++ b/lib/structures/Client.ts @@ -73,7 +73,7 @@ import { POSTChannelRolePermissionBody, POSTChannelUserPermissionBody, PATCHChannelRolePermissionBody, - PATCHGuildRoleUpdateBody, + PATCHGuildRolePermissionUpdateBody, Permissions, POSTChannelCategoryUserPermissionBody, PATCHChannelCategoryUserPermissionBody @@ -1458,7 +1458,7 @@ export class Client extends TypedEmitter { async editGuildRolePermission( guildID: string, roleID: number, - options: PATCHGuildRoleUpdateBody + options: PATCHGuildRolePermissionUpdateBody ): Promise { return this.rest.guilds.editRolePermission(guildID, roleID, options); } diff --git a/lib/structures/GuildRole.ts b/lib/structures/GuildRole.ts index 4675abc..7a61720 100644 --- a/lib/structures/GuildRole.ts +++ b/lib/structures/GuildRole.ts @@ -8,7 +8,7 @@ import { Base } from "./Base"; import { Client } from "./Client"; import { JSONGuildRole } from "../types/json"; -import { APIGuildRole, PATCHGuildRoleUpdateBody, Permissions } from "guildedapi-types.ts/v1"; +import { APIGuildRole, PATCHGuildRolePermissionUpdateBody, Permissions } from "guildedapi-types.ts/v1"; /** Class representing a guild role. */ export class GuildRole extends Base { @@ -118,7 +118,7 @@ export class GuildRole extends Base { } /** Edit the role permission */ - async editPermission(options: PATCHGuildRoleUpdateBody): Promise{ + async editPermission(options: PATCHGuildRolePermissionUpdateBody): Promise{ return this.client.rest.guilds.editRolePermission( this.guildID as string, this.id as number, diff --git a/package.json b/package.json index e85064f..3e7a572 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "typescript": "^4.9.4" }, "dependencies": { - "guildedapi-types.ts": "0.3.59", + "guildedapi-types.ts": "0.3.61", "undici": "^6.19.2", "ws": "^8.11.0" },