Light Novel Title Command

This commit is contained in:
Dragon Fire
2019-07-25 18:11:47 -04:00
parent bd9ef97a99
commit cbcd665cd5
3 changed files with 32 additions and 2 deletions
+29
View File
@@ -0,0 +1,29 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class LightNovelTitleCommand extends Command {
constructor(client) {
super(client, {
name: 'light-novel-title',
aliases: ['ln-title'],
group: 'random',
memberName: 'light-novel-title',
description: 'Responds with a randomly generated Light Novel title.',
credit: [
{
name: 'LN title generator',
url: 'https://salty-salty-studios.com/shiz/ln.php'
}
]
});
}
async run(msg) {
try {
const { text } = await request.get('https://salty-salty-studios.com/shiz/ln.php');
return msg.say(text.match(/<h1>(.+)<\/h1>/i)[1]);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};