diff --git a/src/helper/memberLogs.ts b/src/helper/memberLogs.ts index 549a33d..2201918 100644 --- a/src/helper/memberLogs.ts +++ b/src/helper/memberLogs.ts @@ -6,6 +6,8 @@ import { } from "discord.js"; import { serverLogger } from "../utils/logger"; import { updateUserJoinOrLeave } from "../service/user-service"; +import { createBasicEmbed } from "../utils/messages"; +import { ERRORS, INFO } from "../utils/constants"; export function handleMemberJoin( member: GuildMember, @@ -16,9 +18,11 @@ export function handleMemberJoin( (ch: any) => ch.id === process.env.LOGGER_CHANNEL_ID ) as TextChannel; if (!channel) return; - channel.send(`Welcome to the server, ${member.toString()}`); + channel.send( + createBasicEmbed(INFO.MEMBER_JOIN(member as GuildMember), "SUCCESS") + ); member.send( - `Hello ${member.toString()} ,\nI am Jack, SRMKZILLA's discord assistant.\nWe at SRMKZILLA welcome you to SRMKZILLA - Official Mozilla Campus Club, a lovely community of developers.\nEveryone here has one goal - to learn new and exciting things. \nTo that effect, please do not hesitate to ask any doubts or share an interesting piece of information. If you have any issues with, how things are running, do ping up any **@Moderator** or **@Jack Developer**. We are always here to help you and everyone have a magical experience.\n\nCheckout out ${client?.channels.cache + `Hello ${member.toString()} ,\nI am **Jack**, **SRMKZILLA's discord assistant.**\nWe at SRMKZILLA welcome you to **SRMKZILLA - Official Mozilla Campus Club**, a lovely community of developers.\nEveryone here has one goal - to learn new and exciting things. \nTo that effect, please do not hesitate to ask any doubts or share an interesting piece of information. If you have any issues with, how things are running, do ping up any **@Admin** or **@Jack Developer**. We are always here to help you and everyone have a magical experience.\n\nCheckout out ${client?.channels.cache .get("793838431277023252") ?.toString()} to get started!\n- Sent from **SRMKZILLA - Official Mozilla Campus Club**` ); @@ -37,7 +41,9 @@ export function handleMemberLeave( (ch: any) => ch.id === process.env.LOGGER_CHANNEL_ID ) as TextChannel; if (!channel) return; - channel.send(`${member.toString()} left the server :(`); + channel.send( + createBasicEmbed(ERRORS.MEMBER_LEAVE(member as GuildMember), "ERROR") + ); updateUserJoinOrLeave(member as GuildMember, "leave"); } catch (err) { serverLogger("error", "InternalError", err); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 2ae1c03..f836bb3 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -1,6 +1,5 @@ -import { User, MessageEmbed } from "discord.js"; +import { User, MessageEmbed, GuildMember } from "discord.js"; import { config } from "dotenv"; -import { incomingMessageSchema } from "../models/incomingMessage"; config(); @@ -74,6 +73,12 @@ export const ERRORS = { message: "Please check your Poll ID, or maybe even your command syntax!\n\n**Help**\nType `#kzjack help` for a list of commands", }, + MEMBER_LEAVE: (member: GuildMember) => { + return { + title: `A member left the server 🥺!`, + message: `<@${member.id}> left the server. Sorry to see you go!`, + }; + }, }; export const INFO = { @@ -81,6 +86,12 @@ export const INFO = { title: "Things worth having are worth waiting for! 😉", message: "Please wait while we fetch a certificate for you! ⏲️", }, + MEMBER_JOIN: (member: GuildMember) => { + return { + title: `A new member joined the server 🥳!`, + message: `<@${member.id}> joined the server! Welcome home!`, + }; + }, }; /**