const { SlashCommandBuilder, EmbedBuilder, AttachmentBuilder } = require("discord.js");

async function doggoPet(interaction) {

    const responses = [
        '*loving growl*',
        'Danke, das habe ich gebraucht.',
        'Ein bisschen tiefer.',
        'Ja, genau dort!'
    ]
    var r = Math.floor(Math.random() * responses.length)

    const filePath = `assets/Command_Doggo/doggo.jpg`;

    const attachment = new AttachmentBuilder(filePath);
    const embed = new EmbedBuilder()
        .setDescription(responses[r])
        .setColor(0x51267)
        .setTimestamp()
        .setImage(`attachment://doggo.jpg`);

    await interaction.editReply({
        embeds: [embed],
        files: [attachment]
    })
}
async function doggoFeed(interaction) {
    await interaction.editReply({
        content: 'WIP placeholder'
    })
}
async function doggoWalk(interaction) {
    await interaction.editReply({
        content: 'WIP placeholder'
    })
}
async function doggoPlay(interaction) {
    await interaction.editReply({
        content: 'WIP placeholder'
    })
}


module.exports = {
    data: new SlashCommandBuilder()
        .setName('doggo')
        .setDescription('who is a good boi?')
        .addSubcommand(s =>
            s.setName('pet')
                .setDescription('beeg scratch')
        )
        .addSubcommand(s =>
            s.setName('feed')
                .setDescription('tastge')
        )
        .addSubcommand(s =>
            s.setName('walk')
                .setDescription('walkies')
        )
        .addSubcommand(s =>
            s.setName('play')
                .setDescription('fun time')
        ),
    async execute(interaction) {
        await interaction.deferReply()
        switch (interaction.options._subcommand) {
            case 'pet':
                doggoPet(interaction)
                break;
            case 'feed':
                doggoFeed(interaction)
                break;
            case 'walk':
                doggoWalk(interaction)
                break;
            case 'play':
                doggoPlay(interaction)
                break;
            default:
                break;
        }
    }
}