Save settings and shutdown

This commit is contained in:
Izwzyzx 2023-02-26 17:41:40 -06:00
parent b117f9f4f4
commit 312a73a7c3

View File

@ -58,7 +58,7 @@ class Onequestionmark {
if (m.author.id == settings.botowner) {
m.reply({content:"Shutdown command received from botowner, exiting."}, false);
Sys.println("Shutdown command received from botowner, exiting.");
Sys.exit(0);
shutdown();
}
// System for WIP commands that only work in testing server
case "wipcommand":
@ -74,6 +74,9 @@ class Onequestionmark {
m.reply({content:"https://cdn.discordapp.com/attachments/1071547517847732305/1079518504413311108/angery.jpg"}, false);
case "subway":
m.reply({content:"https://www.youtube.com/watch?v=y3VRXVvr6XU"}, false);
// Image database commands
case "hug":
m.reply({content:'🫂 *hugs ${msg}*\n<insert randomized hug image here>'}, false);
}
}
@ -81,4 +84,13 @@ class Onequestionmark {
if ((msg.charAt(0) == ".") && (msg.length == 1)) {m.reply({content:"omg a meteor"}, true);}
}
}
public static function saveSettings() {
File.saveContent("settings.json", Json.stringify(settings, "\t"));
}
public static function shutdown() {
saveSettings();
Sys.exit(0);
}
}