# Discord Bot Studio Documentation v2.0

DBS is a powerful tool that allows you to create custom Discord bots without code, using visual programming (without coding).

### Get DBS

{% embed url="<https://discordbotstudio.itch.io/discord-bot-studio>" %}

{% embed url="<https://store.steampowered.com/app/1118380/Discord_Bot_Studio/>" %}

[Discord Bot Studio Website](https://discordbotstudio.org)

### Getting Started

{% content-ref url="/pages/-M0L2tHN5gQNlafTl5lK" %}
[Create and Setup Bot With DBS \[video\]](/setting-up-dbs/setup)
{% endcontent-ref %}

### Hosting

{% content-ref url="/pages/-Mg3N-pER4ibfVBzbR96" %}
[Hosting your bot 24/7](/running-hosting-your-bot/hosting-your-bot-24-7)
{% endcontent-ref %}

### About DBS

DBS is a tool built to empower more people to be able to create their own Discord bots.&#x20;

You can support this project by becoming a [patreon supporter](https://www.patreon.com/dbsdev), or by checking out some of my other projects:

* [ModFoundry - build mods for Minecraft without coding](https://modfoundry.app/)
* [Scout - monitor Reddit for keywords and conversations](https://scoutreddit.com/)


# Create and Setup Bot With DBS \[video]

This page will walk you through the steps needed to setup a bot using Discord Bot Studio once you have downloaded it from Steam.

See the video tutorial here:

{% embed url="<https://youtu.be/6ed71oZVXmg>" %}


# Getting Started with DBS \[text]

This is a guide for bot creation with Discord Bot Studio. Author: ContrarION

## Section 1: Creating the bot

&#x20;Thank you for purchasing Discord Bot Studio! Upon starting the software up, you’ll be met with a screen that looks something like this:

![DBS home page](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MVHhLbtKme3lvVg7S-q%2F-MVHhqubA318v3UpugJh%2Fimage.png?alt=media\&token=ff2fc3f5-3ebb-463e-b6ca-4ac94b031878)

To start off, we're going to click the **Choose Bot** tab in the upper right corner.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MVHhLbtKme3lvVg7S-q%2F-MVHi5q9-fynmZQCe8e0%2Fimage.png?alt=media\&token=9d1891e4-03f5-49d0-85af-0c2f815cce83)

In this tab, you have two sections. The **Choose Bot to Edit** section and **Create New Bot**. We’ll have to come back here, later. For now, click the big blue button that says, **Choose Folder**.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MVHhLbtKme3lvVg7S-q%2F-MVHi8b6AaEuREuxJbvd%2Fimage.png?alt=media\&token=06b1ba86-4461-4033-b296-b8e129d67243)

\
Your system will prompt you to select a folder. This is for you to choose a place your bot will be stored in. You won’t need to use this for anything, unless you intend on installing mods, hosting on anything but the computer you’re using, or backing up your files.\
&#x20;tl;dr Don’t forget where you’ve selected for your bot’s files to be. It’s pretty important!

After selecting a file location, enter a name for your bot in the blank right under the **Choose Folder** button. This name won’t be displayed anywhere, other than in the dropdown menu in the section above. Feel free to act like me, and name your bot something like “AAAAAAAAAAAAAAAAAAAAAAA” or even “Greg” if you’re feeling quirky. Finally, click **Save Bot**, and you’ve finished the first part of making your bot.

## Section 2: Making the bot work

Once you’ve created your bot, move over to the **Setup** tab, and open up your preferred internet browser. The first section we’ll be filling in is the **Command Prefix**. This is pretty simple, as it lets you determine what the symbol or phrase before your command would be. For example, if you used the prefix "!", your help command would be !help.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MVHhLbtKme3lvVg7S-q%2F-MVHkAYhM9zS6RvsGTic%2Fimage.png?alt=media\&token=07ef41c3-57bf-43be-a84d-b8aa2bcd02e2)

\
The next section, **Bot Token**, is extremely important section, as it allows the bot to come online. This is the part where we actually talk to Discord, rather than just using Discord Bot Studio. Start by going to the Discord Developer Login (<https://discord.com/login?redirect_to=%2Fdevelopers>) and logging in. If you’ve logged into the web client, it should automatically redirect you. From here, you’ll have a screen that looks similar to this-![](file:///C:/Users/flomu/AppData/Local/Temp/msohtmlclip1/01/clip_image002.png)

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MVHhLbtKme3lvVg7S-q%2F-MVHkJmXqVB5ZqOmBbh-%2Fimage.png?alt=media\&token=b555b932-79c3-4ea9-a09c-ec66869e1f78)

\
Click **New Application** and name your bot. Be sure to name it what you want your bot to be displayed as, because this will be shown on any Discord servers you invite your bot to. After you create your bot, you might get hit with a sensory overload, or feel like Tony Stark in his Iron Man suit. For now, click the **Bot** tab on the left side of your screen, and click **Add Bot**. Say yes, and you’ll be met with a screen that looks like this-![](file:///C:/Users/flomu/AppData/Local/Temp/msohtmlclip1/01/clip_image002.png)

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MVHkRSxIXed4wtI7Xg4%2F-MVHkUCYtvIndtQ6UzFS%2Fimage.png?alt=media\&token=ec943c5d-3d64-4c1b-a74f-cb0996583661)

\
From here, you can give your bot a profile picture, and change its username. Other than that, you have the bot token, which is what we want. Click **Copy** and return to DBS. Paste it in the **Bot Token** slot, and that’s that. Finally, we have the **Client ID**. DBS asks for this and you never really see it used, but it’s required anyway, so here we go.

Addendum: With DBS 1.2 and higher, there’s an extra step, but it’s really quick and simple. Go to your application page (That’s in your Discord Developer Portal, when you click your bot’s icon.) Go to the **Bot** tab, scroll down, and enable both **Privileged Gateway Intents.** YOUR BOT WILL NOT RUN WITHOUT THIS ENABLED.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MVHkRSxIXed4wtI7Xg4%2F-MVHkhhZYY7ec3IC8Y5P%2Fimage.png?alt=media\&token=e97ea572-fb61-4c27-a2be-1532f114f3c5)


# Inviting a Discord Bot to Your Server

This page will explain how to create an invite link for a Discord bot.

First, navigate to the Discord Developer site at <https://discord.com/developers/applications>.&#x20;

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MF3V0RLuvCSINLSS4ih%2F-MF3ab1-XXtbdHk_wGYG%2Fimage.png?alt=media\&token=d3b003d7-98e8-46dc-b99b-843b44936746)

