From 3505bc4562ee859ee1af8b9c4ee205c6ca148256 Mon Sep 17 00:00:00 2001 From: Izwzyzx <184772711+Izwzyzx@users.noreply.github.com> Date: Thu, 2 Mar 2023 22:14:13 -0600 Subject: [PATCH] Added ?yes and ?no commands from TQM --- Onequestionmark.hx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Onequestionmark.hx b/Onequestionmark.hx index ac7d3f8..d40697f 100644 --- a/Onequestionmark.hx +++ b/Onequestionmark.hx @@ -15,6 +15,7 @@ class Onequestionmark { static var iceRegex:EReg = ~/\bicc?ed?\b/i; static var hugDB:Array; static var motdDB:Dynamic; + static var yesnoDB:Dynamic; static function main() { @@ -45,6 +46,14 @@ class Onequestionmark { motdDB = {"sunday": [],"monday": [],"tuesday": [],"wednesday": [],"thursday": [],"friday": [],"saturday": []}; // Fallback } + if (FileSystem.exists("yesno-db.json")) { + Sys.println('[${timestamp()}] Found yesno-db.json, loading'); + yesnoDB = Json.parse(File.getContent("yesno-db.json")); + } else { + Sys.println('[${timestamp()}] Did not find yesno-db.json, skipping'); + yesnoDB = {"yes": [],"no": []}; // Fallback + } + // Start the bot Bot = new DiscordClient(settings.token, [3276799], settings.debug); Bot.onReady = onReady; @@ -115,7 +124,7 @@ class Onequestionmark { // Basic response commands case "help": m.reply({content:' - **onequestionmark bot commands**\n`?chk`: ack\n`?slap `: The classic mIRC troutslap.\n`?hug `: Posts randomized hug image.\n`?angery`\n`?subway`\n`?motd`: Enables MOTD for current channel (requires auth)\n`?devmode`: Toggles Dev Mode (requires auth)\n`?quit`: Shutdown command (requires auth)\n**Non-command bot functions:**\n*MOTD*: Bot will post a randomized *Meme of the Day* in enabled channels.\n*Icce*: Bot provides users with ice cuboids.\n*Meteor*: Bot reacts to falling rocks in the chat.'}, false); + **onequestionmark bot commands**\n`?chk`: ack\n`?slap `: The classic mIRC troutslap.\n`?hug `: Posts randomized hug image.\n`?yes` and `?no`: Posts randomized yes/no.\n`?angery`\n`?subway`\n`?motd`: Enables MOTD for current channel (requires auth)\n`?devmode`: Toggles Dev Mode (requires auth)\n`?quit`: Shutdown command (requires auth)\n**Non-command bot functions:**\n*MOTD*: Bot will post a randomized *Meme of the Day* in enabled channels.\n*Icce*: Bot provides users with ice cuboids.\n*Meteor*: Bot reacts to falling rocks in the chat.'}, false); case "chk": m.reply({content:'<@${m.author.id}>: ack'}, false); case "slap": @@ -127,6 +136,12 @@ class Onequestionmark { // Image database commands case "hug": 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); + case "no": + var no = yesnoDB.no; + m.reply({content:'${no[randInt(0, no.length-1)]}'}, false); } }