pineafan | 0f5cc78 | 2022-08-12 21:55:42 +0100 | [diff] [blame] | 1 | import type { GuildMember } from "discord.js"; |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 2 | import { callback as statsChannelAdd } from "../reflex/statsChannelUpdate.js"; |
| 3 | import { callback as welcome } from "../reflex/welcome.js"; |
PineaFan | 64486c4 | 2022-12-28 09:21:04 +0000 | [diff] [blame^] | 4 | import type { HaikuClient } from "../utils/haiku/index.js"; |
pineafan | 4edb776 | 2022-06-26 19:21:04 +0100 | [diff] [blame] | 5 | |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 6 | export const event = "guildMemberAdd"; |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 7 | |
pineafan | 0f5cc78 | 2022-08-12 21:55:42 +0100 | [diff] [blame] | 8 | export async function callback(client: HaikuClient, member: GuildMember) { |
| 9 | welcome(client, member); |
| 10 | statsChannelAdd(client, member); |
| 11 | const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger; |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 12 | await client.database.history.create("join", member.guild.id, member.user, null, null); |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 13 | const 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: { |
| 23 | memberId: entry(member.id, `\`${member.id}\``), |
| 24 | name: entry(member.id, renderUser(member.user)), |
| 25 | joined: entry(member.joinedAt, renderDelta(member.joinedAt)), |
Skyler Grey | 11236ba | 2022-08-08 21:13:33 +0100 | [diff] [blame] | 26 | accountCreated: entry(member.user.createdAt, renderDelta(member.user.createdAt)), |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 27 | serverMemberCount: member.guild.memberCount |
| 28 | }, |
| 29 | hidden: { |
| 30 | guild: member.guild.id |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 31 | } |
pineafan | 63fc5e2 | 2022-08-04 22:04:10 +0100 | [diff] [blame] | 32 | }; |
| 33 | log(data); |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 34 | } |