Added ?yes and ?no commands from TQM

This commit is contained in:
Izwzyzx 2023-03-02 22:14:13 -06:00
parent 7f06ceadf2
commit 3505bc4562

View File

@ -15,6 +15,7 @@ class Onequestionmark {
static var iceRegex:EReg = ~/\bicc?ed?\b/i;
static var hugDB:Array<String>;
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 <target>`: The classic mIRC troutslap.\n`?hug <target (optional)>`: 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 <target>`: The classic mIRC troutslap.\n`?hug <target (optional)>`: 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);
}
}