Newspaper Command

This commit is contained in:
Dragon Fire
2020-01-12 18:51:51 -05:00
parent 004826856b
commit b578e365ce
3 changed files with 51 additions and 2 deletions
+2 -1
View File
@@ -57,7 +57,7 @@ Xiao is a Discord bot coded in JavaScript with
* [Rando Cardrissian](https://github.com/dragonfire535/rando-cardrissian) is a Cards Against Humanity bot, whose features were originally built into Xiao.
## Commands (350)
## Commands (351)
### Utility:
* **eval:** Executes JavaScript code.
@@ -309,6 +309,7 @@ Xiao is a Discord bot coded in JavaScript with
* **invert:** Draws an image or a user's avatar but inverted.
* **minecraft-skin:** Sends the Minecraft skin for a user.
* **needs-more-jpeg:** Draws an image or a user's avatar as a low quality JPEG.
* **newspaper:** Creates a fake newspaper with the headline and body of your choice.
* **pixelize:** Draws an image or a user's avatar pixelized.
* **pokemon-fusion:** Fuses two Generation I Pokémon together.
* **rainbow:** Draws a rainbow over an image or a user's avatar.
+48
View File
@@ -0,0 +1,48 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const moment = require('moment');
module.exports = class NewspaperCommand extends Command {
constructor(client) {
super(client, {
name: 'newspaper',
group: 'analyze',
memberName: 'newspaper',
description: 'Creates a fake newspaper with the headline and body of your choice.',
credit: [
{
name: 'The Newspaper Clipping Generator',
url: 'https://www.fodey.com/generators/newspaper/snippet.asp'
}
],
args: [
{
key: 'headline',
prompt: 'What do you want the headline to be?',
type: 'string',
max: 20
},
{
key: 'body',
prompt: 'What should the body of the article be?',
type: 'string'
}
]
});
}
async run(msg, { headline, body }) {
try {
const { text } = await request
.post('https://www.fodey.com/generators/newspaper/snippet.asp')
.attach('name', 'The Daily Whatever')
.attach('date', moment().format('dddd, MMMM D, YYYY'))
.attach('headline', headline)
.attach('text', body);
const newspaperURL = text.match(/<img src="(https:\/\/r[0-9]+\.fodey\.com\/[0-9]+\/.+\.jpg)"/i)[1];
return msg.channel.send({ files: [newspaperURL] });
} 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": "109.6.0",
"version": "109.7.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {