38 lines
1.4 KiB
JavaScript
38 lines
1.4 KiB
JavaScript
const { ActivityType } = require('discord.js');
|
|
const deployCommands = require('../deploy-commands');
|
|
|
|
module.exports = {
|
|
name: 'clientReady',
|
|
once: true,
|
|
async execute(client) {
|
|
const guildIds = client.guilds.cache.map(guild => guild.id);
|
|
if (guildIds.length > 0) {
|
|
// Deploy commands for all guilds in parallel, but only log a single summary
|
|
try {
|
|
await Promise.all(guildIds.map(id => deployCommands(id)));
|
|
console.log(`🔁 Refreshed application commands for ${guildIds.length} guild(s)`);
|
|
} catch (e) {
|
|
console.error('Error refreshing application commands:', e && e.message ? e.message : e);
|
|
}
|
|
}
|
|
|
|
const activities = [
|
|
{ name: 'Watch EhChad Live!', type: ActivityType.Streaming, url: 'https://twitch.tv/ehchad' },
|
|
{ name: 'Follow EhChad!', type: ActivityType.Streaming, url: 'https://twitch.tv/ehchad' },
|
|
{ name: '/help', type: ActivityType.Streaming, url: 'https://twitch.tv/ehchad' },
|
|
{ name: 'EhChadServices', type: ActivityType.Streaming, url: 'https://twitch.tv/ehchad' },
|
|
];
|
|
|
|
let activityIndex = 0;
|
|
|
|
setInterval(() => {
|
|
const activity = activities[activityIndex];
|
|
client.user.setActivity(activity.name, { type: activity.type, url: activity.url });
|
|
activityIndex = (activityIndex + 1) % activities.length;
|
|
}, 3000);
|
|
|
|
// Signal that startup is complete
|
|
console.log('✅ ECS - Full Stack Bot Online!');
|
|
},
|
|
};
|