#.setAuthor deprecation warning
1 messages ยท Page 1 of 1 (latest)
hey I had this problem earlier too xD
DeprecationWarning: Passing strings for the URL or the icon's URL for MessageEmbed#setAuthor is deprecated. Pass a sole object instead.
Passing strings for the URL is deprecated
ur welcome
This is what confuses me.
.setAuthor(`user.tag`, `user.avatarURL`)
Throws the exact same dep warning
For the deprecated one
if u passing only name, can u read the docs/pic properly
there
You're actually useless. Got headbutt a brickwall or something lol
I was just about to send the solution
So, .setAuthor(object) can only be one object, either name, url or iconURL?
You're the opposite of helpful mate, you're annoying, shoo
rule 6 do not ping me
shoo
.setAuthor can be a stringor EmbedAuthorData or null
You're involving yourself in a thread where you're not wanted, if you don't want to be pinged then see yourself out lol
so in .setAuthor you can have a string( which you would use if you only wanted text in the author field ) or you can use the EmbedAuthorData
Yeah, so I'm still not understanding why
.setAuthor({ name: `${target?.user.tag}`, iconURL: `${target?.user.displayAvatarURL({ dynamic: true })}` })
Isn't viable
read the error
DeprecationWarning: Passing strings for the URL or the icon's URL for MessageEmbed#setAuthor is deprecated. Pass a sole object instead.
Yeah so in other words use one of either name, url or iconURL?
no wait
look. You have
// `${target?.user.tag}`----> this variable is covered in a string
// `${target?.user.displayAvatarURL({ dynamic: true })}` -----> this is covered in a string
.setAuthor({ name: `${target?.user.tag}`, iconURL: `${target?.user.displayAvatarURL({ dynamic: true })}` })
you can do name: "Bob"
and it would work
just read this line
DeprecationWarning: Passing strings for the URL or the icon's URL for MessageEmbed#setAuthor is deprecated.
I tried that and still got the same warning though
passings strings for the URL or the icon's URL is deprecated
your iconURL is not a string, but you have it around the ``
Hold up, let me find an older message from earlier today
So far I have tried, with no luck..
.setAuthor(`${message?.author?.tag}'s message was deleted`, `${message?.author?.displayAvatarURL({ dynamic: true })}`)
.setAuthor({ name: `${message?.author?.tag}'s message was deleted`, iconURL: `${message?.author?.displayAvatarURL({ dynamic: true })}` })
.setAuthor(message?.author?.tag message was deleted, message?.author?.displayAvatarURL({ dynamic: true }))
yeah, but he should learn how to read and understand errors
this one should work, but just read the first line of the error
it says passing strings is deprecated
this is a string hello
`hello`
that is a string ^
iconURL: `${target?.user.displayAvatarURL({ dynamic: true })}`
that is also a string
How about this?
.setAuthor(message?.author?.tag message was deleted, message?.author?.displayAvatarURL({ dynamic: true }))
.setAuthor({ name: `${target?.user.tag}`, iconURL: `${target?.user.displayAvatarURL({ dynamic: true })}` })
Use this one, but remove the strings
The error is telling you, you can't use strings in iconURL
I see, I appreciate the help lol I won't lie, still confused as the docs sounds like it contradicting the dep warning. But I shall give that a try and see how I go ๐
Yeah. It is confusing. I also had this problem a few hours ago
btw why are you using the ``
It's not needed unless you are putting variables into a string
I used `` in mine and it worked fine
are you using the latest discord.js?
Yes
hm weird
That's not what his issue is
He can use backticks, it just needs to be an object which it is
this is what I have
.setAuthor({name: user.username, iconURL: user.displayAvatarURL({dynamic: true})})
.setAuthor({ name: target?.user.tag, iconURL: target?.user.displayAvatarURL({ dynamic: true }) })
(Use `node --trace-deprecation ...` to show where the warning was created)```
You can do `${user.username}` and it will still work
send the full error @timid dew
That's the full error mate
Oh
you mean trace
what command are you doing to trigger that?
Just a Whois context command. But it happens on any embed I use at the moment
(node:20424) DeprecationWarning: Passing strings for the URL or the icon's URL for MessageEmbed#setAuthor is deprecated. Pass a sole object instead.
at MessageEmbed.setAuthor (C:\Users\proba\Desktop\CreatorBot2.0\node_modules\discord.js\src\structures\MessageEmbed.js:381:17)
at Object.execute (C:\Users\proba\Desktop\CreatorBot2.0\events\interaction\interactionCreate.js:32:18)
at Client.<anonymous> (C:\Users\proba\Desktop\CreatorBot2.0\handlers\event_handler.js:22:54)
at Client.emit (node:events:390:28)
at InteractionCreateAction.handle (C:\Users\proba\Desktop\CreatorBot2.0\node_modules\discord.js\src\client\actions\InteractionCreate.js:73:12)
at Object.module.exports [as INTERACTION_CREATE] (C:\Users\proba\Desktop\CreatorBot2.0\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\proba\Desktop\CreatorBot2.0\node_modules\discord.js\src\client\websocket\WebSocketManager.js:350:31)
at WebSocketShard.onPacket (C:\Users\proba\Desktop\CreatorBot2.0\node_modules\discord.js\src\client\websocket\WebSocketShard.js:443:22)
at WebSocketShard.onMessage (C:\Users\proba\Desktop\CreatorBot2.0\node_modules\discord.js\src\client\websocket\WebSocketShard.js:300:10)
at WebSocket.onMessage (C:\Users\proba\Desktop\CreatorBot2.0\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:390:28)
at Receiver.receiverOnMessage (C:\Users\proba\Desktop\CreatorBot2.0\node_modules\ws\lib\websocket.js:1098:20)
at Receiver.emit (node:events:390:28)
at Receiver.dataMessage (C:\Users\proba\Desktop\CreatorBot2.0\node_modules\ws\lib\receiver.js:528:14)
at Receiver.getData (C:\Users\proba\Desktop\CreatorBot2.0\node_modules\ws\lib\receiver.js:446:17)
at Receiver.startLoop (C:\Users\proba\Desktop\CreatorBot2.0\node_modules\ws\lib\receiver.js:148:22)
.setAuthor({ name: target?.user.tag})
try that on the whois command
and when you do the whois cmd let me know if it gives the same error
Same thing
Same thing
are you using setAuthor anywhere else before you execute that command?
I have no other embed in this file and I'm not requiring any other files and afaik no other code should be getting called at all https://sourceb.in/f0fzwXiZBo
Nope
Are you on the newest version of discord.js?
Yessir, updating is when this dep warning started
Have been asking in djs server all day for help and no one could figure it out
Yea
The only thing i can think of is that setAuthor is getting called from somewhere else in your code and the error is being shown because it hasn't been updated
so for example if your bot sends logs, it may be using setAuthor
Yeah I mean, it's likely but I don't think so. It happens all throughout my project, I'd have to go back through it all and double check but I'm pretty sure I got them all changed, and still getting the warnings
Hmm, let me check
Use this in visual studio code, it should be up on the top left for you
then search for setAuthor
it will show you all of the files setAuthor is in
Holy shit dude, you're a fucking genius ๐ I put a little log in interactionCreate while I was testing and never removed it ๐ duuude you're a god
sorted? 
YES! Thank you my guy! I been racking my brain for hours trying to sort that out haha
ight no worries, have a good one
Cheers mate, you too! Merry Christmas