blob: 34545fb11549d3a2b3903784572decbb628e632b [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);
9 statsChannelAdd(_, member );
10 const { log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger;
11 await client.database.history.create("join", member.guild.id, member.user, null, null);
12 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)),
25 accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
26 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}