Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 16420

counting channel discord.js v14

$
0
0
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.


Viewing all articles
Browse latest Browse all 16420

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>