mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-04 15:56:52 +02:00
Newspaper Command
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "109.6.0",
|
||||
"version": "109.7.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user