summaryrefslogtreecommitdiff
path: root/server/src/commands/anime/Waifu.ts
blob: 043b8ac68a2a3c9c265223bf7ea7b6fd63bc49ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { Command } from 'discord-akairo';
import { Message } from 'discord.js';
import { colour } from '../../Config';
import request from 'node-superfetch';
import Util from '../../utils/Utils';

export default class WaifuAnime extends Command {
    public constructor() {
        super('waifu', {
            aliases: ['waifu', 'thiswaifudoesnotexist'],
            category: 'anime',
            description: {
                content: 'Sends a randomly generated waifu with a backstory. WARNING: don\'t get too attatched.',
                usage: '',
                examples: [
                    ''
                ]
            },
            ratelimit: 3
        });
    }
    
    public async exec(msg: Message): Promise<Message> {
        const num = Math.floor(Math.random() * 100000);
        const { text } = await request.get(`https://www.thiswaifudoesnotexist.net/snippet-${num}.txt`);
        const embed = this.client.util.embed()
            .setDescription(Util.shorten(text, 1000))
            .setColor(colour)
            .setThumbnail(`https://www.thiswaifudoesnotexist.net/example-${num}.jpg`);
        return msg.channel.send(embed);
    }
}