blob: ea0b24d610cc078a7f7bf8f2ed667c5075caa207 [file] [log] [blame]
pineafan63fc5e22022-08-04 22:04:10 +01001import { callback as statsChannelAdd } from "../reflex/statsChannelUpdate.js";
2import { callback as welcome } from "../reflex/welcome.js";
3import client from "../utils/client.js";
pineafan4edb7762022-06-26 19:21:04 +01004
pineafan63fc5e22022-08-04 22:04:10 +01005export const event = "guildMemberAdd";
pineafan32767212022-03-14 21:27:39 +00006
7export async function callback(_, member) {
pineafan63fc5e22022-08-04 22:04:10 +01008 welcome(_, member);
Skyler Grey75ea9172022-08-06 10:22:23 +01009 statsChannelAdd(_, member);
10 const { log, NucleusColors, entry, renderUser, renderDelta } =
11 member.client.logger;
12 await client.database.history.create(
13 "join",
14 member.guild.id,
15 member.user,
16 null,
17 null
18 );
pineafan63fc5e22022-08-04 22:04:10 +010019 const data = {
20 meta: {
21 type: "memberJoin",
22 displayName: "Member Joined",
23 calculateType: "guildMemberUpdate",
24 color: NucleusColors.green,
25 emoji: "MEMBER" + (member.user.bot ? ".BOT" : "") + ".JOIN",
26 timestamp: member.joinedTimestamp
27 },
28 list: {
29 memberId: entry(member.id, `\`${member.id}\``),
30 name: entry(member.id, renderUser(member.user)),
31 joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
Skyler Grey75ea9172022-08-06 10:22:23 +010032 accountCreated: entry(
33 member.user.createdAt,
34 renderDelta(member.user.createdAt)
35 ),
pineafan63fc5e22022-08-04 22:04:10 +010036 serverMemberCount: member.guild.memberCount
37 },
38 hidden: {
39 guild: member.guild.id
pineafan32767212022-03-14 21:27:39 +000040 }
pineafan63fc5e22022-08-04 22:04:10 +010041 };
42 log(data);
pineafan32767212022-03-14 21:27:39 +000043}