From here you will see your applications (bots). If you haven't created a bot yet, see the tutorial above this to learn how. Click the box for the bot you want to create an invite link for. This will take you to that application. Then click to the OAuth tab.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MF3V0RLuvCSINLSS4ih%2F-MF3asH01QVpK3CtkUsG%2Fimage.png?alt=media\&token=f31fde0c-e40e-466f-a372-188fc234aa36)

From here you can click the "bot" checkbox, and a link will automatically appear in the bottom textbox, which you can then copy.&#x20;

![Link is shown at the bottom next to the copy button](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MF3V0RLuvCSINLSS4ih%2F-MF3bBNZ32KePEbTPcOk%2Fimage.png?alt=media\&token=380bef20-cbd2-413f-b97d-97b89fee2e12)

Now paste that link into any browser window, and Discord will prompt you to add the bot to any servers that you are an owner of.&#x20;

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MF3V0RLuvCSINLSS4ih%2F-MF3bTAFxqiYzsBLurfe%2Fimage.png?alt=media\&token=ac0a7125-76b4-410f-a8f0-2d5604c12f33)

Click the **Authorize** button, and you're done!


# Enabling Intents

In order for your bot to work with Discord Bot Studio you will need to enable intents. To do so visit the following link: <https://discord.com/developers/applications>.&#x20;

![Visiting the link above will show you any bots you have created](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MURyip6tvVTtiCihH8T%2F-MURyw8Z4NTG8OJDs4Ks%2Fimage.png?alt=media\&token=4e8d0860-7e06-4c1b-a152-5e87b1a48b87)

Once there, click on the bot you are using. Next, select the "Bot" tab from the left hand side:

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MURyip6tvVTtiCihH8T%2F-MURz6IU5frAFd23pDW1%2Fimage.png?alt=media\&token=71f78fd0-3862-42d2-9b9b-109711f3737f)

From there, scroll down to the "Privileged Gateway Intents" section, and enable both options:

![Both intents should be enabled](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MURyip6tvVTtiCihH8T%2F-MURzJC2iz7Mre6U6yzR%2Fimage.png?alt=media\&token=a92c5855-2eb2-452c-ab3c-87bfb26cb130)


# Finding Your Bot Token

How to find your bot token.

Discord Bot Studio requires your bot token to be entered on the Setup page. This page explains how to find that token. To do so visit the following link: <https://discord.com/developers/applications>.&#x20;

![Here you will see any bots you have created](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MUS07CBBkfRr_yuNC6u%2F-MUS0X5O7Tgibkv83_qZ%2Fimage.png?alt=media\&token=69f729e6-1ebf-4965-b047-fd4ccefbeeb1)

Once there, click on the bot you are working with. Next, select the "Bot" tab from the left hand side:

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MUS07CBBkfRr_yuNC6u%2F-MUS0hp210vbxjRjgP61%2Fimage.png?alt=media\&token=1ed31e4d-63d7-4cef-a6e4-7c1d426ddf41)

Finally, click the "Copy" button next to the bot's avatar to copy the token to your clipboard. Then you can paste this into Discord Bot Studio in the token field on the Setup page.

![Click the copy button here, or you can reveal the token and copy manually](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MUS07CBBkfRr_yuNC6u%2F-MUS0xGPIH2CMQUF0fai%2Fimage.png?alt=media\&token=a0c98770-73b8-4b72-b4d8-c907f92cb091)

Keep your token safe, and never share it with anyone else!


# Using the Bot Editor

This page will detail how you can use the flowchart style editor to begin creating bots with Discord Bot Studio.

DBS offers two main pages for editing your bot: **Commands** and **Events**. They are similar in the way they work, in that you connect nodes in a flowchart style.&#x20;

### Commands & Intro

We will begin on the **Commands** page. Get there from the home screen by clicking "Commands" in the upper right navigation bar.&#x20;

When you load your first bot (if you haven't made a bot yet please see the first tutorial on this site) you will see something like this on the commands page.&#x20;

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MF3d1zVqagHReaq2k45%2F-MF3djbIR-KYZSgclIIO%2Fimage.png?alt=media\&token=005a8ae2-6553-49f6-b10f-e89059dd0647)

The darker blue boxes on the left represent commands, and the lighter blue boxes are responses. The command is what a user will type in the server to trigger the responses that are connected to it. For example, if a user types !help (assuming the prefix is !), then the "help menu" response will be triggered. You can connect any number of response to a command. If you run the bot with these default commands, you can test them out in a server to get a feel for how they work.

To open a node (a box), simple double click it on the colored header area. Doing so will automatically bring up a window where you can edit the details of this node.&#x20;

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MF3e3dCEvfl9iwmvuPa%2F-MF3eJ01PePS5-2Mi8rW%2Fimage.png?alt=media\&token=d29b1a9b-54cd-40fe-ac89-d96e1e6219a9)

Once you are done editing the information, you can click save in the bottom right to save and close this window.&#x20;

To add a new command or response, simply click "Add Command" or "Add Response" from the button bar at the top.&#x20;

To connect two nodes, you can click the output of a node, release click, then drag to the input of another node, once there, click again to connect.&#x20;

![Adding a new response and connecting it to a command](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MF3fRur3iFJ3RqRbQ26%2F-MF3fVKwEV6AF4DnQQzF%2Fconnect.gif?alt=media\&token=bfced689-eb13-471f-b186-ae6580301eed)

Make sure you click "Save Flow" after making node connections to make sure they are saved!

### Events

The Events page is very similar in look and feel to the Commands page. Here is what you will see when you first load the Events page for a new bot.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MF3g5PTma-Wc1o81e7S%2F-MF3gFYsgVmZdckOxRXy%2Fimage.png?alt=media\&token=90ae2517-f59f-45b9-8e8f-eb4bebeb6e35)

The pink nodes are the available server events which you can connect responses to, similar to the commands.&#x20;

* **User Joins Server** - this event is fired when a new user joins the server. Connect responses to this to create a welcome message for new users.&#x20;
* **User Kicked** - this event is fired when a user is kicked or leaves the server.
* **User Banned** - this event is fired when a user is banned from the server.
* **Any Message** - this is fired when any message is sent, even if it doesn't contain the prefix for commands. This is great for things like XP systems, where you want to give users xp for each message they send.&#x20;
* **Bot Initialization** - this fires when the bot starts running.&#x20;

Unlike commands, you cannot add any more events to this screen.&#x20;


