Improved fallback for database commands
This commit is contained in:
parent
ea5c2da9ef
commit
193f7f2bf8
@ -41,7 +41,7 @@ class Onequestionmark {
|
||||
hugDB = Json.parse(File.getContent("hug-db.json"));
|
||||
} else {
|
||||
Sys.println('[${timestamp()}] Did not find hug-db.json, skipping');
|
||||
hugDB = ["https://cdn.discordapp.com/attachments/270113422232911883/445026464623099907/brohugbump.gif"]; // Fallback
|
||||
hugDB = []; // Fallback
|
||||
}
|
||||
|
||||
if (FileSystem.exists("motd-db.json")) {
|
||||
@ -49,7 +49,7 @@ class Onequestionmark {
|
||||
motdDB = Json.parse(File.getContent("motd-db.json"));
|
||||
} else {
|
||||
Sys.println('[${timestamp()}] Did not find motd-db.json, skipping');
|
||||
motdDB = Json.parse('{"sunday": [],"monday": [],"tuesday": [],"wednesday": [],"thursday": [],"friday": [],"saturday": []}'); // Fallback
|
||||
motdDB = Json.parse('{}'); // Fallback
|
||||
}
|
||||
|
||||
if (FileSystem.exists("yesno-db.json")) {
|
||||
@ -277,13 +277,19 @@ class Onequestionmark {
|
||||
m.reply({content:"https://cdn.discordapp.com/attachments/1071547517847732305/1147983375701921892/opinions.jpg"}, false);
|
||||
// Image database commands
|
||||
case "hug":
|
||||
m.reply({content:'🫂 *hugs ${msg}*\n${hugDB[randInt(0, hugDB.length-1)]}'}, false);
|
||||
if (hugDB.length > 0) {
|
||||
m.reply({content:'🫂 *hugs ${msg}*\n${hugDB[randInt(0, hugDB.length-1)]}'}, false);
|
||||
}
|
||||
case "yes":
|
||||
var yes = yesnoDB.yes;
|
||||
m.reply({content:'${yes[randInt(0, yes.length-1)]}'}, false);
|
||||
if (yes.length > 0) {
|
||||
m.reply({content:'${yes[randInt(0, yes.length-1)]}'}, false);
|
||||
}
|
||||
case "no":
|
||||
var no = yesnoDB.no;
|
||||
m.reply({content:'${no[randInt(0, no.length-1)]}'}, false);
|
||||
if (no.length > 0) {
|
||||
m.reply({content:'${no[randInt(0, no.length-1)]}'}, false);
|
||||
}
|
||||
// Echobox
|
||||
case "echobox":
|
||||
// Create Echobox array for the server if missing
|
||||
|
Loading…
x
Reference in New Issue
Block a user