client.on('interactionCreate', async interaction => { if (interaction.isButton()) { if (interaction.customId === 'support') { await interaction.deferReply({ ephemeral: true }); await wait(2000); await interaction.editReply("Creating support channel!"); supportChannel(interaction.guild, interaction.member.id); } if (interaction.customId === 'void') { await interaction.deferReply({ ephemeral: true }); await wait(2000); let j = 0; for (var i = 0; i < voided.length; i++) { if (voided[i] === interaction.member.id) { test.splice(i, 1); break; } else { j++; } } if (j < voided.length) { await interaction.editReply("Your opponent has to agree to void a game!"); } else { if (!interaction.member.voice.channel || !interaction.member.voice.channel.name.includes("Game")) { interaction.reply("You need to be connected to a voice channel!"); } else { interaction.member.voice.channel.delete(); interaction.member.channel.delete(); } } } } });