From 20ede4bf730d7b60652487bd332388d7af9534b8 Mon Sep 17 00:00:00 2001 From: oranges Date: Tue, 9 Jun 2020 15:48:48 +1200 Subject: [PATCH] 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 --- code/controllers/subsystem/discord.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/controllers/subsystem/discord.dm b/code/controllers/subsystem/discord.dm index e77cc8bd24f..d30f41c6996 100644 --- a/code/controllers/subsystem/discord.dm +++ b/code/controllers/subsystem/discord.dm @@ -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())