mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-05 13:53:12 +02:00
The Onion Command
This commit is contained in:
@@ -132,7 +132,7 @@ in the appropriate channel's topic to use it.
|
||||
|
||||
## Commands
|
||||
|
||||
Total: 402
|
||||
Total: 404
|
||||
|
||||
### Utility:
|
||||
|
||||
@@ -205,6 +205,7 @@ Total: 402
|
||||
* **subreddit:** Responds with a random post from a subreddit.
|
||||
* **suggest-command:** Suggests a random command for you to try.
|
||||
* **superpower:** Responds with a random superpower.
|
||||
* **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.
|
||||
* **would-you-rather:** Responds with a random "Would you rather ...?" question.
|
||||
@@ -1129,6 +1130,8 @@ here.
|
||||
* tv-show ([API](https://www.themoviedb.org/documentation/api))
|
||||
- [The Newspaper Clipping Generator](https://www.fodey.com/generators/newspaper/snippet.asp)
|
||||
* newspaper (API)
|
||||
- [The Onion](https://www.theonion.com/)
|
||||
* the-onion ([RSS Feed](https://www.theonion.com/rss))
|
||||
- [The Yoda-Speak Generator](https://www.yodaspeak.co.uk/)
|
||||
* yoda (API)
|
||||
- [This Waifu Does Not Exist](https://www.thiswaifudoesnotexist.net/)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const RSS = require('rss-parser');
|
||||
const { stripIndents } = require('common-tags');
|
||||
|
||||
module.exports = class TheOnionCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'the-onion',
|
||||
aliases: ['onion'],
|
||||
group: 'random-res',
|
||||
memberName: 'the-onion',
|
||||
description: 'Responds with a random "The Onion" article.',
|
||||
credit: [
|
||||
{
|
||||
name: 'The Onion',
|
||||
url: 'https://www.theonion.com/',
|
||||
reason: 'RSS Feed',
|
||||
reasonURL: 'https://www.theonion.com/rss'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
const parser = new RSS();
|
||||
try {
|
||||
const feed = await parser.parseURL('https://www.theonion.com/rss');
|
||||
const article = feed.items[Math.floor(Math.random() * feed.items.length)];
|
||||
return msg.say(stripIndents`
|
||||
${article.title}
|
||||
${article.link}
|
||||
`);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "113.17.1",
|
||||
"version": "113.18.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
@@ -50,6 +50,7 @@
|
||||
"moment-timezone": "^0.5.28",
|
||||
"node-superfetch": "^0.1.10",
|
||||
"random-js": "^2.1.0",
|
||||
"rss-parser": "^3.7.6",
|
||||
"soap": "^0.31.0",
|
||||
"winston": "^3.2.1"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user