diff --git a/src/listeners/GuildMemberAdd/addUser.ts b/src/listeners/GuildMemberAdd/addUser.ts index 7c8f761..b88fa8d 100644 --- a/src/listeners/GuildMemberAdd/addUser.ts +++ b/src/listeners/GuildMemberAdd/addUser.ts @@ -1,5 +1,6 @@ import { Client, Events, GuildMember } from "discord.js"; import { db } from "../.."; +import { CHANNELS } from "../../config"; // Adds a User to the database as they just joined the server. This is used for tracking purposes and to store user data in the future. export default async function addUserToDB(client: Client): Promise { @@ -14,6 +15,20 @@ export default async function addUserToDB(client: Client): Promise { timestamp: new Date(member.joinedTimestamp!), isBot: member.user.bot, }); + + // Get general chat and welcome the user + const generalChat = member.guild.channels.cache.find( + (channel) => channel.id === CHANNELS.GENERAL, + ); + if (generalChat?.isTextBased()) { + await generalChat.send( + `Welcome to the server, ${member.user}! Feel free to introduce yourself and check out the channels.`, + ); + } else { + console.error( + "General chat channel not found or is not text-based.", + ); + } }); }