$onLeave
When a user leaves the server, the command is triggered.
$onLeave[channelID]
is a callback, which means it's used in the command trigger (not the code). The command is ran when a user leaves the server. You must replace 'channelID' with a valid channel ID.
Example
-
Make the command trigger
$onLeave[channelID]
. -
Input your code/reply text.
🧙♂️ You can use functions like
$username
,$authorAvatar
,$authorID
,$membersCount
,$serverName[$guildID]
here. -
Now, you have a leave message! ✨
Not Working? Check out the Troubleshooting section.
Troubleshooting
Is $onLeave[] bugged or not working?
-
You must have at least version
1.17.9
of the app. -
Go to Discord Developer Portal and select your bot. Then, click on bot's tab and enable Member Intents.
-
Open BDFD app and select your bot. Go to bot settings and enable Member Intents.
📝 Enabled intents in the app should reflect the intents enabled in the Discord Developer Portal.
For example: If you havemembers intent
enabled in the Discord Developer Portal then you should respectively enable them in the app (unless you don't want to use them at all). -
Make sure
$onLeave[channelID]
is written in the 'command trigger' field and not in the code.
-
Make sure your bot has
VIEW_CHANNEL
,EMBED_LINKS
,SEND_MESSAGES
permission in the channel provided in$onLeave[]
, and that you inputted a valid channel ID. -
Also, make sure you don't have more than 1
$onLeave[]
.
Advanced
Per-Server $onLeave
Both free and premium users can use $onLeave[]
, and all users can put $getServerVar[]
within $onLeave[]
. However, non-premium users can not use $getServerVar[]
outside of callbacks.
If you own a public bot and want to make it so multiple different servers can use $onLeave[]
(e.g. set their own leave message channel), follow these steps:
-
Make a variable named "
leave
" and the value set to nothing.
-
Make a command for setting the leave channel, then put the following in your code:
$nomention $onlyAdmin[You need the admin permission to use that!] $argsCheck[>1;Please mention a channel!] Leave channel updated! $setServerVar[leave;$mentionedChannels[1]]
📝 Servers will need to setup the channel they want the leave message to send to (by running a command with the code above).
-
Now replace
$onLeave[channelID]
in your leave command trigger, with$onLeave[$getServerVar[leave]]
and you're all set!