1234567891011121314151617181920212223242526 |
- import request from "request-promise-native";
- import { Message } from "discord.js";
- import { Command, CommandSet } from "src/model/command";
- const rcgRe = /<input id="rcg_image".+value="([^"]+)".*\/>/i;
- @CommandSet
- export class Rcg {
- @Command({
- pattern: "random comic",
- auth: false,
- documentation: {description: "Generates a comic just for you!", example: "random comic"}
- })
- async randomComic(msg: Message) {
- let result = await request("http://explosm.net/rcg/view/?promo=false");
-
- let regexResult = rcgRe.exec(result);
- if(!regexResult)
- return;
- msg.channel.send(`${msg.author.toString()} I find this very funny:`, {
- files: [ regexResult[1].trim() ]
- });
- }
- };
|