diff --git a/src/commands/admin/teamManage.ts b/src/commands/admin/teamManage.ts index b693415..ef9ef7f 100644 --- a/src/commands/admin/teamManage.ts +++ b/src/commands/admin/teamManage.ts @@ -104,6 +104,15 @@ export default class TeamManageCommand extends BotCommand { }); await team.save(); + // Auto-join the leader to the team + const joinResult = await PointsManager.joinTeam( + leader.id, + leader.username, + team._id.toString(), + false, + interaction.guild || undefined + ); + const embed = new EmbedBuilder() .setTitle("✅ Team Created") .setColor(0x22c55e) @@ -113,6 +122,7 @@ export default class TeamManageCommand extends BotCommand { { name: "Role", value: `<@&${role.id}>`, inline: true }, { name: "Description", value: description || "None", inline: false } ) + .setFooter({ text: joinResult.success ? "Leader has been added to the team" : "Leader join failed - they can manually join" }) .setTimestamp(); return interaction.reply({ embeds: [embed] }); diff --git a/src/commands/users/daily.ts b/src/commands/users/daily.ts index 4e59b0e..abb1771 100644 --- a/src/commands/users/daily.ts +++ b/src/commands/users/daily.ts @@ -76,15 +76,17 @@ export default class DailyCommand extends BotCommand { }); } + const safeSubject = subject.replace(/\s+/g, '_'); + const embed = new EmbedBuilder() .setTitle(`📅 Daily ${subject} Question`) .setDescription(`**Topic:** ${question.topic}\n**Difficulty:** ${question.difficulty_rating}`) .setColor(0x60a5fa) - .setImage(`attachment://daily_${subject}.png`) + .setImage(`attachment://daily_${safeSubject}.png`) .setFooter({ text: `Resets at 12 AM local time` }) .setTimestamp(); - const attachment = new AttachmentBuilder(imagePath, { name: `daily_${subject}.png` }); + const attachment = new AttachmentBuilder(imagePath, { name: `daily_${safeSubject}.png` }); const row = new ActionRowBuilder() .addComponents( diff --git a/src/commands/users/weekly.ts b/src/commands/users/weekly.ts index 20e5195..b8efcac 100644 --- a/src/commands/users/weekly.ts +++ b/src/commands/users/weekly.ts @@ -76,15 +76,17 @@ export default class WeeklyCommand extends BotCommand { }); } + const safeSubject = subject.replace(/\s+/g, '_'); + const embed = new EmbedBuilder() .setTitle(`🎓 Weekly ${subject} Question (PhD Level)`) .setDescription(`**Topic:** ${question.topic}\n**Difficulty:** ${question.difficulty_rating}`) .setColor(0xfacc15) - .setImage(`attachment://weekly_${subject}.png`) + .setImage(`attachment://weekly_${safeSubject}.png`) .setFooter({ text: `Resets at 12 AM Sunday` }) .setTimestamp(); - const attachment = new AttachmentBuilder(imagePath, { name: `weekly_${subject}.png` }); + const attachment = new AttachmentBuilder(imagePath, { name: `weekly_${safeSubject}.png` }); const row = new ActionRowBuilder() .addComponents(