I want to add a member to a guild with Discord oAuth2 system but with the new Discord.JS update, it has changed... I searched but I didn't found anything...
My code was
await client.api.guilds(guildId).members(client.users.resolveId(interaction.member.id)).put({ data: { access_token: data.access_token, roles: (user?.[0]?.roles == "") ? [] : userRoles } })
.then(async () => {...
where guildId is a Guild.id, access_token is an access token generated with oauth2 (it worked with the old version) and user an object, parsed from my database.
I tried differently with Guild.addMember but it didn't work too (addMember is not a function)
Can someone help me?
EDIT: Just found an answer by myself... (see my answer below)
Okay I just fount while coding something else, to add someone to a guild, you can use the Guild.members.add function