12345678910111213141516171819202122232425262728293031 |
- const request = require("request-promise-native");
- const rcgRe = /<input id="rcg_image".+value="([^"]+)".*\/>/i;
- const documentation = {
- "random comic": {
- auth: false,
- description: "Generates a comic just for you!"
- }
- };
- async function randomComic(msg) {
- let result = await request("http://explosm.net/rcg/view/");
-
- let regexResult = rcgRe.exec(result);
- msg.channel.send(`${msg.author.toString()} I find this very funny:`, {
- files: [ regexResult[1].trim() ]
- });
- }
- const commands = {
- "random comic": msg => {
- randomComic(msg);
- }
- };
- module.exports = {
- commands: commands,
- documentation: documentation
- };
|