Skip to content

Commit

Permalink
💄 updated memberLogs UI
Browse files Browse the repository at this point in the history
  • Loading branch information
gitaalekhyapaul committed Feb 13, 2021
1 parent 7a1c219 commit eda37c1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/helper/memberLogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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**`
);
Expand All @@ -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);
Expand Down
15 changes: 13 additions & 2 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -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();

Expand Down Expand Up @@ -74,13 +73,25 @@ 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 = {
WAIT: {
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!`,
};
},
};

/**
Expand Down

0 comments on commit eda37c1

Please sign in to comment.