} else if (command === 'updateraidtime') {
const month = args.getString('month', true);
const day = args.getInteger('day', true);
const time = args.getString('time', true);
const year = args.getInteger('year', true);
const nextRaidOption = args.getString('next_raid', true);
const guild = interaction.guild;
const channelOption = args.getChannel('channel_name', true);
if (!guild || !channelOption || channelOption.type !== 'GUILD_TEXT') {
await interaction.reply('You need to specify a valid text channel.');
return;
}
const channel = channelOption;
// Validate month
const monthNum = parseInt(month);
if (isNaN(monthNum) || monthNum < 1 || monthNum > 12) {
await interaction.reply('You need to specify a valid month between 1 and 12.');
return;
}
// Validate day
if (day < 1 || day > 31) {
await interaction.reply('You need to specify a valid day between 1 and 31.');
return;
}
// Validate time
const timeRegex = /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/;
if (!timeRegex.test(time)) {
await interaction.reply('You need to specify a valid time in the format HH:MM.');
return;
}
// Split time into hours and minutes
const [hours, minutes] = time.split(':');
// Build timestamp and format it
const timestamp = new Date(year, monthNum - 1, day, hours, minutes);
const formattedTimestamp = `<t:${Math.floor((timestamp.getTime() - timestamp.getTimezoneOffset() * 60 * 1000) / 1000)}:f>`;
// Update channel topic with timestamp and next raid information
await channel.setTopic(`Next meet is ${formattedTimestamp} ${nextRaidOption}`);
await interaction.reply('Raid time updated successfully!');
}