blob: 7bee084c1ef600b20685c921e74a2eddeb2d5ca8 [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 {}
pineafan32767212022-03-14 21:27:39 +000010 try {
11 const { log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger
pineafan4edb7762022-06-26 19:21:04 +010012 try { await client.database.history.create("join", member.guild.id, member.user, null, null) } catch {}
pineafan32767212022-03-14 21:27:39 +000013 let data = {
14 meta: {
15 type: 'memberJoin',
16 displayName: 'Member Joined',
17 calculateType: 'guildMemberUpdate',
18 color: NucleusColors.green,
19 emoji: "MEMBER" + (member.user.bot ? ".BOT" : "") + ".JOIN",
20 timestamp: member.joinedTimestamp
21 },
22 list: {
pineafanda6e5342022-07-03 10:03:16 +010023 memberId: entry(member.id, `\`${member.id}\``),
pineafan32767212022-03-14 21:27:39 +000024 name: entry(member.id, renderUser(member.user)),
25 joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
26 accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
27 serverMemberCount: member.guild.memberCount,
28 },
29 hidden: {
30 guild: member.guild.id
31 }
32 }
pineafan4edb7762022-06-26 19:21:04 +010033 log(data);
pineafan32767212022-03-14 21:27:39 +000034 } catch {}
pineafan02ba0232022-07-24 22:16:15 +010035 try { statsChannelAdd(_, member, ); } catch {}
pineafan32767212022-03-14 21:27:39 +000036}