# Message Category

Nodes in the Message response category

{% content-ref url="/pages/-MgczPqh5Vl\_SpbbX4cm" %}
[Send Message](/response-nodes/message-type-nodes/send-message)
{% endcontent-ref %}

{% content-ref url="/pages/-Mgd0-wrXXvwJ3vGNaNO" %}
[Send Image](/response-nodes/message-type-nodes/send-image)
{% endcontent-ref %}

{% content-ref url="/pages/-Mgd0kMrQjWsi27K8Tsl" %}
[Send Embed](/response-nodes/message-type-nodes/send-embed)
{% endcontent-ref %}

{% content-ref url="/pages/-Mgd2HE8tDam\_JapTbqZ" %}
[Delete Message](/response-nodes/message-type-nodes/delete-message)
{% endcontent-ref %}

{% content-ref url="/pages/-Mgd3F4TxRpU6qiRQkvq" %}
[Check if Message is in Channel](/response-nodes/message-type-nodes/check-if-message-is-in-channel)
{% endcontent-ref %}


# Send Message

Sends a message to a specified channel.

| Field                     | Description                                                                                                                                                            |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Channel**               | Put the name or id of a channel to send the message to here. You can use the "Insert Variable" button to insert a variable that will evaluate to a channel name or id. |
| **Response Message Text** | The content of the message to be sent.                                                                                                                                 |

## Example

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MgcyqX2cVUDdunhGqNi%2F-Mgd-huInkx6yLxoqOeQ%2Fimage.png?alt=media\&token=22468523-f657-4d66-b2a7-34904dc1e7b0)


# Send Image

Sends an image to a specified channel

| **Field**   | Description                                                                                                                                                            |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Channel** | Put the name or id of a channel to send the message to here. You can use the "Insert Variable" button to insert a variable that will evaluate to a channel name or id. |
| **URL**     | The image URL. Make sure this ends in something like "jpg" or "png" so it shows the image and doesn't attach it as a file.                                             |

## Example

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MgcyqX2cVUDdunhGqNi%2F-Mgd0LXwYqXdJIMSKH2L%2Fimage.png?alt=media\&token=bb58ae7e-ea9f-478b-a52d-93d3f24d8943)


# Send Embed

Sends embedded content to a specified channel

| Field            | Description                                                                                                                                                            |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Channel**      | Put the name or id of a channel to send the message to here. You can use the "Insert Variable" button to insert a variable that will evaluate to a channel name or id. |
| **Color**        | The color of the embed.                                                                                                                                                |
| **Title**        | The title text.                                                                                                                                                        |
| **URL**          | The link for the embed.                                                                                                                                                |
| **Author Name**  | The author name will be shown at the top of the embed. **Must include an author name in order for the author image to be shown.**                                      |
| **Author Image** | The URL for the author image. This image will be shown in the top left corner of the embed.                                                                            |
| **Author Link**  | Clickable link for the author image. This is a URL.                                                                                                                    |
| **Description**  | The main body text for the embed.                                                                                                                                      |
| **Thumbnail**    | URL for the thumbnail image.                                                                                                                                           |
| **Image**        | URL for the main embed image.                                                                                                                                          |
| **Timestamp**    | Check if you want the time of sending to be shown at the bottom of the embed.                                                                                          |
| **Fields**       | Add fields to group values at the bottom of the embed.                                                                                                                 |

## Fields Example

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-Mgd0flw8RrWOI3EZqE8%2F-Mgd1nejnktaAMv3LKDW%2Fimage.png?alt=media\&token=720b93b3-e4a6-4261-8659-1cb0305c84fc)


# Delete Message

Deletes a message

| Field                 | Description                                                                                                                            |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **Message to Delete** | The id of the message to be deleted. You can use the "Insert Variable" button to insert a variable that will evaluate to a message id. |
| **Channel**           | The name or id of the channel that the message exists in.                                                                              |

## Example

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-Mgd1rvHOSXIDNj1P-t7%2F-Mgd2ntphUlGJT_RQ5U9%2Fimage.png?alt=media\&token=4cd07f79-9aa5-4018-b0be-3ba36e7343d3)


# Check if Message is in Channel

Checks whether or not a message is in a certain channel. Evaluates to true if it is in the channel, and false otherwise.

|             | Description                                                                                                                            |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **Message** | The id of the message to be checked. You can use the "Insert Variable" button to insert a variable that will evaluate to a message id. |
| **Channel** | The name or id of the channel that should be checked.                                                                                  |


# Reaction Category

Nodes in the Reaction response category

{% content-ref url="/pages/-Mgd4c-9OHybBH\_AieDb" %}
[Add Reaction Listener](/response-nodes/reaction-category/add-reaction-listener)
{% endcontent-ref %}


# Add Reaction Listener

Creates a reaction listener on a message.

Reaction Listeners allow you to listen for emoji reactions on messages. This is useful in creating menus, voting systems, and other similar features. With this node you can specify what emojis can be used, and listen for when users react with them.

| Field                                            | Description                                                                                                                                                                                               |
| ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Message to listen for reactions on**           | The id of the message to be used as the "reaction menu". This is where the emojis will be reacted with. You can use the "Insert Variable" button to insert a variable that will evaluate to a message id. |
| **Listen duration**                              | How long the listener should work for. Set this to 0 to have no time limit.                                                                                                                               |
| **Store reacted emoji in variable with name**    | This lets you store the emoji that was used to react to the message in a variable. This can be referenced later in the "Your Variables" section of the "Insert Variables" button menu.                    |
| **Store user who reacted in variable with name** | This lets you store the user who added the reaction to the message. This can be referenced later in the "Your Variables" section of the "Insert Variables" button menu.                                   |
| **Bot add these reactions automatically?**       | Checking this will tell the bot to react to the message with the emoji options you specify, allowing users to see the possible options they can react with.                                               |

## Adding Emoji Options

This allows you to specify which emojis users can react with. Use this site to copy emojis and paste them into DBS: <https://getemoji.com/>. Do not enter emojis in :emojiname: format, it will not work.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-Mgd4OLZ58th90KUClRC%2F-Mgd68vzrEOsTgQqt7yW%2Fimage.png?alt=media\&token=d36290b3-a2a8-4ebb-b27a-941074abe154)


# Variable Category

Nodes in the Variable response category.

Variables are important tools in creating a useful Discord bot. Variables in Discord Bot Studio can be leveraged in a similar way to traditional programming. Use the nodes in this category to interact with variables. You can also insert a variable value into most fields using the **Insert Variable** button next to the field.

