6 ms·
I think this is an excellent example of one of the pitfalls that the author is getting at. (Disclaimer: not a Discord bot programmer.) Suppose discord_user_id
by fn-mote 2y ago
I think this is an excellent example of one of the pitfalls that the author is getting at.
(Disclaimer: not a Discord bot programmer.)
Suppose discord_user_id is an identifier like @Spivak#2024 that uniquely identifies the user. When Discord forces all users to change to unique ID's and eliminates the disambiguating numbers (or allows users to change them), then where does that leave you?
(For the unfamiliar: something like this happened. Not sure if those are really the "discord user id" used in bot service though, but suppose that they are for the sake of the argument.)
- iaabtpbtpnn 2y agoIt probably leaves you in the same place you’d be with a synthetic key of your own: unable to track users across this key change without additional Discord data.
- foota 2y agoYes, but if you then reference that as a foreign key in some other table or system, then whatever migration you need to do will encompass those systems as well, whereas if you use a synthetic key from the start you wouldn't need to change them.
- deleted 2y ago[deleted]
- jjmarr 2y agoDiscord's real user ID is a very lengthy number not visible to end-users nor used for other purposes. https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID https://support.discord.com/hc/en-us/articles/206346498-Wher...
- tylersmith 2y agoWhich only reenforces the point that using what is exposed as the ID is not safe as a natural key.
- Spivak 2y agoYou're reading this wrong. The real ID (the Snowflake) is exposed in the API, and the UI if you turn dev tools on. That's the one I use. You don't use @username#1209 but 1247755691426542433.
- beeboobaa3 2y agoDiscord user IDs are their numerical unique, unchangeable, id. https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID#h_01HRSTXPS58KNN33AZPCZ1W2F2 https://support.discord.com/hc/en-us/articles/206346498-Wher...