Get content as resolved tags

Couldn't figure out how to title it, but I'd like to take a message like hey @<213123123> look in channel <#1037547185492996208> and get that as it's resolved version so like hey joe look in channel #updog - Is there a DiscordJS function to do that? Thanks!
Solution:
There's a .cleanContent variable pog
Jump to solution
14 Replies
Favna
Favna2y ago
Maybe userMention and channelMention functions? Top level export in v14, under Formatters in v13. You'll need to do some regex parsing I think?
Krish
Krish2y ago
there was something in v12 iirc idk about 13/14
Solution
Rhys
Rhys2y ago
There's a .cleanContent variable pog
Rhys
Rhys2y ago
Not sure how I missed that but that solves it for me
Favna
Favna2y ago
Oh I guess I misunderstood the question
Rhys
Rhys2y ago
The wording on the question was a bit rough to be fair, I wasn't sure how to phrase it
Ben
Ben2y ago
Just an FYI, I know that relied on the cache in v12 and would occasionally not get usernames. I’m not sure if that’s changed since.
Rhys
Rhys2y ago
Thanks for the heads up, I’ll take a peek at the source code and see if that’s the case
Rhys
Rhys2y ago
GitHub
discord.js/Util.js at main · discordjs/discord.js
A powerful JavaScript library for interacting with the Discord API - discord.js/Util.js at main · discordjs/discord.js
Rhys
Rhys2y ago
Yep looks like it only does cached users
Krish
Krish2y ago
btw any specific reason for using cleanContent?
generally, people use it for the repeat command, if your use case is similar then why don't you use disable mentions with the allowedMentions option?
Rhys
Rhys2y ago
Not sure what the repeat command is but im using it to fix the bug seen on this page for example where it’s mentioning the ID instead of the user https://www.answeroverflow.com/m/1051157842893221918
Answer Overflow
❔ postgres EF core, how to have a custom connection string config f...
C# #help - ❔ postgres EF core, how to have a custom connection string config file Hey, I have a net6 class library with a DbContext, I want to have the connection string in a separate custom config file, code below. For some reason, when I do dotnet ef database update, an error pops up: System.ArgumentException: Couldn't set min pool size (P...
Rhys
Rhys2y ago
Technically it’d be better to keep it in that format and parse it into the mentions on the server before sending it to the page but for now this approach should work
Krish
Krish2y ago
Makes sense
Want results from more Discord servers?
Add your server