Discord Oauth2加入公会 [英] Discord Oauth2 Join Guild
本文介绍了Discord Oauth2加入公会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
const guildMembersResponse = fetch(`http://discordapp.com/api/guilds/440494010595803136/members/278628366213709824`,
{
method: 'PUT',
headers: {
Authorization: `Bearer TOKEN`,
},
});
setTimeout(() => {
console.log(guildMembersResponse)
}, 500);
我想使用用户ID和令牌在Node.js中将用户加入Discord服务器,但是如果我请求Dicord api,则会收到错误消息:
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] } } }
我正在使用 node-fetch 库!
推荐答案
我只需要将ContentType替换为"Content-Type"
I just had to replace the ContentType to "Content-Type"
headers: {
"Authorization": "Bot [botToken]",
"Content-Type": "application/json",
},
这篇关于Discord Oauth2加入公会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文