You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to add a member to my guild that is already an existing member like so
constaddOpts={ accessToken,roles: roleIds,fetchWhenExisting: false};constguildMember=awaitguild.members.add(discordId,addOpts);if(!guildMember){constexistingGuildMember=awaitguild.members.fetch({user: discordId});// more logic}
but am getting the following uncaught exception:
TypeError: Cannot read properties of undefined (reading 'id')
at GuildMemberManager._add (/node_modules/discord.js/src/managers/GuildMemberManager.js:39:52)
at GuildMemberManager.add (/node_modules/discord.js/src/managers/GuildMemberManager.js:139:14)
The issue seems to be in this section here in the add function:
constdata=awaitthis.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.returndatainstanceofUint8Array
? options.fetchWhenExisting===false
? null
: this.fetch(userId)
: this._add(data);
The comment indicates that the returned result should be a Uint8Array if the member is already in the guild, but I am getting an empty ArrayBuffer instead.
I added the following log statements:
Which package is this bug report for?
discord.js
Issue description
I am attempting to add a member to my guild that is already an existing member like so
but am getting the following uncaught exception:
The issue seems to be in this section here in the
add
function:The comment indicates that the returned result should be a
Uint8Array
if the member is already in the guild, but I am getting an emptyArrayBuffer
instead.I added the following log statements:
and got the following output:
And I do not think it's an oauth/bot permission issue because I'm able to successfully add a member to the guild if they are not already a member.
Code sample
No response
Versions
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
No Partials
Which gateway intents are you subscribing to?
Guilds, GuildMembers
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered: