Overview
Aphonos automatically sends a themed welcome message when new members join the Discord server. The welcome system uses embeds with custom styling to create an engaging first impression.How It Works
When a new member joins the server, Aphonos:- Detects the
guildMemberAddevent - Fetches the configured welcome channel
- Creates a themed embed with member information
- Sends the welcome message to the channel
Welcome Message
The welcome message is sent as an embedded message with the following features:Message Content
FromeventHandlers.ts:114:
Visual Elements
- Color: Green (
#00FF00) for a welcoming appearance - Title: Themed greeting message with emoji
- Description: Multi-line welcome text with server information
- Thumbnail: Member’s Discord avatar
- Footer: Server motto/tagline
- Timestamp: Exact time the member joined
The welcome message uses a unique thematic style that matches the ALTER EGO Wiki’s lore and community culture.
Configuration
Welcome Channel
The welcome channel is hardcoded in the bot’s configuration:- Exist in the server
- Be a text channel (
ChannelType.GuildText) - Be accessible to the bot
Customizing the Message
To customize the welcome message, modify the embed configuration insrc/utils/eventHandlers.ts:114:
- Title: Change the
.setTitle()value - Description: Modify the text in
.setDescription() - Color: Adjust the hex color in
.setColor() - Footer: Update the
.setFooter()text - Thumbnail: Change from avatar to server icon with
.setThumbnail(member.guild.iconURL())
Event Integration
The welcome system integrates with Discord.js events through the main bot file:handleMemberJoin function (eventHandlers.ts:108):
- Receives the
GuildMemberobject - Fetches the welcome channel from the guild’s channel cache
- Validates the channel exists and is a text channel
- Creates and sends the welcome embed
Implementation Details
Key Files
src/utils/eventHandlers.ts- Member join handler (eventHandlers.ts:108)- Main bot file - Event listener registration
Error Handling
The welcome system handles several edge cases:- Channel not found: If the welcome channel doesn’t exist, the function silently returns
- Wrong channel type: Validates the channel is a text channel before sending
- Member object: Uses the full
GuildMemberobject (not partial) for avatar and tag
The welcome system does not send DMs to new members. All welcome messages are posted in the public welcome channel.
Required Permissions
The bot needs these permissions in the welcome channel:- View Channel: To see the channel
- Send Messages: To post welcome messages
- Embed Links: To send embedded messages
- Attach Files: For avatar thumbnails (external images)
Extending the System
Adding Welcome Roles
You can extend the welcome handler to automatically assign roles:Multiple Welcome Channels
To support different welcome messages for different scenarios:- Store channel IDs in a configuration file
- Add logic to determine which channel to use
- Create different embed templates for each use case
Conditional Welcomes
You can add conditions to skip or modify welcomes:Best Practices
- Keep messages concise: New members may be overwhelmed by too much text
- Include useful links: Add server rules, guide channels, or resources
- Test permissions: Ensure the bot can always access the welcome channel
- Monitor channel: Regularly check that welcome messages are being sent
- Match server theme: Keep the message style consistent with your community
Troubleshooting
Welcome messages not sending
- Check that the welcome channel ID is correct
- Verify the bot has Send Messages and Embed Links permissions
- Ensure the channel hasn’t been deleted or archived
- Check bot logs for error messages
Missing avatars in thumbnails
This usually indicates:- The member’s avatar failed to load (retry later)
- The bot lacks “Attach Files” or “Embed Links” permission
Wrong channel receiving messages
Update theWELCOME_CHANNEL_ID constant in eventHandlers.ts:19 to the correct channel ID.