Goodbyes
The Goodbyes module sends a message to a channel of your choice whenever a member leaves your server. You can customise the message with placeholders and optionally show who originally invited the person when they joined.
Requirements
To show the original inviter in goodbye messages, the Welcomer module must have been running with
showInvitee: true when the member joined. Goodbye invite data is read from inviteData.json
which is created by the Welcomer module. If that file does not exist or has no record for the member, the inviter line is silently skipped.
Settings
Open settings/settings.js and set the channel where goodbye messages will be posted,
along with the default message text.
let goodbyeChannelId = 'YOUR_CHANNEL_ID';
let goodbyeMessage = 'Goodbye {username}, we will miss you!';
Placeholders
Use these inside your goodbye message to insert live values.
| Placeholder | What it outputs |
|---|---|
{user} | Mentions the member e.g. @Steve |
{username} | Plain username with no mention e.g. Steve |
{server} | The name of your server pulled live from Discord |
Basic Usage
Import the module and call it once in your main bot file. The message argument is optional and falls back to whatever you set in settings.js.
const { DiscordGoodbye } = require('./node_modules/bb-dbotbits/discordGoodbye.js');
DiscordGoodbye('Goodbye {username}, we will miss you!');
Showing the Original Inviter
Pass showInvitee: true to append a line showing who originally invited the member when they joined.
This reads from inviteData.json so no live invite fetching is needed.
DiscordGoodbye('Goodbye {username}, we will miss you!', { showInvitee: true });
DiscordGoodbye('Goodbye {username}, we will miss you!', { showInvitee: false });
Example Output
With showInvitee: true the bot will post something like this in your goodbye channel:
Goodbye Steve, we will miss you! Invited by @John
If no invite record exists for the member, for example they joined before the Welcomer module was active, the inviter line is silently skipped and only the goodbye message is sent.
Using Welcomer and Goodbyes Together
The two modules are designed to work alongside each other. A typical setup looks like this:
const { DiscordWelcomer } = require('./node_modules/bb-dbotbits/discordWelcomer.js');
const { DiscordGoodbye } = require('./node_modules/bb-dbotbits/discordGoodbye.js');
DiscordWelcomer('Welcome to {server}, {user}!', { showInvitee: true });
DiscordGoodbye('Goodbye {username}, we will miss you!', { showInvitee: true });
Back to Welcomer or continue to All Commands.