blob: 109f226032ae5c95fafc62e1578d3deb5b78c7eb [file] [log] [blame]
pineafan02ba0232022-07-24 22:16:15 +01001import { callback as statsChannelAdd } from '../reflex/statsChannelUpdate.js';
pineafan73a7c4a2022-07-24 10:38:04 +01002import { 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 {}
pineafan0bc04162022-07-25 17:22:26 +010010 try { statsChannelAdd(_, member, ); } catch {}
pineafan32767212022-03-14 21:27:39 +000011 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 {}
pineafan32767212022-03-14 21:27:39 +000036}