FML Command

This commit is contained in:
Dragon Fire
2020-04-23 12:06:51 -04:00
parent 3029e853a2
commit 5b8acfad8b
3 changed files with 39 additions and 2 deletions
+4 -1
View File
@@ -132,7 +132,7 @@ in the appropriate channel's topic to use it.
## Commands
Total: 400
Total: 401
### Utility:
@@ -180,6 +180,7 @@ Total: 400
* **draw-cards:** Draws a random hand of playing cards.
* **fact-core:** Responds with a random Fact Core quote.
* **fact:** Responds with a random fact.
* **fml:** Responds with a FML quote. (NSFW)
* **fortune:** Responds with a random fortune.
* **github-zen:** Responds with a random GitHub design philosophy.
* **joke:** Responds with a random joke.
@@ -742,6 +743,8 @@ here.
* wikia ([API](https://www.wikia.com/api/v1/))
- [Flickr](https://www.flickr.com/)
* flickr ([API](https://www.flickr.com/services/api/))
- [FML](https://www.fmylife.com/)
* fml (FML Data)
- [Foreign exchange rates API](https://exchangeratesapi.io/)
* currency (API)
- [Free SVG](https://freesvg.org/)
+34
View File
@@ -0,0 +1,34 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const cheerio = require('cheerio');
module.exports = class FmlCommand extends Command {
constructor(client) {
super(client, {
name: 'fml',
aliases: ['fuck-my-life', 'f-my-life'],
group: 'random-res',
memberName: 'fml',
description: 'Responds with a FML quote.',
nsfw: true,
credit: [
{
name: 'FML',
url: 'https://www.fmylife.com/',
reason: 'FML Data'
}
]
});
}
async run(msg) {
try {
const { text } = await request.get('http://www.fmylife.com/random');
const $ = cheerio.load(text, { normalizeWhitespace: true });
const fml = $('a.article-link').first().text().trim();
return msg.say(fml);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "113.14.0",
"version": "113.15.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {