pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 1 | import { callback as statsChannelAdd } from '../automations/statsChannelAdd.js'; |
| 2 | import { callback as welcome } from '../automations/welcome.js'; |
| 3 | import log from '../utils/log.js'; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 4 | import client from '../utils/client.js'; |
| 5 | |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 6 | export const event = 'guildMemberAdd' |
| 7 | |
| 8 | export 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 |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 13 | try { await client.database.history.create("join", member.guild.id, member.user, null, null) } catch {} |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 14 | 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: { |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame^] | 24 | memberId: entry(member.id, `\`${member.id}\``), |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 25 | 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 | } |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 34 | log(data); |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 35 | } catch {} |
| 36 | } |