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 true
4 Replies
d.js toolkit
d.js toolkit3mo ago
- 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 staff
treble/luna
treble/luna3mo ago
not djs related as you arent using djs, #other-js-ts #useful-servers
@MHMD
@MHMDOP3mo ago
Does the bot have to be inside the server
treble/luna
treble/luna3mo ago
...yes
Want results from more Discord servers?
Add your server