There are three types of variables: temporary, server, and global.&#x20;

**Temporary** variables are stored for the duration that the bot is running. They are not saved to file and will be deleted when the bot goes offline. They are per-server.&#x20;

**Server** variables operate exactly like temporary variables, but they are saved to file and thus persist even if the bot is restarted.&#x20;

**Global** variables are also saved to file and are persistent. They differ from server variables because they are not specific to a certain server; i.e. they can be used by the bot across all servers that it's in.

{% content-ref url="/pages/-Mgd6cEwbXdVXrdlTRzO" %}
[Store Value in Variable](/response-nodes/variable-category/store-value-in-variable)
{% endcontent-ref %}

{% content-ref url="/pages/-MiHgLAU029cbir43k\_M" %}
[Edit Variable](/response-nodes/variable-category/edit-variable)
{% endcontent-ref %}

{% content-ref url="/pages/-MjHQ1ozGeSY8ZwwW-PT" %}
[Check Variable Value](/response-nodes/variable-category/check-variable-value)
{% endcontent-ref %}

{% content-ref url="/pages/-MjHRF5xNbqXPLLjIAnx" %}
[Check if Variable Exists](/response-nodes/variable-category/check-if-variable-exists)
{% endcontent-ref %}

{% content-ref url="/pages/-MjHRig0WtNtsJTMfc3u" %}
[Generate Random Number](/response-nodes/variable-category/generate-random-number)
{% endcontent-ref %}

{% content-ref url="/pages/-MjHSzBBfGel9xq7OP0P" %}
[Get Mentioned User](/response-nodes/variable-category/get-mentioned-user)
{% endcontent-ref %}


# Store Value in Variable

Allows you to store a parameter value from a text command in a variable.

| Field                | Description                                                                                                                                                                                                                                                                                                                                                     |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Variable Name**    | The name of the variable that will be saved.                                                                                                                                                                                                                                                                                                                    |
| **Parameter Type**   | Whether this is a text or numeric variable.                                                                                                                                                                                                                                                                                                                     |
| **Variable Type**    | The type of variable this value will be saved as.                                                                                                                                                                                                                                                                                                               |
| **Parameter Number** | <p>The parameter number field uses the following convention:</p><p>!command parameter1 parameter 2 parameter3 and so on...<br></p><p>Use 0 to take all parameters after the command.<br></p><p>Use a number followed by "+" to take that parameter and all following.</p><p><br>Ex: !command one two three - Using 2+ here will save the value "two three".</p> |

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-Mgd7h_meGWg9iw2-rsT%2F-Mgd7qmB1gMjpQbF6mpv%2Fimage.png?alt=media\&token=f39972b5-c494-446d-80df-2467866de906)


# Edit Variable

Allows you to edit an existing variable

| Field             | Description                                                                                                                                   |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| **Variable Name** | The name of the variable that will be edited.                                                                                                 |
| **Variable Type** | The type of variable this is saved as.                                                                                                        |
| **Operation**     | The operation to take on the variable. The options are addition, subtraction, multiplication, and division.                                   |
| **Value**         | The amount to operate by. For example if you put **2** in this field, and the operation is addition, 2 will be added to the variable's value. |


# Check Variable Value

A multiple-output node that allows you to check the value of a certain variable.

If the condition you supply is true, the nodes connected to the true output will be run, otherwise the nodes connected to the false output will be run.

| **Field**                         | Description                                                                                                                                                                                |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Name of variable to check**     | The name of the variable whose value is being checked. Do not include the ${} syntax. For example- if the variable name is ${tempVars.myValue}, you would just enter myValue in the field. |
| **What type of variable is this** | Select what type the variable that is being checked is stored as.                                                                                                                          |
| **If variable is**                | Pick an operator for comparison.                                                                                                                                                           |
| **Value**                         | The value the variable will be compared to.                                                                                                                                                |


# Check if Variable Exists

A multiple-output node that checks whether a variable exists.

If the variable supplied exists, the nodes connected to the true output will be run, otherwise the nodes connected to the false output will be run.

| **Field**                         | Description                                                                                                                                                                                    |
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Name of variable to check**     | The name of the variable whose existence is being checked. Do not include the ${} syntax. For example- if the variable name is ${tempVars.myValue}, you would just enter myValue in the field. |
| **What type of variable is this** | Select what type the variable that is being checked is stored as.                                                                                                                              |


# Generate Random Number

Generates a random number and stores it as a variable.

| **Field**                         | Description                                             |
| --------------------------------- | ------------------------------------------------------- |
| **Save to variable with name**    | The name of the variable to store the random number in. |
| **Minimum value**                 | The lowest possible number that could be generated.     |
| **Maximum value**                 | The highest possible number that could be generated.    |
| **What type of variable is this** | Select what type the variable to save as.               |


# Get Mentioned User

Gets the first mentioned user in the command message

| **Field**         | Description                               |
| ----------------- | ----------------------------------------- |
| **Variable name** | The name of the variable to be saved.     |
| **Variable type** | Select what type the variable to save as. |


# User Data Category

Nodes in the User Data response category.

User data is a great way to associate any data that is specific to individual users. Using user data allows you to associate values to just one user. This is great for things like XP systems, Leveling systems, and more.&#x20;

{% content-ref url="/pages/-MjHULPgEyW1hg2kxTN9" %}
[Set User Data](/response-nodes/user-data-category/set-user-data)
{% endcontent-ref %}

{% content-ref url="/pages/-MjHVTEFqITzNTECNxYm" %}
[Get User Data](/response-nodes/user-data-category/get-user-data)
{% endcontent-ref %}

{% content-ref url="/pages/-MjHW8LBpi9p3Wxs6ocQ" %}
[Edit User Data](/response-nodes/user-data-category/edit-user-data)
{% endcontent-ref %}

{% content-ref url="/pages/-MjHWZ6P9NzE5K76ildI" %}
[Check User Data](/response-nodes/user-data-category/check-user-data)
{% endcontent-ref %}


# Set User Data

Sets the value of a user data field.

| Field               | Description                                                                                                                                                       |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **User to set for** | The user to set a user data value for. This should evaluate to an id; you can manually copy a user's id or get it programmatically by using a user type variable. |
| **Data field**      | The name of the field to set. This is similar to a variable name, but it's specific to just the user it's set for.                                                |
| **Set value to**    | The value to set for this field on this user.                                                                                                                     |


# Get User Data

Gets the value of a user data field and stores it in a variable for use in other nodes.

