pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 1 | import { callback as statsChannelAdd } from "../reflex/statsChannelUpdate.js"; |
| 2 | import { callback as welcome } from "../reflex/welcome.js"; |
| 3 | import client from "../utils/client.js"; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 4 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 5 | export const event = "guildMemberAdd"; |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 6 | |
| 7 | export async function callback(_, member) { |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 8 | welcome(_, member); |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 9 | statsChannelAdd(_, member); |
| 10 | const { log, NucleusColors, entry, renderUser, renderDelta } = |
| 11 | member.client.logger; |
| 12 | await client.database.history.create( |
| 13 | "join", |
| 14 | member.guild.id, |
| 15 | member.user, |
| 16 | null, |
| 17 | null |
| 18 | ); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 19 | const data = { |
| 20 | meta: { |
| 21 | type: "memberJoin", |
| 22 | displayName: "Member Joined", |
| 23 | calculateType: "guildMemberUpdate", |
| 24 | color: NucleusColors.green, |
| 25 | emoji: "MEMBER" + (member.user.bot ? ".BOT" : "") + ".JOIN", |
| 26 | timestamp: member.joinedTimestamp |
| 27 | }, |
| 28 | list: { |
| 29 | memberId: entry(member.id, `\`${member.id}\``), |
| 30 | name: entry(member.id, renderUser(member.user)), |
| 31 | joined: entry(member.joinedAt, renderDelta(member.joinedAt)), |
Skyler Grey | 75ea917 | 2022-08-06 10:22:23 +0100 | [diff] [blame] | 32 | accountCreated: entry( |
| 33 | member.user.createdAt, |
| 34 | renderDelta(member.user.createdAt) |
| 35 | ), |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 36 | serverMemberCount: member.guild.memberCount |
| 37 | }, |
| 38 | hidden: { |
| 39 | guild: member.guild.id |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 40 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 41 | }; |
| 42 | log(data); |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 43 | } |