Trying to update channel name every min for utc time, updates once but stops updateing

sorry for long title I am trying to make a UTC time channel in my discord server (this is for a game rise of kingdoms which uses utc time), so I made a ClientReady
async execute(client) {
let channel = client.channels.fetch('1348760873849720946');

const getUTC = async () => {
let now = new Date();
let seconds = now.getUTCSeconds();
let delay = (60 - seconds) * 1000; // Calculate delay until the next minute.

setTimeout(async () => {
let updatedNow = new Date();
let hours = updatedNow.getUTCHours().toString().padStart(2, '0'); // Pad single-digit hours with 0.
let minutes = updatedNow.getUTCMinutes().toString().padStart(2, '0'); // Pad single-digit minutes with 0.
console.log("synced");

await channel.setName(`UTC time [ ${hours}:${minutes} ]`);

setInterval(async () => {
let FinNow = new Date();
let FinHours = FinNow.getUTCHours().toString().padStart(2, '0');
let FinMinutes = FinNow.getUTCMinutes().toString().padStart(2, '0');
try {
await channel.setName(`UTC time [ ${FinHours}:${FinMinutes} ]`);
console.log(`Changed `);
} catch(err) {
console.error(err);
}
}, delay);

}, delay);
};

await getUTC();

}
async execute(client) {
let channel = client.channels.fetch('1348760873849720946');

const getUTC = async () => {
let now = new Date();
let seconds = now.getUTCSeconds();
let delay = (60 - seconds) * 1000; // Calculate delay until the next minute.

setTimeout(async () => {
let updatedNow = new Date();
let hours = updatedNow.getUTCHours().toString().padStart(2, '0'); // Pad single-digit hours with 0.
let minutes = updatedNow.getUTCMinutes().toString().padStart(2, '0'); // Pad single-digit minutes with 0.
console.log("synced");

await channel.setName(`UTC time [ ${hours}:${minutes} ]`);

setInterval(async () => {
let FinNow = new Date();
let FinHours = FinNow.getUTCHours().toString().padStart(2, '0');
let FinMinutes = FinNow.getUTCMinutes().toString().padStart(2, '0');
try {
await channel.setName(`UTC time [ ${FinHours}:${FinMinutes} ]`);
console.log(`Changed `);
} catch(err) {
console.error(err);
}
}, delay);

}, delay);
};

await getUTC();

}
Is the issue a discord rate limit? or i am doing something else wrong
4 Replies
d.js toolkit
d.js toolkit2mo 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
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
RateLimited
RateLimitedOP2mo ago
is this a api restriction or a discord rate limit
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?