| Field                          | Description                                                                                                                                               |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **User to get data from**      | The user to get the data from. This should evaluate to an id; you can manually copy a user's id or get it programmatically by using a user type variable. |
| **Data field**                 | The name of the field to get.                                                                                                                             |
| **Save to variable with name** | The name of the variable this user data field's value will be stored in.                                                                                  |
| **Variable Type**              | The type of the variable to save as.                                                                                                                      |


# Edit User Data

Edits the value of an existing user data field.

| Field               | Description                                                                                                                                                     |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **User to set for** | The user to edit the data field for. This should evaluate to an id; you can manually copy a user's id or get it programmatically by using a user type variable. |
| **Data field**      | The name of the field to edit.                                                                                                                                  |
| **Operation**       | The operation to be applied to the field's value.                                                                                                               |
| **Value**           | The value to add, subtract, multiply, or divide by.                                                                                                             |


# Check User Data

A multiple-output node that checks the value of a user data field.

This node allows the value of a user data field to be checked. If the condition provided evaluates to true the nodes connected to the true output will be run, otherwise the nodes connected to the false output will be run.

| Field                       | Description                                                                                                                                                                |
| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **User to check data from** | The user whose user data field will be checked. This should evaluate to an id; you can manually copy a user's id or get it programmatically by using a user type variable. |
| **Data field**              | The name of the field whose value will be checked.                                                                                                                         |
| **If data field is**        | The operation to be used to compare values.                                                                                                                                |
| **Value**                   | The value to compare with the user data field.                                                                                                                             |


# User Action Category

Nodes in the User Action response category.


# Add Role to User

Adds a role to the specified user.

Ensure that your bot has a role at least as high as the one it's trying to give to a user, otherwise this will not work.

| Field         | Description                                                                                                                                                     |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **User**      | The user to add the role for. This should evaluate to an id or tag; you can manually copy a user's id or get it programmatically by using a user type variable. |
| **Role name** | The name of the role to give to this user                                                                                                                       |


# Remove Role from User

How to remove a role from a user in the server using a DBS bot

This node can be used to remove a role from a user.

| Field          | Description                                                                                                                                                         |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| User           | The user to remove the role from. This should evaluate to an id or tag; you can manually copy a user's id or get it programmatically by using a user type variable. |
| Role to remove | The name or id of the role to remove from the user.                                                                                                                 |
| Reason         | The reason (which will be in the server logs) that the role is being removed.                                                                                       |


# Control Category

Nodes in the Control response category.

{% content-ref url="/pages/-Mju8uy\_NgtEqlEtcSLS" %}
[Wait](/response-nodes/control-category/wait)
{% endcontent-ref %}

{% content-ref url="/pages/-Mju9Pq24QNK8nji6jCo" %}
[Switch Case](/response-nodes/control-category/switch-case)
{% endcontent-ref %}

{% content-ref url="/pages/-MjuANLUg0Ba\_D5P3OwU" %}
[Multiple Input](/response-nodes/control-category/multiple-input)
{% endcontent-ref %}


# Wait

Waits for an explicit amount of time before continuing to the next node.

| Field        | Description                                                |
| ------------ | ---------------------------------------------------------- |
| **Wait for** | How long to wait for (in the amount of the specified unit) |
| **Unit**     | What unit of time                                          |


# Switch Case

Functions like a switch case node in traditional programming. Allows a variable to be compared to any amount of values.

The output for which the variable value is equal will be executed. If no value matches, none of the outputs will be executed.

| Field                 | Description                                                                                                                                                                          |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Variable to check** | The variable whose value will be compared with possible values.                                                                                                                      |
| **Possible values**   | Possible values the variable could match. Each possible value will be added as an output to the node. If the value matches, the responses connected to that output will be executed. |


# Multiple Input

Allows multiple outputs from nodes connect to one node.

Click the **Add input** button on the node to add more inputs. This node cannot be opened as its only function is to sequence multiple inputs into one output.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MjuA5_dOhVBc2BPSG3Z%2F-MjuAlyxUnn6jmKvFuzE%2Fimage.png?alt=media\&token=f3eed3a9-db46-4ab9-b923-189a6950fa29)


# Interaction Category

Nodes in the Interaction response category.


# Reply To Interaction With Message

Allows you to reply to an interaction event (from slash command, button, or select) with a message.

Interaction events in DBS are deferred by default. This is because there is an unknown amount of time that responses will take to execute, and interactions must be replied to or deferred within 3 seconds of their creation. If you are interested in learning more about how this works you can read about it here: <https://discordjs.guide/interactions/replying-to-slash-commands.html#editing-responses>

When the interaction is deferred, the bot will show that it is "thinking":

&#x20;

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MjuBRm0XFpgIhdecfAq%2F-MjuCB7vx8IyiyU58-OM%2Fimage.png?alt=media\&token=b4707e42-ff14-49f1-a5c7-633f1174a7a2)

In order to have the bot replace this with message content, you will use this node.&#x20;

| Field                     | Description                                                  |
| ------------------------- | ------------------------------------------------------------ |
| **Interaction**           | The interaction object to reply to                           |
| **Response message text** | The message content you want to resolve the interaction with |

As an example- if you used this node to reply to an interaction with the text "Replying to a button click!", it would look like this:

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MjuBRm0XFpgIhdecfAq%2F-MjuClrcawBD_QnMZO89%2Fimage.png?alt=media\&token=b4847689-d30d-41c8-9ed8-4c845932d4e1)


# Get Interaction Option

Allows you to store the value of a slash command option in a variable.

Slash commands can have options which trail the actual command. You can think of these like function parameters or arguments.

Using this node allows you to get the value of an option that was used with the slash command.&#x20;

| Field             | Description                                            |
| ----------------- | ------------------------------------------------------ |
| **Interaction**   | The interaction object to get the option from          |
| **Option type**   | What the type of this option is                        |
| **Option name**   | The name of this option                                |
| **Variable name** | The name of the variable to save the option value into |
| **Variable type** | The type to save the new variable as                   |


# Delete Interaction Reply

Explaining how to delete the bot's interaction reply (bot is thinking... message).

When a user uses a slash command, clicks a button, or uses a dropdown, the bot will automatically show the following message: "Bot is thinking...".

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2FOONnw9wnLlPIFOWgaM2M%2Fimage.png?alt=media\&token=f2fc851a-5227-492d-a4a4-62a29bb16d90)

