{"size": 951, "ext": "js", "max_stars_repo_path": "commands/repeat.js", "max_stars_repo_name": "lowsprofile/momochii", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "commands/repeat.js", "max_issues_repo_name": "lowsprofile/momochii", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "commands/repeat.js", "max_forks_repo_name": "lowsprofile/momochii", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 36.5769230769, "max_line_length": 110, "alphanum_fraction": 0.6635120925}
const { Message, RichEmbed } = require('discord.js');
const isSameChannel = require('../utils/isSameChannel');

module.exports = {
  name: 'repeat',
  description: 'Mengaktifkan/mematikan perulangan daftar queue.',
  execute(message = new Message) {
    if (!isSameChannel(message)) return;
    const guildid = message.guild.id;
    if (!message.client.repeat.has(guildid)) message.client.repeat.set(guildid, false);

    const repeat = message.client.repeat.get(guildid);

    (repeat === false) ? message.client.repeat.set(guildid, true) : message.client.repeat.set(guildid, false);

    const stat = (repeat === false)
      ? { emoji: ':repeat:', text: 'aktif' }
      : { emoji: ':repeat_one:', text: 'mati' };

    message.channel.send(
      new RichEmbed()
        .setTitle(`${stat.emoji} Perulangan daftar queue di${stat.text}kan`)
        .setFooter(`Diminta oleh ${message.author.username}`, message.author.displayAvatarURL)
    );
  },
};