diff --git a/modular_splurt/code/controllers/subsystem/discord.dm b/modular_splurt/code/controllers/subsystem/discord.dm index a5002ffca5..3c7029469e 100644 --- a/modular_splurt/code/controllers/subsystem/discord.dm +++ b/modular_splurt/code/controllers/subsystem/discord.dm @@ -273,3 +273,29 @@ SUBSYSTEM_DEF(discord) //Make sure we clean up the query qdel(query_get_discord_link_record) + +/** + * Delete NULL discord IDs in the database + * + * This will look for rows where discord_id is NULL and delete them. + * + * Hopefully will help fix the errors where people verify but are unable to enter the game + * + */ + +/datum/controller/subsystem/discord/proc/delete_nulls() + var/query = "DELETE FROM [format_table_name("discord_links")] WHERE discord_id IS NULL" + var/datum/db_query/query_delete_nulls = SSdbcore.NewQuery( + query + ) + if(!query_delete_nulls.Execute()) + subsystem_log("There was an error while deleting NULL IDs") + message_admins(span_warning("There was an error while deleting NULL IDs, please delete them manually using the Delete Null Discords verb")) + send2adminchat("Discord Subsystem", "There was an error while deleting NULL IDs, please delete them manually using `!tgs discordnulls`") + return FALSE + + return TRUE + +/datum/controller/subsystem/discord/Initialize(start_timeofday) + . = ..() + delete_nulls() diff --git a/modular_splurt/code/modules/admin/chat_commands.dm b/modular_splurt/code/modules/admin/chat_commands.dm index 4d3bc24c75..5891d0087f 100644 --- a/modular_splurt/code/modules/admin/chat_commands.dm +++ b/modular_splurt/code/modules/admin/chat_commands.dm @@ -34,3 +34,13 @@ log_admin("[sender.friendly_name] has removed [params] from the current round's discord bypass list.") message_admins("[sender.friendly_name] has removed [params] from the current round's discord bypass list.") return "[params] has been removed from the current round's discord bypass list." + +/datum/tgs_chat_command/discordnulls + name = "discordnulls" + help_text = "Deletes all rows in the database where discord_id is NULL." + admin_only = TRUE + +/datum/tgs_chat_command/discordnulls/Run(datum/tgs_chat_user/sender, params) + log_admin("[sender.friendly_name] has attempted to delete the NULLs from the discord database.") + message_admins("[sender.friendly_name] has attempted to delete the NULLs from the discord database.") + return "[SSdiscord.delete_nulls() ? "NULL rows deleted successfully" : "There was a problem while deleting NULLs"]" diff --git a/modular_splurt/code/modules/admin/verbs/discord_subsystem.dm b/modular_splurt/code/modules/admin/verbs/discord_subsystem.dm new file mode 100644 index 0000000000..772207c0eb --- /dev/null +++ b/modular_splurt/code/modules/admin/verbs/discord_subsystem.dm @@ -0,0 +1,9 @@ +/client/proc/discordnulls() + set category = "Debug" + set name = "Delete Discord Nulls" + set desc = "Delete rows in the database where discord_id is NULL." + if(!SSdiscord) + return + SSdiscord.delete_nulls() + message_admins("[key_name(usr)] has attempted to clear NULLs from the discord database") + log_admin("[key_name(usr)] has attempted to clear NULLs from the discord database") diff --git a/modular_splurt/code/modules/mob/dead/new_player/new_player.dm b/modular_splurt/code/modules/mob/dead/new_player/new_player.dm index b3c8173bf4..f1e9ec4149 100644 --- a/modular_splurt/code/modules/mob/dead/new_player/new_player.dm +++ b/modular_splurt/code/modules/mob/dead/new_player/new_player.dm @@ -15,11 +15,11 @@ var/tready = text2num(href_list["ready"]) if(tready != PLAYER_NOT_READY && !player_id) ready = PLAYER_NOT_READY - to_chat(src, span_warning("You must link your discord account to your ckey in order to join the game. Join our discord and use the \"[CONFIG_GET(string/discordbotcommandprefix)]verify\" command [CONFIG_GET(string/verification_channel) ? "as indicated in #[CONFIG_GET(string/verification_channel)] " : ""]. It won't take you more than two minutes :)")) + to_chat(src, span_warning("You must link your discord account to your ckey in order to join the game. Join our discord and use the \"[CONFIG_GET(string/discordbotcommandprefix)]verify\" command [CONFIG_GET(string/verification_channel) ? "as indicated in #[CONFIG_GET(string/verification_channel)] " : ""]. It won't take you more than two minutes :)
Ahelp or ask staff in the discord if this is an error.")) return if(href_list["late_join"] || href_list["SelectedJob"] || href_list["JoinAsGhostRole"]) if(!player_id) - to_chat(src, span_warning("You must link your discord account to your ckey in order to join the game. Join our discord and use the \"[CONFIG_GET(string/discordbotcommandprefix)]verify\" command [CONFIG_GET(string/verification_channel) ? "as indicated in #[CONFIG_GET(string/verification_channel)] " : ""]. It won't take you more than two minutes :)")) + to_chat(src, span_warning("You must link your discord account to your ckey in order to join the game. Join our discord and use the \"[CONFIG_GET(string/discordbotcommandprefix)]verify\" command [CONFIG_GET(string/verification_channel) ? "as indicated in #[CONFIG_GET(string/verification_channel)] " : ""]. It won't take you more than two minutes :)
Ahelp or ask staff in the discord if this is an error.")) return . = ..() diff --git a/tgstation.dme b/tgstation.dme index f30aef29e4..e6f44c863c 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -4215,6 +4215,7 @@ #include "modular_splurt\code\game\turfs\simulated\floor\fancy_floor.dm" #include "modular_splurt\code\game\turfs\simulated\wall\mineral_walls.dm" #include "modular_splurt\code\modules\admin\chat_commands.dm" +#include "modular_splurt\code\modules\admin\verbs\discord_subsystem.dm" #include "modular_splurt\code\modules\admin\verbs\discordbunker.dm" #include "modular_splurt\code\modules\admin\playtimes.dm" #include "modular_splurt\code\modules\admin\verbs\one_click_antag.dm"