const guildMembersResponse = fetch(`http://discordapp.com/api/guilds/440494010595803136/members/278628366213709824`,
{
method: 'PUT',
headers: {
Authorization: `Bearer TOKEN`,
},
});
setTimeout(() => {
console.log(guildMembersResponse)
}, 500);
I want to join a user to my Discord server with his userid and his token in nodejs, but if I request the Dicord api I get an error:
Promise {
Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: { body: [PassThrough], disturbed: false, error:
null },
[Symbol(Response internals)]:
{ url:
'https://discordapp.com/api/guilds/440494010595803136/members/278628366213709824',
status: 401,
statusText: 'UNAUTHORIZED',
headers: [Headers] } } }
I am using the node-fetch library!
I just had to replace the "ContentType" to "Content-Type" in the headers!
headers: {
"Authorization": "Bot [botToken]",
"Content-Type": "application/json",
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With