blob: b1c2700695f36b07292befe73daf4dcb914d9a06 [file] [log] [blame]
pineafan73a7c4a2022-07-24 10:38:04 +01001import { callback as statsChannelAdd } from '../reflex/statsChannelAdd.js';
2import { callback as welcome } from '../reflex/welcome.js';
pineafan32767212022-03-14 21:27:39 +00003import log from '../utils/log.js';
pineafan4edb7762022-06-26 19:21:04 +01004import client from '../utils/client.js';
5
pineafan32767212022-03-14 21:27:39 +00006export const event = 'guildMemberAdd'
7
8export async function callback(_, member) {
9 try { welcome(_, member); } catch {}
10 try { statsChannelAdd(_, member); } catch {}
11 try {
12 const { log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger
pineafan4edb7762022-06-26 19:21:04 +010013 try { await client.database.history.create("join", member.guild.id, member.user, null, null) } catch {}
pineafan32767212022-03-14 21:27:39 +000014 let data = {
15 meta: {
16 type: 'memberJoin',
17 displayName: 'Member Joined',
18 calculateType: 'guildMemberUpdate',
19 color: NucleusColors.green,
20 emoji: "MEMBER" + (member.user.bot ? ".BOT" : "") + ".JOIN",
21 timestamp: member.joinedTimestamp
22 },
23 list: {
pineafanda6e5342022-07-03 10:03:16 +010024 memberId: entry(member.id, `\`${member.id}\``),
pineafan32767212022-03-14 21:27:39 +000025 name: entry(member.id, renderUser(member.user)),
26 joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
27 accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
28 serverMemberCount: member.guild.memberCount,
29 },
30 hidden: {
31 guild: member.guild.id
32 }
33 }
pineafan4edb7762022-06-26 19:21:04 +010034 log(data);
pineafan32767212022-03-14 21:27:39 +000035 } catch {}
36}