Updating Channel Name

Hi im trying to update the channel name every 10 minutes for the server status. But if he is trying to set the name he crashes.. CODE:
} else {
client.channels.cache.get(`1089550987527717027`).setName(`🟢 | play.PulseTopia.nl`);
client.channels.cache.get(`1107336229307043850`).setName(`👤 | Online: ${image.players.online}`);
}
} else {
client.channels.cache.get(`1089550987527717027`).setName(`🟢 | play.PulseTopia.nl`);
client.channels.cache.get(`1107336229307043850`).setName(`👤 | Online: ${image.players.online}`);
}
ERROR:
/home/container/src/events/mcstatus.js:24
client.channels.cache.get(`1089550987527717027`).setName(`🟢 | play.PulseTopia.nl`);
^
TypeError: Cannot read properties of undefined (reading 'setName')
at Timeout._onTimeout (/home/container/src/events/mcstatus.js:24:53)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
/home/container/src/events/mcstatus.js:24
client.channels.cache.get(`1089550987527717027`).setName(`🟢 | play.PulseTopia.nl`);
^
TypeError: Cannot read properties of undefined (reading 'setName')
at Timeout._onTimeout (/home/container/src/events/mcstatus.js:24:53)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
1 Reply
d.js toolkit
d.js toolkit•13mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - ✅ Marked as resolved by OP
Want results from more Discord servers?
Add your server