Make sure the discordid of a user is always returned as text (#51531)

If it's not cast as a varchar when bringing it out of the database
it will get auto converted to scientification notation, which is
unexpected and causes bugs in code that expects the id to be available
for discord API calls
This commit is contained in:
oranges
2020-06-08 23:48:48 -04:00
committed by GitHub
parent 33132b2ac9
commit 20ede4bf73
+3 -1
View File
@@ -82,8 +82,10 @@ SUBSYSTEM_DEF(discord)
// Returns ID from ckey
/datum/controller/subsystem/discord/proc/lookup_id(lookup_ckey)
//We cast the discord ID to varchar to prevent BYOND mangling
//it into it's scientific notation
var/datum/DBQuery/query_get_discord_id = SSdbcore.NewQuery(
"SELECT discord_id FROM [format_table_name("player")] WHERE ckey = :ckey",
"SELECT CAST(discord_id AS VARCHAR(25)) FROM [format_table_name("player")] WHERE ckey = :ckey",
list("ckey" = lookup_ckey)
)
if(!query_get_discord_id.Execute())