Status Probleme
Hello, for some time the status to put on my bot does not appear anymore because I had put information etc and it does not appear while on other bots it appears here is the code (but I have my index.js which does something to make its start in the ready.js file so that its put the status and before it put it and more of all)
const path = require('path');
const fs = require('fs');
module.exports = (client) => {
try {
console.log(
Connecté en tant que ${client.user.tag}
);
// Fonction pour mettre à jour la présence du bot
const updatePresence = () => {
const activities = [
{ name: 'Competitive', type: 'COMPETING' },
{ name: 'Stil Bot', type: 'WATCHING' },
{ name: 'Moderation', type: 'PLAYING' }
];
// Choisir une activité au hasard parmi les activités définies
const activity = activities[Math.floor(Math.random() * activities.length)];
client.user.setPresence({
activities: [activity],
status: 'dnd'
});
};
// Initialiser la présence
updatePresence();
// Mettre à jour la présence toutes les 10 secondes
setInterval(updatePresence, 10000); // 10 secondes
console.log('Statut et activité du bot mis à jour.');
} catch (error) {
console.error('Erreur lors de la mise à jour du statut et de l'activité:', error);
const logFilePath = path.join(__dirname, 'logs', 'error-logs.txt');
const logMessage = [${new Date().toISOString()}] Erreur lors de la mise à jour du statut et de l'activité: ${error.message}\n
;
fs.appendFile(logFilePath, logMessage, (err) => {
if (err) {
console.error('Erreur lors de l'écriture du fichier de log:', err.message);
}
});
}
};
thank you for helping me.2 Replies
- 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 OP10.8.1