From 20d13e9a4e5311eb65c8319a14df45ee7ddeeaa2 Mon Sep 17 00:00:00 2001 From: Luke <39926192+LukeWasTakenn@users.noreply.github.com> Date: Mon, 3 Jun 2024 20:22:50 +0200 Subject: [PATCH] refactor: tag joining/leaving member in the message --- src/events/onMemberJoin.ts | 2 +- src/events/onMemberLeave.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/events/onMemberJoin.ts b/src/events/onMemberJoin.ts index 49b81ae..0bee24e 100644 --- a/src/events/onMemberJoin.ts +++ b/src/events/onMemberJoin.ts @@ -6,7 +6,7 @@ export const onMemberJoin = async (member: GuildMember) => { const channel = member.guild.channels.cache.get(member_activity_channel) as TextChannel; if (!channel) return; - const welcomeMessage = `Welcome ${member.user.username} to the server!`; + const welcomeMessage = `Welcome <@${member.user.id}> (${member.user.username}) to the server!`; channel.send(welcomeMessage); const roleId = '842455998266605610'; // Overextended Member RoleID diff --git a/src/events/onMemberLeave.ts b/src/events/onMemberLeave.ts index db1998d..c3b64b9 100644 --- a/src/events/onMemberLeave.ts +++ b/src/events/onMemberLeave.ts @@ -9,7 +9,7 @@ export const onMemberLeave = async (member: GuildMember | PartialGuildMember) => try { member = await member.fetch(); } catch { - await channel.send(`error fetching partial member ${member.user.username}`); + await channel.send(`error fetching partial member <@${member.user.id}> (${member.user.username})`); return; } } @@ -30,9 +30,9 @@ export const onMemberLeave = async (member: GuildMember | PartialGuildMember) => days > 0 ? `${days} days, ${hours} hours, and ${minutes} minutes` : hours > 0 - ? `${hours} hours and ${minutes} minutes` - : `${minutes} minutes`; + ? `${hours} hours and ${minutes} minutes` + : `${minutes} minutes`; - const farewellMessage = `${member.user.username} has left the server. They were here for ${durationMessage}.`; + const farewellMessage = `<@${member.user.id}> (${member.user.username}) has left the server. They were here for ${durationMessage}.`; channel.send(farewellMessage); };