diff --git a/README.md b/README.md index 34e2a0fe..4ec1f04a 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 420 +Total: 422 ### Utility: @@ -212,6 +212,8 @@ Total: 420 * **the-onion:** Responds with a random "The Onion" article. * **this-for-that:** So, basically, it's like a bot command for this dumb meme. * **waifu:** Responds with a randomly generated waifu and backstory. +* **will-you-press-the-button:** Responds with a random "Will You Press The Button?" dilemma. +* **word:** Responds with a random word. * **would-you-rather:** Responds with a random "Would you rather ...?" question. * **xiao-fact:** Responds with a random fact about Xiao. @@ -845,6 +847,7 @@ here. * read-qr-code ([QR code API](http://goqr.me/api/)) - [Grady Ward](https://en.wikipedia.org/wiki/Grady_Ward) * hangman ([Moby Word Lists](http://www.gutenberg.org/ebooks/3201)) + * word ([Moby Word Lists](http://www.gutenberg.org/ebooks/3201)) * word-chain ([Moby Word Lists](http://www.gutenberg.org/ebooks/3201)) - [Gravatar](https://en.gravatar.com/) * gravatar ([API](https://en.gravatar.com/site/implement/)) @@ -1243,6 +1246,8 @@ here. * itunes ([Language Code Data](https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes)) * time ([Time Zone Data](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)) * wikipedia ([API](https://en.wikipedia.org/w/api.php)) +- [Will You Press The Button?](https://willyoupressthebutton.com/) + * will-you-press-the-button (Dilemma Data) - [www.aljanh.net](http://www.aljanh.net/) * frame ([Image](http://www.aljanh.net/frame-wallpapers/1508614706.html)) - [xertris](https://www.deviantart.com/xertris) diff --git a/commands/random-res/will-you-press-the-button.js b/commands/random-res/will-you-press-the-button.js new file mode 100644 index 00000000..006ef5e4 --- /dev/null +++ b/commands/random-res/will-you-press-the-button.js @@ -0,0 +1,34 @@ +const Command = require('../../structures/Command'); +const request = require('node-superfetch'); +const cheerio = require('cheerio'); + +module.exports = class WillYouPressTheButtonCommand extends Command { + constructor(client) { + super(client, { + name: 'will-you-press-the-button', + aliases: ['press-the-button', 'button', 'wyptb', 'press-button'], + group: 'random-res', + memberName: 'will-you-press-the-button', + description: 'Responds with a random "Will You Press The Button?" dilemma.', + credit: [ + { + name: 'Will You Press The Button?', + url: 'https://willyoupressthebutton.com/', + reason: 'Dilemma Data' + } + ] + }); + } + + async run(msg) { + try { + const { text } = await request.get('https://willyoupressthebutton.com/'); + const $ = cheerio.load(text, { normalizeWhitespace: true }); + const cond = $('div[id="cond"]').first().text().trim(); + const res = $('div[id="res"]').first().text().trim(); + return msg.say(`**${cond}** but **${res}**`); + } catch (err) { + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/commands/random-res/word.js b/commands/random-res/word.js new file mode 100644 index 00000000..50066a47 --- /dev/null +++ b/commands/random-res/word.js @@ -0,0 +1,27 @@ +const Command = require('../../structures/Command'); +const words = require('../../assets/json/word-list'); + +module.exports = class WordCommand extends Command { + constructor(client) { + super(client, { + name: 'word', + aliases: ['random-word'], + group: 'random-res', + memberName: 'word', + description: 'Responds with a random word.', + credit: [ + { + name: 'Grady Ward', + url: 'https://en.wikipedia.org/wiki/Grady_Ward', + reason: 'Moby Word Lists', + reasonURL: 'http://www.gutenberg.org/ebooks/3201' + } + ] + }); + } + + run(msg) { + const word = words[Math.floor(Math.random() * words.length)]; + return msg.reply(word.toLowerCase()); + } +}; diff --git a/package.json b/package.json index 8eeacf32..42578979 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "114.12.0", + "version": "114.13.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {