Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

654
Views
AxiosError: Request failed with status code 401

I'm working on a userbanner command that is in discord.js v13 and I get this error and I have no idea how I can fix it

Error: https://i.stack.imgur.com/xuFXB.png

CODE:

const { Discord, MessageEmbed } = require(`discord.js`);
const axios = require(`axios`)

module.exports = {
  name: "UserBanner",
  category: "🔰 Information",
  permissions: ["SEND_MESSAGES"],
  aliases: ["userbanner", "memberbanner"],
  usage: "userbanner <@user>",
  description: "Get the Banner of a user",
 
  run: async (client, message, args) => {

    let user = message.mentions.users.first() || client.users.cache.get(args[0]) || message.author;

    try {
      const data = await
      axios.get(`https://discord.com/api/users/${user.id}`, {
        headers: {
          Authorization: `Bot: ${client.token}`
        }
      }).then(d => d.data);
      if(data.banner){
        let url = data.banner.startsWith("a_") ? ".gif?size=4096" : ".png?size=4-96";
        url = `https://cdn.discordapp.com/baners*${user.id}/${data.banner}${url}`;
        let avatar = user.displayAvatarURL({ dynamic: true})
        let embed = new MessageEmbed()
        .setColor(`#ffffff`)
        .setTitle(`${user.tag} banner`)
        .setImage(url)
        .setThumbnail(avatar)
        message.channel.send({ embeds: [embed]})
      } else {
        message.channel.send({ content: `<a:mark_rejected:975425274487398480> **Has no Banner!**`})
      };
    } catch(err){
      console.log(err)
    }
  }
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!