If you'd like to delete this message altogether, you can use the Delete Interaction Reply node.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2F5qBOALhd3hydiCS40xVZ%2Fimage.png?alt=media\&token=3bd99304-6569-4aaf-a5d2-ae332cfac305)

The example above shows how you can delete the "thinking" message for a slash command response.


# External Category


# Call API

Describes how to make your bot call an external API

### Overview

| Field                                           | Description                                                                                                                                                  | Example                               |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------- |
| URL                                             | The URL of the API endpoint you are calling                                                                                                                  | <https://api.openai.com/v1/responses> |
| HTTP Method                                     | The HTTP method verb                                                                                                                                         | POST                                  |
| Bearer token                                    | The authentication token for your API call. Generally this is issued to you by the API service and is unique and private. Do not share this key with anyone. | sk-xyzabcdef                          |
| Request body                                    | The request body for the API call. Must be properly formatted JSON. Leave this blank for GET requests.                                                       | <p>{                                  |
| <br>"model": "gpt-4.1",                         |                                                                                                                                                              |                                       |
| <br>"input": "Give me some whale facts please!" |                                                                                                                                                              |                                       |
| <br>}</p>                                       |                                                                                                                                                              |                                       |
| Response body variable name                     | This is the variable which you can use in other nodes to process the API response body.                                                                      | gptResponse                           |

### OpenAPI (GPT) example

Example bot in action:

<figure><img src="https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2F57T5hHW4wjOFWbKKb0EK%2Fimage.png?alt=media&amp;token=6a1bf07f-a82e-4cbc-a996-69cf93eb723d" alt=""><figcaption><p>With this command, we'll let users ask questions to Chat GPT via our bot</p></figcaption></figure>

The following flow in BSD is used to get a prompt from the user and call Chat GPT (via OpenAI API)

<figure><img src="https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2FS4P2FUxp8h4W1X5LFaQx%2Fimage.png?alt=media&amp;token=7da0246e-2c1b-40b8-a81d-ea863fb64519" alt=""><figcaption><p>Flow layout, sends a message for API success with the response</p></figcaption></figure>

<figure><img src="https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2F93j5blTBAToXus85Bp0a%2Fimage.png?alt=media&amp;token=ece8269a-1590-4514-846a-4c62380f2778" alt=""><figcaption><p>The get input node is used to save the text after the !gpt command to a variable. We will pass this to the API as the prompt</p></figcaption></figure>

<figure><img src="https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2FWlD06QYpEjI3d2GkljUC%2Fimage.png?alt=media&amp;token=0ba33360-ce47-4a00-a772-cb701c480518" alt=""><figcaption><p>The Call API node is used to send the user's prompt to the API endpoint to get a response from Open AI. Make sure to enter your actual bearer token here.</p></figcaption></figure>

<figure><img src="https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2FBjLGu1sMYFO6Pik666zi%2Fimage.png?alt=media&amp;token=5dbea207-bc3c-4242-b42d-3c8d08e898cb" alt=""><figcaption><p>The send message node is used to send the GPT response in a message to the user.</p></figcaption></figure>

We can reference `gptResponse` since we used that variable name in the API Call node.

That's it! Now when a user uses the `!gpt` command with our bot, their prompt will be sent to OpenAI and our bot will respond.


# Hosting your bot 24/7

The video below describes how you can use Pebblehost to host your bot to run 24/7. This costs $3/month for the basic plan.

{% embed url="<https://www.youtube.com/watch?v=YqPjg9vvHLY&ab_channel=DiscordBotStudio>" %}


# Running Bot Locally

To run your bot locally, you will need to make sure the settings have been configured in the **setup** tab.&#x20;

After the settings are configured, and you have created the commands & events for your bot, you can go to the **run bot** tab, and click **start bot**.&#x20;


# Multiple Bots

To create a new bot, or start working on another bot, go to the **choose bot** tab. From here, you can select an existing bot from the dropdown to work on, or create a new bot.&#x20;

First you will need to choose a folder to place the new bot files in. To do this, click the **choose folder** button, and select a folder. Next, give the bot a name, and click **save bot.** After saving, you will be able to select the new bot you created from the dropdown.&#x20;


# Message Commands

### Creating a Command

This example will show you how to create a simple command, which will send a message, and an image when used. On the **Commands** page, click "Add Command".

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-M0ObPBIVFe1CLyu7jj5%2F-M0Oba7tfci-3CDyG1Wc%2Faddcommand.png?alt=media\&token=c750d26e-14ce-4a0e-b698-27de8881ae33)

After typing the name of the command (what your users will type with your prefix to use it), click "Add".

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-M0ObPBIVFe1CLyu7jj5%2F-M0Oc1NrjgYC0y4CC1w0%2Fcmdname.png?alt=media\&token=8830eabd-b457-4b5f-b0a5-ad22eb17de38)

You will see that a node with title "MessageExample" has been added to the flow. Double click the header (blue area) of the node to open it.&#x20;

![Double click this area](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-M0OcB3AtOeQhZgIdTuf%2F-M0OcNphGsjmJq8FQiDx%2Fdbl.png?alt=media\&token=d6e20573-4afc-4bb5-89e9-ced3f18d808c)

From the "Edit Command" window you can rename the command, or add role permissions for this command.

### Adding Message Responses to the Command

Now we can add some responses that will occur whenever this command is typed. Clicking the "Add Response" button at the top of the page will prompt you to create a new response. Here you can configure the name and type of the response. For now I will add a "Send Message" response type:

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-M0Ocw4EuHKsVNyzTgUX%2F-M0Od9tsMb8LMmw4sr1v%2Fimage.png?alt=media\&token=f667d35f-a662-4f7d-8ae7-986151d730d7)

After clicking "Add", you will see that a new response node has been added to the flow. In order for this response to be called when our MessageExample command is used, we must connect it to the command node. This can be done by clicking the output of the command node, dragging, and clicking the input on the response node.&#x20;

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-M0OdXJNBlB0GajYWjDb%2F-M0OeEOCSqmThSMWY04a%2Fdrag.gif?alt=media\&token=4eb819c9-a470-4914-877e-d80be89896d5)

**It is important now to click "Save Flow"** at the top of the screen to ensure this connection is saved. Next, the response node can be edited by double clicking its header to open it. Here, you can enter a channel name to send the message to, and the message content.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-M0OepK_GeQe27o7BfQh%2F-M0OfJaM4WffWJlvBGVN%2Fimage.png?alt=media\&token=19764853-aab4-4302-933b-62332d8562fb)

