> For the complete documentation index, see [llms.txt](https://dbd-ts.gitbook.io/dbdts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dbd-ts.gitbook.io/dbdts/callbacks/onbotjoin.md).

# onBotJoin

Command executes when the bot gets added to a new guild.

**Event:** `onBotJoin`\
**Type:** `botJoinCommand`

### Prerequisites

**Add the `onBotJoin` Event:**

{% tabs %}
{% tab title="index.js" %}

```javascript
bot.addEvent([
    "onMessage",
    "onInteraction",
    "onBotJoin" //This is what you need to add
])
```

{% endtab %}
{% endtabs %}

### Example

```javascript
bot.commands.add({
  type: "botJoinCommand",
  code: `$channelSendMessage[773363417338609674;
 $title[1;New Guild]
 $color[1;RANDOM]
 $description[1;Guild Name: $serverName[$guildID]
 Guild ID: $guildID]]`
})
```

![Result](https://user-images.githubusercontent.com/69215413/138603207-bcbba678-226d-4761-bc65-28f98992c302.png)
