fix(GuildMemberManager): Fix data type check for add() method (#10338)

fix(GuildMemberManager): fix data type check

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Jiralite 2024-06-29 07:48:32 +01:00 committed by GitHub
parent 9c76bbea17
commit ab8bf0f4d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -128,8 +128,9 @@ class GuildMemberManager extends CachedManager {
resolvedOptions.roles = resolvedRoles;
}
const data = await this.client.rest.put(Routes.guildMember(this.guild.id, userId), { body: resolvedOptions });
// Data is an empty Uint8Array if the member is already part of the guild.
return data instanceof Uint8Array
// Data is an empty array buffer if the member is already part of the guild.
return data instanceof ArrayBuffer
? options.fetchWhenExisting === false
? null
: this.fetch(userId)