After entering the channel and response text, "Save" can be clicked. Next, we can add a new node to send an image when the "MessageExample" command is used. Click "Add Response" once again, and this time change the response type to "Send Image".

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-M0OghpW-bhkxmaDH3Jb%2F-M0OgqAy8XWm3RlhS0in%2Fimage.png?alt=media\&token=45a1fe9b-b4b5-4f5f-acdc-d18d2ef539dc)

Now you will see that a "Send Image" type node has also been added. Double click into it to edit the response information. Here you can once again specify the channel to send the image to, and enter the URL for the image to send.&#x20;

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-M0OghpW-bhkxmaDH3Jb%2F-M0OhKmtdHhPUJVyKDfn%2Fimage.png?alt=media\&token=346e06fe-be3d-4257-87ad-456de6ed96db)

After saving this node, we can connect it to the previous message node, **and make sure to click "Save Flow"** afterwards to save these changes. Here's what our finished message command flow will look like:

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-M0OhYtPNRYEuPxM5T30%2F-M0Ohf82TiFtToYf5-o2%2Fimage.png?alt=media\&token=3196e908-2235-46aa-88b1-0eb7b2158936)


# Kick / Ban Command

The video below describes how to create a kick or ban command using Discord Bot Studio.

{% embed url="<https://youtu.be/uuXchWU2Bqo>" %}


# Purge Command

The video below shows how to create a purge command using Discord Bot Studio. This allows you to mass delete messages from a channel.

{% embed url="<https://youtu.be/wHsUB0efAho>" %}


# Role reaction menu

This tutorial will explain how to create a role reaction menu in Discord Bot Studio, without coding.

See the video tutorial here:

{% embed url="<https://youtu.be/Sy-WQRfcA8U>" %}


# XP System

In this video I explain how to make an XP System for your Discord server using Discord Bot Studio. This includes a response to give users xp for each message they send. I also show commands for users

{% embed url="<https://youtu.be/oSNlHMKwNvI>" %}


# Ticket System

This tutorial explains how you can create a ticket system for your Discord server using Discord Bot Studio. Each ticket will create a private channel that can only be accessed by creating user.

{% embed url="<https://youtu.be/w4fEG19XhUw>" %}


# Command Aliases

Command aliases let you call the same command using different aliases. For example: !h, !help, !HELP all call the same thing.

{% embed url="<https://youtu.be/1cnjKZw-JXI>" %}


# Overview

An overview of how events work in Discord Bot Studio.

Discord.js (and in turn Discord Bot Studio bots) include event-driven code. This means you can have your bot listen for certain events that take place in a server, and respond accordingly.&#x20;

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2Faro6ZPiDf5wYAYpaa68m%2Fimage.png?alt=media\&token=af348111-296c-4ac4-8026-b98ecc38b57e)

Each event can have it's own chain of connected responses. In this way, you can control how the bot reacts to each type of event, or ignore it by connecting no response nodes.&#x20;


# Event Types

Each available event


# User Joins Server

How to use the User Joins Server event in Discord Bot Studio

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2F4pWi73UFbKgmQkPCePdb%2Fimage.png?alt=media\&token=72ffbe3a-91d2-4e49-ad05-5c21412b9341)

This event is emitted whenever a user joins a guild.

`tempVars.newuser` is variable made available by DBS which represents the user who just joined the server, triggering this event.

### Example response

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2Fv8Fw8pi75ItK0Md6Gszv%2Fimage.png?alt=media\&token=94d424fb-072c-42f5-8ebc-ac685dd9d240)

Connecting the above response to the User Joins Server event will send a message to the default channel welcoming and tagging any new users who join the server.


# Any Message

How to use the Any Message event in Discord Bot Studio

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2Fwp2m6KI9sibDZ3yHYn1U%2Fimage.png?alt=media\&token=e981a1e6-be9e-4bbb-9d75-41809ceb956c)

\
This event is emitted whenever a message is created.

`tempVars.anymessage` is the variable containing the message that was sent to trigger this event. `tempVars.anymessagemember` is the variable containing the member who sent this message to trigger the event. Both can be leveraged in response to the event.&#x20;

### Example response

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2F6uN2PLYgJVEv7R44R75g%2Fimage.png?alt=media\&token=f41c1170-4b51-4fbd-9415-dcd730ededea)

Connecting the above response to the Any Message event will send a message tagging the user who sent a message and showing the name of the channel they sent that message in.


# Bot Initialization

How to use the Bot Initialization event in Discord Bot Studio

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2F6bacZkqO2cnD8CYOd8sc%2Fimage.png?alt=media\&token=a973b0e8-50e2-4128-9ee8-f4a8d1e057aa)

This event is emitted when the bot starts up in each server.


# Channel Create

How to use the Channel Create event in Discord Bot Studio

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2FjNWwKCfBNmVFyTnjJE16%2Fimage.png?alt=media\&token=1c6b84b9-8321-4f43-b015-e711c4869a6b)

This event is emitted whenever a guild channel is created.

`tempVars.createdchannel` is the variable which contains the value of the channel which was created to fire this event. It can be leveraged in the responses connected to this event node.

### Example response

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2FtzboVctkukpBkbrUowNb%2Fimage.png?alt=media\&token=226f45e4-955c-42d8-ba94-ccdda7741f35)


# Channel Delete

How to use the Channel Delete event in Discord Bot Studio

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2Fmavi9RrI7Su3l7QEedyD%2Fimage.png?alt=media\&token=73a10b25-f853-4fb9-8523-38066f163fa7)

This event is emitted whenever a channel is deleted.

`tempVars.deletedchannel` is the variable which contains the value of the deleted channel.&#x20;


# Channel Update

How to use the Channel Update event in Discord Bot Studio

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2FDqJ8FXlXUV7DMAaY0HDA%2Fimage.png?alt=media\&token=b73341de-efa6-4c22-89ff-caa8c5ff101a)

This event is emitted whenever a channel is updated - such as when there is a name change, topic change, channel type change.

This command makes the variables `tempVars.updatedchannelnew` and `tempVars.updatedchannelold` available to use. They represent the new, and old versions of the channel which was updated.&#x20;


# How to use custom emojis

This page will describe how to use custom emojis within a response node in DBS.

In order to use a custom emoji as part of a response node (such as in an embed description or message content) you need to use the format: **<:name:id>**. It is actually very easy to find this information for an emoji. \ <br>

### Finding the <:name:id> format

To find this string for a certain emoji first go to the Discord server it is in and do the following:

