blob: ebc2934387ec3bb3938c2aec61506ff061479a16 [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);
Skyler Grey11236ba2022-08-08 21:13:33 +010010 const { log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger;
11 await client.database.history.create("join", member.guild.id, member.user, null, null);
pineafan63fc5e22022-08-04 22:04:10 +010012 const data = {
13 meta: {
14 type: "memberJoin",
15 displayName: "Member Joined",
16 calculateType: "guildMemberUpdate",
17 color: NucleusColors.green,
18 emoji: "MEMBER" + (member.user.bot ? ".BOT" : "") + ".JOIN",
19 timestamp: member.joinedTimestamp
20 },
21 list: {
22 memberId: entry(member.id, `\`${member.id}\``),
23 name: entry(member.id, renderUser(member.user)),
24 joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
Skyler Grey11236ba2022-08-08 21:13:33 +010025 accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
pineafan63fc5e22022-08-04 22:04:10 +010026 serverMemberCount: member.guild.memberCount
27 },
28 hidden: {
29 guild: member.guild.id
pineafan32767212022-03-14 21:27:39 +000030 }
pineafan63fc5e22022-08-04 22:04:10 +010031 };
32 log(data);
pineafan32767212022-03-14 21:27:39 +000033}