const { Command } = require('discord.js-commando'); const { MessageEmbed } = require('discord.js'); module.exports = class Play extends Command { constructor(client) { super(client, { name: 'earrape', memberName: 'earrape', group: 'music', description: 'toggles the earrape sfx', guildOnly: true, throttling: { usages: 1, duration: 3 } }); } run = async (message) => { try { if (!message.member.voice.channel) { const embed = new MessageEmbed().setColor('#ff0000').setTitle(':x: You need to join a voice channel first'); return await message.say({ embed }); } else if (!message.guild.music.isPlaying) { const embed = new MessageEmbed().setColor('#ff0000').setTitle(':x: Play something first'); return message.say({ embed }); } else { message.guild.music.volume = message.guild.music.sfx.earrape ? 1 : 10000; message.guild.music.dispatcher.setVolume(message.guild.music.sfx.earrape ? 1 : 10000); message.guild.music.sfx.earrape = !message.guild.music.sfx.earrape; const embed = new MessageEmbed().setColor('#000099').setTitle(`:loud_sound: Earrape ${message.guild.music.sfx.earrape ? 'on' : 'off'}`); return await message.say({ embed }); } } catch (err) { console.error(err); const embed = new MessageEmbed().setColor('#ff0000').setTitle(`:x: Error occured: ${err.message}`); return message.say({ embed }); } } }