Type **\\:EmojiName:** and click enter to send the message. In my case the emoji I'm finding is :WhiteDBSIcon1:. So I would type **\\:WhiteDBSIcon1:** and press enter.&#x20;

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MhEjtq6C7y6yw5loCKz%2F-MhEkp7nAkQSllHtv8ki%2Fimage.png?alt=media\&token=8e3b12af-acb3-49b5-9ea7-2ac857d3262a)

After you do this, Discord will automatically convert your message to the **<:name:id>** format we need:&#x20;

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MhEjtq6C7y6yw5loCKz%2F-MhEkzX7O65oXpqrdzaC%2Fimage.png?alt=media\&token=5d22db90-c463-4022-a933-c8a08925ae16)

Then you can simply paste this string anywhere in a DBS response, like a Send Message node's content, or a Send Embed's description field:

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MhEjtq6C7y6yw5loCKz%2F-MhEl9aTrufGlcYv4jXA%2Fimage.png?alt=media\&token=a828a118-3fc9-49b1-907d-cafa4169b98f)

This will then appear as the actual emoji when the response is sent in server.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0L1z_JwGF9x5j-YBBE%2F-MhEjtq6C7y6yw5loCKz%2F-MhElJmRhSky2xFbbfDO%2Fimage.png?alt=media\&token=e85c5ecf-22c6-4d88-a77b-6c9b78d41aa8)


# Buttons and Selects

This video shows you how to add buttons and selects to message responses in DBS.

{% embed url="<https://youtu.be/a--eM5ZsYO4>" %}


# Determining which button was clicked

This tutorial will explain how you can determine which button was clicked by a user. This is useful if your bot has more than one button, and you want to be able to link specific functionality to each

## How buttons work

It's possible to have multiple buttons per row, and multiple rows per message. The rule is that there can be one select, or five buttons per row, and up to five rows per message. This is covered in the video here:&#x20;

{% content-ref url="/pages/-MjjqzsQa3E62ckSa6uQ" %}
[Buttons and Selects](/misc/buttons-and-selects)
{% endcontent-ref %}

## Figuring out which button was clicked

The basic timeline for when a button is clicked is as follows:&#x20;

1. The button is added to the message when the bot creates the message
2. A user sees the message and potentially clicks one or more buttons
3. The **ButtonInteraction** event is fired
4. Any responses you have connected to the event node will be executed

### Custom ID

When you add a button to a message you will be asked to enter a **Custom ID.** This ID is how we will determine which button was clicked. For this reason, the Custom ID should be unique for each button. Make a note of what the custom ID is for each button you have, as we'll need it later.

### Check the ID

To determine which button was clicked we will use a **Switch Case** node. This node lets us check the value of a variable against multiple values. We'll connect it to the **Button Interaction** event so we can check the value of the **customId** field of the interaction event.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2FWfOst1qPyFBQxJtoN69b%2Fimage.png?alt=media\&token=51e0bb42-d3f1-4bf4-95d8-5b00f4940dd0)![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2FYfRhZpyzbt4rc5IENcSC%2Fimage.png?alt=media\&token=66f1ffbe-22a8-4500-bc3d-488323732e46)

We can double click on the switch case node to open it. In this case we are checking the value of the **buttoninteraction.customId** to see which button was clicked.&#x20;

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2F3l1I78kbGDrds011gu0p%2Fimage.png?alt=media\&token=019e766f-fb48-4a75-a611-fa448a32070e)

In this example I am checking for two possible values- **custom\_id\_1** and **custom\_id\_btn2**. This correlates to two buttons I have with those as their custom IDs. If the button which I set the custom ID to **custom**\_**id\_btn2** is clicked then the responses connected to that output will be executed.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2FK3A5PiGBuAgmFGBDitIz%2Fimage.png?alt=media\&token=1ed069c8-7ccb-4f60-be9b-39ad397b5afa)

It's possible to have an unlimited number of buttons and have the switch case node check for an unlimited number of values. Any responses can be connected to each output, allowing you to&#x20;


# Slash Commands

This video shows you how to add slash commands to your bot in DBS.

{% embed url="<https://youtu.be/hj6rGT3qKws>" %}


# Tagging a role

This page explains how you can tag a certain role in a message or embed.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2FpNMFLWWMeA0MIngEzIFw%2Fimage.png?alt=media\&token=27a259b5-f10b-4699-af41-cea34807cadb)

The syntax for tagging a role is `<@&ROLEID>`. The role ID can be entered manually or fetched using a variable.


# Tagging a channel

This page explains how you can tag a channel in a message or embed response with your bot.

![](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2FkiHfKKu9kkOcT9lgAtNw%2Fimage.png?alt=media\&token=2189e83e-4f69-4c0b-b802-4c04e4124810)

The syntax for tagging a channel is `<#CHANNELID>`. The channel ID can be entered manually or fetched using a variable.


# Creating Mods

Mods are the best way for user-created content to make its way into DBS.

To see current mods, and view an example mod that you can make into your own, follow this link: <https://github.com/discord-bot-studio/mods>

### Mod File Format

#### HTML

The HTML is what will be rendered in the node in Discord Bot Studio. You can use `<select>`, `<input>`, and `<textarea>` to capture input from the user. The `name` attribute will be used to save the input data. This is then made available in the `mod` function as fields on the `action` parameter.

#### Mod

The mod function is where the logic of the mod should be written. There are parameters available for use.&#x20;

The `action` parameter will have fields with the values that were saved from the user input from the node HTML.

![In this example mod you can see that there is a textarea which has name="messageText". That allows us to access action.messagetext from within the mod code.](https://1776366025-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0L1z_JwGF9x5j-YBBE%2Fuploads%2FkypCf7kp7oYgqVRpoRHM%2Fimage.png?alt=media\&token=fcd55ba2-43fb-4c2c-9217-ca0bed0881c7)


# Installing Mods

The video below shows you how to install mods for Discord Bot Studio. Thanks for making this video Discord Bot Realm!

{% embed url="<https://www.youtube.com/watch?v=yYppljpcrjQ>" %}


# Using Spreadsheet Data

Uploading spreadsheets to use as a database for your bots is one of the most powerful tools DBS offers.

To upload or delete spreadsheets from your bot, you can click the **Spreadsheets** button on either of the **Commands** or **Events** pages. After you have uploaded your spreadsheets, you will see that their information will automatically be populated when you create a **Spreadsheet** type response. It's important to note that spreadsheets get uploaded to each individual bot's files, so they are uploaded per-bot they are needed for.


