File Attachment Naming & Team Leader AutoJoin Fixes

This commit is contained in:
2025-11-23 13:47:26 -05:00
parent 758bef92c7
commit 83ba44fd2d
3 changed files with 18 additions and 4 deletions

View File

@@ -104,6 +104,15 @@ export default class TeamManageCommand extends BotCommand {
}); });
await team.save(); 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() const embed = new EmbedBuilder()
.setTitle("✅ Team Created") .setTitle("✅ Team Created")
.setColor(0x22c55e) .setColor(0x22c55e)
@@ -113,6 +122,7 @@ export default class TeamManageCommand extends BotCommand {
{ name: "Role", value: `<@&${role.id}>`, inline: true }, { name: "Role", value: `<@&${role.id}>`, inline: true },
{ name: "Description", value: description || "None", inline: false } { 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(); .setTimestamp();
return interaction.reply({ embeds: [embed] }); return interaction.reply({ embeds: [embed] });

View File

@@ -76,15 +76,17 @@ export default class DailyCommand extends BotCommand {
}); });
} }
const safeSubject = subject.replace(/\s+/g, '_');
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(`📅 Daily ${subject} Question`) .setTitle(`📅 Daily ${subject} Question`)
.setDescription(`**Topic:** ${question.topic}\n**Difficulty:** ${question.difficulty_rating}`) .setDescription(`**Topic:** ${question.topic}\n**Difficulty:** ${question.difficulty_rating}`)
.setColor(0x60a5fa) .setColor(0x60a5fa)
.setImage(`attachment://daily_${subject}.png`) .setImage(`attachment://daily_${safeSubject}.png`)
.setFooter({ text: `Resets at 12 AM local time` }) .setFooter({ text: `Resets at 12 AM local time` })
.setTimestamp(); .setTimestamp();
const attachment = new AttachmentBuilder(imagePath, { name: `daily_${subject}.png` }); const attachment = new AttachmentBuilder(imagePath, { name: `daily_${safeSubject}.png` });
const row = new ActionRowBuilder<ButtonBuilder>() const row = new ActionRowBuilder<ButtonBuilder>()
.addComponents( .addComponents(

View File

@@ -76,15 +76,17 @@ export default class WeeklyCommand extends BotCommand {
}); });
} }
const safeSubject = subject.replace(/\s+/g, '_');
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(`🎓 Weekly ${subject} Question (PhD Level)`) .setTitle(`🎓 Weekly ${subject} Question (PhD Level)`)
.setDescription(`**Topic:** ${question.topic}\n**Difficulty:** ${question.difficulty_rating}`) .setDescription(`**Topic:** ${question.topic}\n**Difficulty:** ${question.difficulty_rating}`)
.setColor(0xfacc15) .setColor(0xfacc15)
.setImage(`attachment://weekly_${subject}.png`) .setImage(`attachment://weekly_${safeSubject}.png`)
.setFooter({ text: `Resets at 12 AM Sunday` }) .setFooter({ text: `Resets at 12 AM Sunday` })
.setTimestamp(); .setTimestamp();
const attachment = new AttachmentBuilder(imagePath, { name: `weekly_${subject}.png` }); const attachment = new AttachmentBuilder(imagePath, { name: `weekly_${safeSubject}.png` });
const row = new ActionRowBuilder<ButtonBuilder>() const row = new ActionRowBuilder<ButtonBuilder>()
.addComponents( .addComponents(