blob: 317cc3a84df4ef590c3dfe2baf9b8359d3286cb1 [file] [log] [blame]
pineafan32767212022-03-14 21:27:39 +00001import { callback as statsChannelAdd } from '../automations/statsChannelAdd.js';
2import { callback as welcome } from '../automations/welcome.js';
3import log from '../utils/log.js';
4export const event = 'guildMemberAdd'
5
6export async function callback(_, member) {
7 try { welcome(_, member); } catch {}
8 try { statsChannelAdd(_, member); } catch {}
9 try {
10 const { log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger
11 let data = {
12 meta: {
13 type: 'memberJoin',
14 displayName: 'Member Joined',
15 calculateType: 'guildMemberUpdate',
16 color: NucleusColors.green,
17 emoji: "MEMBER" + (member.user.bot ? ".BOT" : "") + ".JOIN",
18 timestamp: member.joinedTimestamp
19 },
20 list: {
21 id: entry(member.id, `\`${member.id}\``),
22 name: entry(member.id, renderUser(member.user)),
23 joined: entry(member.joinedAt, renderDelta(member.joinedAt)),
24 accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)),
25 serverMemberCount: member.guild.memberCount,
26 },
27 hidden: {
28 guild: member.guild.id
29 }
30 }
31 log(data, member.client);
32 } catch {}
33}