Overview
The Inter-Server Chat feature allows you to create chat pools that relay messages between channels across different Discord servers. This is perfect for multi-server communities, partnered servers, or coordinated networks.How It Works
Chat Pools
A chat pool is a named group of channels that relay messages to each other:- Admin creates a pool with
/interchat create - Channels from different servers join the pool with
/interchat join - Messages sent in any pool channel are relayed to all other channels
- Messages are sent via webhooks to preserve sender identity
Message Relaying
When a message is sent in a pool channel (interServerChat.ts:221):- The bot detects it’s in a configured pool
- Extracts message content, attachments, and context (replies/forwards)
- Creates webhooks in target channels (or uses existing ones)
- Relays the message with the sender’s username and avatar
- Adds server name to distinguish origin:
Username • ServerName
Messages are relayed using webhooks named “Aphonos Relay” to maintain sender identity and improve user experience.
Pool Management
Creating a Pool
Create a new chat pool:Joining a Pool
Connect the current channel to an existing pool:- Pool name (e.g.,
global-chat) - Pool ID (UUID format)
- Pool exists
- Channel isn’t already in another pool
- Channel is a text channel
Leaving a Pool
Disconnect the current channel from its pool:Viewing Pools
List all available chat pools:- Pool name
- Pool ID
- Number of connected channels
- Creation timestamp
Pool Information
Get detailed information about a specific pool:- Pool ID
- Channel count
- Creation date
- List of connected channels with server names
Renaming a Pool
Change a pool’s name:Deleting a Pool
Permanently delete a chat pool:Channel Status
Check if the current channel is connected to a pool:- Connected pool name
- Number of other channels
- List of connected channels
Message Features
Content Relaying
The system relays multiple message types:- Text messages: Full content preserved
- Attachments: Images, videos, files (via URL)
- Stickers: Shown as
[Sticker: Name] - Embeds: Shown as
[Embed](preview not relayed) - Empty messages: Shown as
[Empty message]
Reply Context
When replying to a message (interServerChat.ts:258):- Fetches the referenced message
- Extracts the first 360 characters
- Removes nested reply/forward prefixes
- Adds reply context to the relayed message
Forwarded Messages
Forwarded messages include context (interServerChat.ts:235):- Message snapshots from Discord’s forward feature
- Attachments/embeds in forwarded messages
- Truncates previews to 360 characters
Reply and forward context is preserved across servers, making conversations easier to follow.
Webhook System
Aphonos uses webhooks for message relaying (interServerChat.ts:169):Webhook Creation
Webhook Messages
Relayed messages use:- Username:
DisplayName • ServerName - Avatar: Original sender’s Discord avatar
- Content: Full message with context
- Attachments: Original file URLs
- Mentions: Disabled (
allowedMentions: { parse: [] })
Data Storage
Pools are stored indata/interserver_links.json:
Data Persistence
TheInterServerChat class (interServerChat.ts:30):
- Loads data on bot startup
- Saves data after each modification
- Creates the data directory if missing
- Handles JSON parse errors gracefully
Implementation Details
Key Files
src/commands/interchat.ts- Command implementation (interchat.ts:1)src/utils/interServerChat.ts- Core relay logic (interServerChat.ts:1)- Main bot file - Message event handling
Initialization
The system initializes on bot startup:Message Handling
Messages are processed through:- Ignores bot messages
- Checks if channel is in a pool
- Processes message content and context
- Relays to all other pool channels
Permissions
Bot Permissions
Required in all pool channels:- View Channel: To see messages
- Send Messages: To relay messages
- Manage Webhooks: To create/use relay webhooks
- Read Message History: To fetch reply context
- Attach Files: To relay attachments
Command Permissions
The/interchat command requires Manage Channels permission.
Only users with Manage Channels can create, modify, or delete pools. Regular users can only view their channel’s status.
Best Practices
- Clear pool names: Use descriptive names that indicate purpose
- Test in private channels: Verify relay works before going public
- Coordinate with partners: Share pool IDs securely with trusted server admins
- Monitor activity: Watch for spam or inappropriate use
- Set channel topics: Let users know the channel is connected to other servers
- Use dedicated channels: Avoid connecting important announcement or moderation channels
Troubleshooting
Messages not relaying
- Check the bot has Manage Webhooks permission in all pool channels
- Verify all channels are still in the pool with
/interchat info - Ensure the bot is online in all connected servers
- Check for webhook creation errors in bot logs
”Failed to join pool”
- The channel may already be in another pool (use
/interchat leavefirst) - Verify you’re using the correct pool name or ID
- Ensure the channel is a text channel
Missing attachments or images
Attachments are relayed by URL. If images don’t load:- The original message may have been deleted
- Discord CDN URLs may have expired
- The target server may block external images