[Discord] Properly support all URL variations #35
Labels
✨ Feature
New addition to the codebase (feature, utility, component, etc.)
🧐 Question
Further information is requested
Discord has multiple different URL variations for different purposes:
discordapp.com/users/*
)discord.com/channels/{serverid}/{channelid}
)discord.gg/*
)Some examples of valid URLs:
https://discord.com/users/username
https://discordapp.com/users/0123456789
https://discord.com/channels/@me
https://discord.com/channels/892738558316662855
https://discordapp.com/channels/serverid/channelid/messageid
https://discord.gg/vanity-url
At the moment, Socialite works by simply parsing the
domain
to determinenetwork type
, and then parsing thepath
to determinehandle
. When parsing forhandle
, we do not use any other part of the fullurl
to qualify the result.Additionally, since Discord has different purposes for each of its URL structures... a single
preferredUrl
simply isn't compatible. Example: Parsing achannels
URL and attempting to use thepreferredUrl
will lead no where useful.There are two URL parts that may help us increase our confidence in the parsed handle + determine the ideal
preferredUrl
:discord
vsdiscordapp
.gg
vs anything elseIt is also worth investigating the
@
prefix to better understand its significance in Discord URLs. This may lead to yet another condition - or alternatively - provide an additional mechanism for gaining confidence over the result.Since this PR, we introduce some snowflake code to handle the
discord
condition. We really need to pursue a higher-level solution to help solve for these cases.The text was updated successfully, but these errors were encountered: