> For the complete documentation index, see [llms.txt](https://upik.gitbook.io/scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://upik.gitbook.io/scripts/discord-bot/custom-commands.md).

# Custom Commands

#### Registering a Command

The following script demonstrates how to register a basic Discord command using the provided `ExampleCommand` configuration:

```lua
local ExampleCommand = {
    name = "test",
    description = "This is the Test Description",
    access_roles = { "1111111111111111111", "2222222222222222222" }, -- DISCORD ROLE ID
    options = {
        {
            name = "id",
            description = "Provide an ID",
            optiontype = "number",
            required = true,
        },
        {
            name = "user",
            description = "Provide a User",
            optiontype = "user",
            required = true,
        },
        {
            name = "choice",
            description = "Select an Option",
            optiontype = "string",
            required = true,
            choices = {
                { name = "Option 1", value = "option1" },
                { name = "Option 2", value = "option2" },
            },
        }
    },
    onUse = function(args)
        args.reply({
            author = "Discord Bot",
            description = "First Argument: " .. args.id .. "\nInvoker: " .. args.user.username .. "\nSelected Option: " .. args.choice,
            color = "Green"
        })
        args.sendTo("user", { -- Argument Name (in this case 2nd option)
            author = "Discord Bot",
            description = "Hello!",
            color = "Green"
        })
    end,
}

TriggerEvent("upikk_discordbot:RegisterCommand", ExampleCommand)
```

#### Key Points

* **name**: Assigns a name to the command.
* **description**: Provides a brief about what the command does.
* **access\_roles**: Specifies the Discord roles that have access to this command.
* **options?**: Defines the required
