Burhan Yasin Köse
Hectopat
Bir Discord bot projem var ve bu botun oynuyor kısmına tarih yazdırıp otomatik günden güne değiştirmesini istiyorum. Bu proje ile ilgili bir kod atabilir misiniz?
client.on("ready", () =>{
console.log(`Logged in as ${client.user.tag}!`);
client.user.setPresence({
status: "online", // You can show online, idle... Do not disturb is dnd
game: {
name: "!help", // The message shown
type: "PLAYING" // PLAYING, WATCHING, LISTENING, STREAMING,
}
});
});
const activities_list = [
"with the &help command.",
"with the developers console",
"with some code",
"with JavaScript"
]; // creates an arraylist containing phrases you want your bot to switch through.
bot.on('ready', () => {
setInterval(() => {
const index = Math.floor(Math.random() * (activities_list.length - 1) + 1); // generates a random number between 1 and the length of the activities array list (in this case 5).
bot.user.setActivity(activities_list[index]); // sets bot's activities to one of the phrases in the arraylist.
}, 10000); // Runs this every 10 seconds.
});
const moment = require('moment)
kodunu tanımların arasına ekliyoruz. Daha sonra ise oynuyor kısmına moment().format('DD.MM.YYYY')
ekliyoruz ve bitiyor. Iyi günler!Bu sitenin çalışmasını sağlamak için gerekli çerezleri ve deneyiminizi iyileştirmek için isteğe bağlı çerezleri kullanıyoruz.