pineafan | 02ba023 | 2022-07-24 22:16:15 +0100 | [diff] [blame^] | 1 | import { callback as statsChannelAdd } from '../reflex/statsChannelUpdate.js'; |
pineafan | 73a7c4a | 2022-07-24 10:38:04 +0100 | [diff] [blame] | 2 | import { callback as welcome } from '../reflex/welcome.js'; |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 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 {} |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 10 | try { |
| 11 | const { log, NucleusColors, entry, renderUser, renderDelta } = member.client.logger |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 12 | 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] | 13 | 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: { |
pineafan | da6e534 | 2022-07-03 10:03:16 +0100 | [diff] [blame] | 23 | memberId: entry(member.id, `\`${member.id}\``), |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 24 | 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 | } |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 33 | log(data); |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 34 | } catch {} |
pineafan | 02ba023 | 2022-07-24 22:16:15 +0100 | [diff] [blame^] | 35 | try { statsChannelAdd(_, member, ); } catch {} |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 36 | } |