diff --git a/README.md b/README.md index fa327aa1..90235c16 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Xiao is a Discord bot coded in JavaScript with ## Commands -Total: 357 +Total: 358 ### Utility: @@ -308,6 +308,7 @@ Total: 357 * **hangman:** Prevent a man from being hanged by guessing a word as fast as you can. * **hunger-games:** Simulate a Hunger Games match with up to 24 tributes. * **lottery:** Attempt to win the lottery with 6 numbers. +* **mad-libs:** Choose words that fill in the blanks to create a crazy story! * **math-quiz:** See how fast you can answer a math problem in a given time limit. * **quiz:** Answer a quiz question. * **rock-paper-scissors:** Play Rock-Paper-Scissors. @@ -755,6 +756,10 @@ here. * light-novel-cover (API) - [LN title generator](https://salty-salty-studios.com/shiz/ln.php) * light-novel-title (API) +- [Mad Libs](http://www.madlibs.com/) + * mad-libs (Original Game) +- [Mad:)Takes](https://www.madtakes.com/index.php) + * mad-libs (Mad Libs Data) - [MangaGamer.com](https://www.mangagamer.com/) * box-choosing ([Original Translation](https://store.steampowered.com/app/526490/Higurashi_When_They_Cry_Hou__Ch4_Himatsubushi/)) - [Marvelous](http://www.marv.jp/) diff --git a/assets/json/mad-libs.json b/assets/json/mad-libs.json new file mode 100644 index 00000000..3c2d27f9 --- /dev/null +++ b/assets/json/mad-libs.json @@ -0,0 +1,96 @@ +[ + { + "needed": [ + "NOUN", + "PLURAL NOUN", + "NOUN", + "PLACE", + "ADJECTIVE", + "NOUN" + ], + "text": "Be kind to your {0}-footed {1}\nFor a duck may be somebody`s {2},\nBe kind to your {1} in {3}\nWhere the weather is always {4}.\n\nYou may think that this is the {5},\nWell it is." + }, + { + "needed": [ + "RELATIVE", + "ADJECTIVE", + "ADJECTIVE", + "ADJECTIVE", + "PERSON", + "ADJECTIVE", + "ADJECTIVE", + "VERB ENDING IN -ED", + "BODY PART", + "VERB ENDING IN -ING", + "PLURAL NOUN", + "NOUN", + "ADVERB", + "VERB", + "VERB", + "RELATIVE", + "PERSON" + ], + "text": "Dear {0},\nI am having a(n) {1} time at camp. The counselour is {2} and the food is {3}. I met {4} and we became {5} friends. Unfortunately, {4} is {6} and I {7} my {8} so we couldn`t go {9} like everybody else. I need more {10} and a {11} sharpener, so please {12} {13} more when you {14} back.\nYour {15},\n{16}" + }, + { + "needed": [ + "PLURAL NOUN", + "PLACE", + "NOUN", + "PLURAL NOUN", + "NOUN", + "ADJECTIVE", + "VERB", + "NUMBER", + "ADJECTIVE", + "BODY PART", + "VERB" + ], + "text": "Two {0}, both alike in dignity,\nIn fair {1}, where we lay our scene,\nFrom ancient {2} break to new mutiny,\nWhere civil blood makes civil hands unclean.\nFrom forth the fatal loins of these two foes\nA pair of star-cross`d {3} take their life;\nWhole misadventured piteous overthrows\nDo with their {4} bury their parents` strife.\nThe fearful passage of their {5} love,\nAnd the continuance of their parents` rage,\nWhich, but their children`s end, nought could {6},\nIs now the {7} hours` traffic of our stage;\nThe which if you with {8} {9} attend,\nWhat here shall {10}, our toil shall strive to mend." + }, + { + "needed": [ + "ADJECTIVE", + "NOUN", + "ANIMAL", + "NOISE" + ], + "text": "{0} Macdonald had a {1}, E-I-E-I-O\nand on that {1} he had an {2}, E-I-E-I-O\nwith a {3} {3} here\nand a {3} {3} there,\nhere a {3}, there a {3},\neverywhere a {3} {3},\n{0} Macdonald had a {1}, E-I-E-I-O." + }, + { + "needed": [ + "ADJECTIVE", + "VERB ENDING IN -ED", + "PLURAL NOUN", + "LIQUID", + "PLURAL NOUN", + "FAMOUS PERSON", + "PLACE", + "OCCUPATION", + "NOUN", + "NATIONALITY", + "FEMALE CELEBRITY", + "NOUN", + "FEMALE FRIEND", + "PLURAL NOUN", + "NUMBER", + "ADJECTIVE" + ], + "text": "I enjoy long, {0} walks on the beach, getting {1} in the rain and serendipitous encounters with {2}. I really like piña coladas mixed with {3}, and romantic, candle-lit {4}. I am well-read from Dr. Seuss to {5}. I travel frequently, especially to {6}, when I am not busy with work. (I am a {7}.) I am looking for {8} and beauty in the form of a {9} goddess. She should have the physique of {10} and the {11} of {12}. I would prefer if she knew how to cook, clean, and wash my {13}. I know I’m not very attractive in my picture, but it was taken {14} days ago, and I have since become more {15}." + }, + { + "needed": [ + "ADJECTIVE", + "NOUN", + "VERB", + "VERB ENDING IN -ING", + "PLURAL NOUN", + "BODY PART", + "VERB ENDING IN -ING", + "VERB ENDING IN -ED", + "NUMBER", + "VERB" + ], + "text": "You are my {0} love. You have me completely in your {1}. I know and feel that if I am to {2} anything fine and noble in the future I shall do so only by {3} at the {4} of your heart. I would like to go through life {5} by {5} with you, {6} you more and more until we {7} to be {8} being(s) together until the hour should come for us to {9}." + } +] diff --git a/commands/sp-games/mad-libs.js b/commands/sp-games/mad-libs.js new file mode 100644 index 00000000..902d2b50 --- /dev/null +++ b/commands/sp-games/mad-libs.js @@ -0,0 +1,58 @@ +const Command = require('../../structures/Command'); +const libs = require('../../assets/json/mad-libs'); + +module.exports = class MadLibsCommand extends Command { + constructor(client) { + super(client, { + name: 'mad-libs', + group: 'sp-games', + memberName: 'mad-libs', + description: 'Choose words that fill in the blanks to create a crazy story!', + credit: [ + { + name: 'Mad Libs', + url: 'http://www.madlibs.com/', + reason: 'Original Game' + }, + { + name: 'Mad:)Takes', + url: 'https://www.madtakes.com/index.php', + reason: 'Mad Libs Data' + } + ] + }); + } + + async run(msg) { + const current = this.client.games.get(msg.channel.id); + if (current) return msg.reply(`Please wait until the current game of \`${current.name}\` is finished.`); + this.client.games.set(msg.channel.id, { name: this.name }); + try { + const lib = libs[Math.floor(Math.random() * libs.length)]; + const choices = []; + for (const word of lib.needed) { + await msg.reply(`Give me a **${word}**.`); + const filter = res => { + if (!res.content || res.content.length > 12) { + msg.reply('Please only use a maximum of 12 characters per word.').catch(() => null); + return false; + } + return res.author.id === msg.author.id; + } + const choice = await msg.channel.awaitMessages(filter, { + max: 1, + time: 120000 + }); + if (!choice.size) break; + choices.push(choice.first().content); + } + this.client.games.delete(msg.channel.id); + let finished = lib.text; + for (let i = 0; i < choices.length; i++) finished = finished.replace(`{${i}}`, `**${choices[i]}**`); + return msg.say(finished); + } catch (err) { + this.client.games.delete(msg.channel.id); + throw err; + } + } +}; diff --git a/package.json b/package.json index dbe88da0..ba46cfe3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "110.4.0", + "version": "110.5.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {