$onJoined

Triggered when a user joins the server.

$onJoined[channelID] is a callback, which means it's used in the command trigger (not the code). The command is ran when a user joins the server.

📌 You can only have 1 single $onJoined[] per bot.

Syntax

$onJoined[channelID]

Parameters

  • channelID (Type: Snowflake || Flag: Required): The ID of the channel where the message should be sent to.

Example

  1. Create a command with the trigger $onJoined[channelID].

    🧙‍♂️ You must replace "channelID" with a valid channel ID or a server variable that holds the channel ID (See more here...)!

    example1

  2. Input your code/reply text.

    🧙‍♂️ You can use functions like $username, $authorAvatar, $authorID, $membersCount, $serverName[$guildID] here.

    example2

  3. Now, you have a welcome message! ✨
    example3

Not Working? Check out the Troubleshooting section.

Troubleshooting

Is $onJoined[] 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.
    image
    image

  • Open BDFD app and select your bot. Go to bot settings and enable Member Intents.
    Screenshot_20220808_042857
    Screenshot_20220808_043030

    📝 Enabled intents in the app should reflect the intents enabled in the Discord Developer Portal.
    For example: If you have Members 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 $onJoined[channelID] is written in the "command trigger" field and not in the code.
    image

  • Make sure your bot has VIEW_CHANNEL, EMBED_LINKS, SEND_MESSAGES permission in the channel provided in $onJoined[], and that you inputted a valid channel ID.

  • Also, make sure you don't have more than 1 $onJoined[].

Advanced

Per-Server $onJoined

Both free and premium users can use $onJoined[], and all users can put $getServerVar[] within $onJoined[]. 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 $onJoined[] (e.g. set their own welcome channel), follow these steps:

  1. Create a variable named "welcome" and the value set to nothing.
    image

  2. Create a command for setting the welcome channel, then put the following in your code:

    $nomention
    $onlyAdmin[You need the admin permission to use that!]
    $argsCheck[>1;Please mention a channel!]
    Welcome channel updated!
    $setServerVar[welcome;$mentionedChannels[1]]
    

    📝 Servers will need to setup the channel they want the welcome message to send to (by running a command with the code above).

  3. Now replace $onJoined[channelID] in your welcome command trigger, with $onJoined[$getServerVar[welcome]] and you're all set!