#DisplayAvatarURL taking too much time to exec
1 messages · Page 1 of 1 (latest)
I mean that if you put a console.log just above this code, it should be peintes instantly as you send the command
yes
these are my intents
const client = new Discord.Client({ intents, partials: ['CHANNEL', 'MESSAGE', 'GUILD_MEMBER', 'REACTION'] })```
just
all
intents
and
const { MessageEmbed } = require('discord.js')
module.exports = {
name: 'avatar',
aliases: ['av', 'ab', 'ac', 'ah', 'pfp', 'avi', 'ico', 'icon'],
permissions: [],
description: 'displays a users avatar',
usage: `- $avatar <mention>\n- $avatar <username>\n- $avatar <tag/id>`,
async execute(client, message, cmd, args, Discord) {
const noEmote = '';
const yesEmote = '';
const warnEmote = '';
let member = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || message.guild.members.cache.find(m => m.displayName.toLowerCase() === args.join(' ')?.toLocaleLowerCase()) || message.guild.members.cache.find(m => m.user.username.toLowerCase() === args.join(' ')?.toLocaleLowerCase() || message.guild.members.cache.find(m => m.user.tag.toLowerCase() === args.join(' ')?.toLocaleLowerCase())) || message.guild.members.cache.find(m => m.user.username.toLowerCase().includes(args.join(' '))) || message.member
let author = message.author
if (!args[0]) {
let e = new MessageEmbed()
.setDescription(`[*${author.username}'s avatar*](${author.displayAvatarURL()})`)
.setURL(author.displayAvatarURL())
.setImage(author.displayAvatarURL({ dynamic: true, size: 4096 }))
.setFooter({ text: `Requested by ${author.tag}` })
.setColor(`#303135`)
await message.reply({ embeds: [e] })
} else {
let e = new MessageEmbed()
.setDescription(`[*${member.user.username}'s avatar*](${member.user.displayAvatarURL()})`)
.setImage(member.user.displayAvatarURL({ dynamic: true, size: 4096 }))
.setFooter({ text: `Requested by ${author.tag}` })
.setColor(`#303135`)
await message.reply({ embeds: [e] })
}
}
}```
this is my entire av cmd
only message.author.displayAvatarURL is taking too long to execute
member.user.displayAvatarURL
works
just
fine
im so confused
@brittle smelt
The dynamic arg is for gif pp i guess ?
yes
2412
nope
Si not a cache problem..
Do you debugged the code ?
Like, putting console.logs everywhere to see what exact line it comes from ?
You should do it
I don’t think so
i thought maybe message.member instead of message.author would be faster because its a user object but nope
And jut print "check 1", "check 2" at différents places and see where is the time execution exceeding
still the same