Lorem Picsum Command

This commit is contained in:
Dragon Fire
2020-05-22 15:48:59 -04:00
parent d1d53bea0d
commit e95307eef6
3 changed files with 59 additions and 1 deletions
+3
View File
@@ -317,6 +317,7 @@ Total: 433
* **karen:** Responds with a random image of Karen.
* **lando:** Responds with a random image of Lando Calrissian.
* **light-novel-cover:** Responds with a randomly generated Light Novel cover. (NSFW)
* **lorem-picsum:** Responds with a random image of a certain size.
* **meme:** Responds with a random meme.
* **potato:** Responds with a random potato image.
* **shiba:** Responds with a random image of a Shiba Inu.
@@ -1071,6 +1072,8 @@ here.
* light-novel-cover (API)
- [LN title generator](https://salty-salty-studios.com/shiz/ln.php)
* light-novel-title (API)
- [Lorem Picsum](https://picsum.photos/)
* lorem-picsum (API)
- [LoveToKnow](https://www.lovetoknow.com/)
* horse-race ([Horse Name Data](https://horses.lovetoknow.com/horse-names/funny-horse-names))
- [Mad Libs](http://www.madlibs.com/)
+55
View File
@@ -0,0 +1,55 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class LoremPicsumCommand extends Command {
constructor(client) {
super(client, {
name: 'lorem-picsum',
aliases: ['lorem-p', 'picsum'],
group: 'random-img',
memberName: 'lorem-picsum',
description: 'Responds with a random image of a certain size.',
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'Lorem Picsum',
url: 'https://picsum.photos/',
reason: 'API'
}
],
args: [
{
key: 'width',
prompt: 'What do you want the width of the image to be?',
type: 'integer',
max: 2000,
min: 10
},
{
key: 'height',
prompt: 'What do you want the height of the image to be?',
type: 'integer',
max: 2000,
min: 10
},
{
key: 'seed',
prompt: 'What seed do you want to provide for image generation?',
type: 'string',
default: '',
max: 100,
parse: seed => encodeURIComponent(seed)
}
]
});
}
async run(msg, { width, height, seed }) {
try {
const { body } = await request.get(`https://picsum.photos/${seed ? `seed/${seed}/` : ''}${width}/${height}`);
return msg.say({ files: [{ attachment: body, name: `${width}x${height}.jpg` }] });
} 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": "114.21.1",
"version": "114.22.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {