get channels
app.post('/channels', async (req, res) => {
const accessToken = req.body.accessToken;
const guildId = req.body.guildId;
try {
const response = await axios.get(
https://discord.com/api/guilds/${guildId}/channels
, {
headers: {
Authorization: Bearer ${accessToken}
}
})
const channels = response.data.filter(channel => channel.type === 0)
res.status(200).send(channels)
} catch (err) {
console.error(err)
res.status(500).send("Error")
}
})
it gives me an error
{ message: '401: Unauthorized', code: 0 }
the accessToken and guildId are true4 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by staffnot djs related as you arent using djs, #other-js-ts #useful-servers
Does the bot have to be inside the server
...yes