@MHMD
DIAdiscord.js - Imagine an app
•Created by @MHMD on 8/23/2024 in #djs-questions
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 true5 replies