From e88199c611da0e0a4c89611089ca0e87c42303b1 Mon Sep 17 00:00:00 2001 From: nevimer <77420409+nevimer@users.noreply.github.com> Date: Fri, 10 Jan 2025 16:27:34 -0500 Subject: [PATCH] Faxes get logged into the SQL server, for discord retreival. (#2874) ## About The Pull Request Faxes get logged into the SQL server, for discord retreival. Will integrate with my bot. ## Why It's Good For The Game More admins responding and seeing your faxes. ## Proof Of Testing ![heidisql_OsBij5ujr7](https://github.com/user-attachments/assets/8dfd2a74-5148-41fc-a948-85a5ff9b95fe) ## Changelog :cl: admin: Faxes now get sent to the database. /:cl: --- SQL/bubber_schema.sql | 12 ++++++++++++ code/modules/paperwork/fax.dm | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/SQL/bubber_schema.sql b/SQL/bubber_schema.sql index cfa5e7b6b3d..324bd19e6f6 100644 --- a/SQL/bubber_schema.sql +++ b/SQL/bubber_schema.sql @@ -33,3 +33,15 @@ CREATE TABLE `vetted_list` ( PRIMARY KEY (`ckey`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; + +DROP TABLE IF EXISTS `stored_faxes`; +CREATE TABLE `stored_faxes` ( + `sender` VARCHAR(512) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + `destination_fax_machine` VARCHAR(512) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + `message` MEDIUMTEXT NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci', + `roundid` INT(11) NULL DEFAULT NULL, + `relayed` INT(11) NULL DEFAULT '0' +) +COLLATE='utf8mb4_general_ci' +ENGINE=InnoDB +; diff --git a/code/modules/paperwork/fax.dm b/code/modules/paperwork/fax.dm index 6ad57189697..b5d75e5150e 100644 --- a/code/modules/paperwork/fax.dm +++ b/code/modules/paperwork/fax.dm @@ -349,6 +349,20 @@ GLOBAL_VAR_INIT(nt_fax_department, pick("NT HR Department", "NT Legal Department if (istype(sent, /obj/item/paper)) var/obj/item/paper/sent_paper = sent log_paper("[usr] has sent a fax with the message \"[sent_paper.get_raw_text()]\" to [name]/[destination_id].") + // BUBBER EDIT BEGIN + var/datum/db_query/query = SSdbcore.NewQuery({" + INSERT INTO [format_table_name("stored_faxes")] (sender, destination_fax_machine, message, roundid, relayed) + VALUES (:sender, :destination_fax_machine, :message, :roundid, :relayed) + "}, list( + "sender" = usr, + "destination_fax_machine" = destination_id, + "message" = sent_paper.get_raw_text(), + "recipient" = name, + "roundid" = GLOB.round_id, + "relayed" = 0, + )) + query.Execute() + // BUBBER EDIT END return log_game("[usr] has faxed [sent] to [name]/[destination_id].]")