Updated select module and refined message retrieval process in RMASS definitions
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
import sqlite3
|
||||
|
||||
def buildSave(action, outputs):
|
||||
if hasattr(action, "savedata"):
|
||||
@@ -11,6 +12,27 @@ def buildSave(action, outputs):
|
||||
json.dump(save_data, save_file)
|
||||
|
||||
print(f"Data saved by {action.name} to {action.savepath}")
|
||||
|
||||
database = sqlite3.connect("savedata/rmmanager.db")
|
||||
for key, value in save_data.items():
|
||||
database.execute("""
|
||||
CREATE TABLE IF NOT EXISTS output_test (
|
||||
dictionary TEXT NOT NULL UNIQUE,
|
||||
value TEXT NOT NULL UNIQUE
|
||||
)
|
||||
""")
|
||||
|
||||
database.execute("""
|
||||
INSERT INTO output_test(dictionary, value)
|
||||
VALUES (?, ?)
|
||||
ON CONFLICT (dictionary)
|
||||
DO UPDATE SET value = excluded.value
|
||||
""", (key, value)
|
||||
)
|
||||
|
||||
database.commit()
|
||||
database.close()
|
||||
|
||||
return outputs
|
||||
|
||||
def loadSave(action, outputs):
|
||||
@@ -23,3 +45,21 @@ def loadSave(action, outputs):
|
||||
|
||||
print(f"Data loaded by {action.name} from {action.savepath}")
|
||||
return outputs
|
||||
|
||||
def buildSave2(action, outputs):
|
||||
|
||||
database.execute("""
|
||||
CREATE TABLE IF NOT EXISTS message_mapping (
|
||||
rmass_message_id INTEGER PRIMARY KEY,
|
||||
matrix_event_id TEXT NOT NULL UNIQUE
|
||||
)
|
||||
""")
|
||||
database = sqlite3.connect("rmmanager.db")
|
||||
|
||||
database.execute(
|
||||
"INSERT INTO message_mapping VALUES (?, ?)",
|
||||
(action.savedata[savename], outputs["event_id"])
|
||||
)
|
||||
|
||||
database.commit()
|
||||
database.close()
|
||||
Reference in New Issue
Block a user