if (counterChannel && counterChannel.type === "GUILD_VOICE") { const currentName = counterChannel.name; const match = currentName.match(/^vouches-(\d+)$/); if (match) { const currentCount = parseInt(match[1]); const newCount = currentCount + 1; const newName = `vouches-${newCount}`; await counterChannel.setName(newName); console.log(`The counter channel's new name is ${newName}`); } else { console.error("Counter channel name format is invalid."); }} else { console.error("Counter channel not found or is not a voice channel.");}
I am making a Discord bot. It has a /vouch command and every time it is executed the counter should go up by one so for the counting system I am using a voice channel which should be renamed every time and the number should increase by one.
Yeah so it's just not quite working.