{"size": 953, "ext": "js", "max_stars_repo_path": "commands/ps2.js", "max_stars_repo_name": "Zazw3/vanu-s-enlightenment", "max_stars_repo_stars_event_min_datetime": "2022-03-05T09:10:41.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-05T09:10:41.000Z", "max_issues_repo_path": "commands/ps2.js", "max_issues_repo_name": "Zazw3/vanu-s-enlightenment", "max_issues_repo_issues_event_min_datetime": "2021-05-06T17:20:34.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-05T09:13:03.000Z", "max_forks_repo_path": "commands/ps2.js", "max_forks_repo_name": "Zazw3/vanu-s-enlightenment", "max_forks_repo_forks_event_min_datetime": "2021-09-30T20:46:09.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-30T20:46:09.000Z"}
{"max_stars_count": 1, "max_issues_count": 18, "max_forks_count": 1, "avg_line_length": 36.6538461538, "max_line_length": 109, "alphanum_fraction": 0.5708289612}
module.exports = {
    name: 'ps2',
    args: false,
    guildOnly: true,
    aliases: undefined, // Aliases for the command
    help: '!ps2; Send a random PS2 related picture. DM', // Help information to show
    restricted: [], // Options: discord ID, role ID, role Name
    execute(message) {
        const fs = require('fs');
        const Discord = require('discord.js');
        const path = `./images/${this.name}/`;

        const files = fs.readdirSync(path);

        if (files.length > 0) {
            const RN1 = Math.random();
            const attachment = new Discord.MessageAttachment(path + files[Math.floor(RN1 * files.length)]);
            message.channel.send({ content: `Here is a picture of a ${this.name}:`, files: [ attachment ] });
        }
        else {
            message.reply('No images found');
            console.error('No images found', `path: ${path}\nfiles: ${files}\nCommand: ${this.name}`);
        }
    },
};
