You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.
A call to the cache to retrieve a channel is repeated every minute in a setInterval.
The latter could be exported outside the callback to avoid this redundancy.
constclient=require('../../../index');constaxios=require('axios');constCONNECTED_USERS_CHANNEL_ID=process.env.CONNECTED_USERS_CHANNEL_ID;constMEMBERS_CHANNEL_ID=process.env.MEMBERS_CHANNEL_ID;constIP=process.env.IP;client.on("ready",()=>{constchannel=client.channels.cache.get(CONNECTED_USERS_CHANNEL_ID)asyncfunctionupdateStatus(){try{constresponse=awaitaxios.get(`https://api.mcsrvstat.us/2/${IP}`);constjson=response.data;awaitchannel.setName(`🚀 Connectés: ${json.players.online}`);constguild=client.guilds.cache.first();client.channels.cache.get(MEMBERS_CHANNEL_ID).setName(`🌏 Membres: ${guild.memberCount}`);}catch(error){console.error("Une erreur s'est produite:",error);}}setInterval(updateStatus,60000);// 1 minute});
The action can of course be repeated on the guild and the other channel recovered from the cache.
The text was updated successfully, but these errors were encountered:
# for freeto subscribe to this conversation on GitHub.
Already have an account?
#.
A call to the cache to retrieve a channel is repeated every minute in a setInterval.
The latter could be exported outside the callback to avoid this redundancy.
The action can of course be repeated on the guild and the other channel recovered from the cache.
The text was updated successfully, but these errors were encountered: