This commit is contained in:
MythEclipse
2026-06-06 03:31:36 +07:00
parent 9c193c3530
commit b2cd402adc
3 changed files with 48 additions and 40 deletions
+6 -37
View File
@@ -1,50 +1,19 @@
import { logger } from "../../logger";
type GuildTextChannel = {
send(input: { content: string }): Promise<unknown>;
};
type GuildMemberLike = {
id: string;
user?: { id: string };
guild: {
id: string;
channels: {
cache: {
get(channelId: string): GuildTextChannel | undefined;
};
};
};
};
/**
* Sends a welcome message to the configured greeting channel.
* Call this after confirming the member newly gained the booster eligibility role.
* Sends a welcome message via the given channel when a member newly
* acquires the booster eligibility role (i.e. just boosted the server).
*/
export async function sendBoostGreeting(
member: GuildMemberLike,
channel: { send(input: { content: string }): Promise<unknown> },
userId: string,
greetingChannelId: string,
): Promise<void> {
const channel = member.guild.channels.cache.get(greetingChannelId);
if (!channel) {
logger.warn("Boost greeting channel not found", {
channelId: greetingChannelId,
guildId: member.guild.id,
});
return;
}
const mention = member.user?.id ?? member.id;
const message =
`🎉 Thank you for boosting <@${mention}>! ` +
`🎉 Thank you for boosting <@${userId}>! ` +
`You can now claim a custom role using \`/booster-role claim\` in <#${greetingChannelId}>.`;
await channel.send({ content: message });
logger.info("Boost greeting sent", {
userId: member.id,
guildId: member.guild.id,
channelId: greetingChannelId,
});
logger.info("Boost greeting sent", { userId, channelId: greetingChannelId });
}