Infraupgrade (#7670)

This commit is contained in:
Cadyn
2024-02-15 02:22:50 -08:00
committed by GitHub
parent 1453d218c3
commit c79ad55ba8
60 changed files with 1680 additions and 578 deletions
+8 -8
View File
@@ -85,17 +85,17 @@ GLOBAL_LIST_EMPTY(pending_discord_registrations)
/datum/server_tools_command/register/Run(datum/tgs_chat_user/sender, params)
// Try to find if that ID is registered to someone already
var/sql_discord = sql_sanitize_text(sender.id)
var/DBQuery/query = dbcon.NewQuery("SELECT discord_id FROM erro_player WHERE discord_id = '[sql_discord]'")
var/datum/db_query/query = dbcon.NewQuery("SELECT discord_id FROM erro_player WHERE discord_id = '[sql_discord]'")
query.Execute()
if(query.NextRow())
return "[sender.friendly_name], your Discord ID is already registered to a Byond username. Please contact an administrator if you changed your Byond username or Discord ID."
var/key_to_find = "[ckey(params)]"
// They didn't provide anything worth looking up.
if(!length(key_to_find))
return "[sender.friendly_name], you need to provide your Byond username at the end of the command. It can be in 'key' format (with spaces and characters) or 'ckey' format (without spaces or special characters)."
// Try to find their client.
var/client/user
for(var/client/C in GLOB.clients)
@@ -106,7 +106,7 @@ GLOBAL_LIST_EMPTY(pending_discord_registrations)
// Couldn't find them logged in.
if(!user)
return "[sender.friendly_name], I couldn't find a logged-in user with the username of '[key_to_find]', which is what you provided after conversion to Byond's ckey format. Please connect to the game server and try again."
var/sql_ckey = sql_sanitize_text(key_to_find)
query = dbcon.NewQuery("SELECT discord_id FROM erro_player WHERE ckey = '[sql_ckey]'")
query.Execute()
@@ -114,11 +114,11 @@ GLOBAL_LIST_EMPTY(pending_discord_registrations)
// We somehow found their client, BUT they don't exist in the database
if(!query.NextRow())
return "[sender.friendly_name], the server's database is either not responding or there's no evidence you've ever logged in. Please contact an administrator."
// We found them in the database, AND they already have a discord ID assigned
if(query.item[1])
return "[sender.friendly_name], it appears you've already registered your chat and game IDs. If you've changed game or chat usernames, please contact an administrator for help."
// Okay. We found them, they're in the DB, and they have no discord ID set.
var/message = "<span class='notice'>A request has been sent from Discord to validate your Byond username, by '[sender.friendly_name]' in '[sender.channel.friendly_name]'</span>\
<br><span class='warning'>If you did not send this request, do not click the link below, and do notify an administrator in-game or on Discord ASAP.</span>\
@@ -128,6 +128,6 @@ GLOBAL_LIST_EMPTY(pending_discord_registrations)
// To stifle href hacking
GLOB.pending_discord_registrations.len++
GLOB.pending_discord_registrations[GLOB.pending_discord_registrations.len] = list("ckey" = key_to_find, "id" = sender.id, "time" = world.realtime)
return "[sender.friendly_name], I've sent you a message in-game. Please verify your username there to complete your registration within 10 minutes."
*/
*/