# Setting up the project

## Install the package

```bash
npm i dsc-utils
```

## Start the journey

Once the package is installed, you need to import it into your project

{% code title="index.js" %}
```javascript
const { Client } = require("discord.js")
const client = new Client()

const Utils = require("dsc-utils")
const utils = new Utils(client)
```
{% endcode %}

After setting up the package you're ready to create the first slash command

```javascript
// Create the command
const cmd = new utils.Command({
    name: "welcome", // 1-32 lowercase character name matching ^[\w-]{1,32}$
    description: "The first interaction using disc-utils", // 1-100 character description
    default_permission: true // whether the command is enabled by default when the app is added to a guild
})

// Create an option
const feeling = new utils.Option({
    name: "feeling", // 1-32 lowercase character name matching ^[\w-]{1,32}$
    description: "How do you feel today", // 1-100 character description
    type: "string" // the type of the value
})

// Create choices for the option
feeling.setChoices([
    new utils.Choice({
        name: "Good", // 1-100 character choice name
        value: "good" // value of the choice, up to 100 characters if string
    }),
    new utils.Choice({
        name: "It's okay",
        value: "okay"
    }),
    new utils.Choice({
        name: "Not good",
        value: "bad"
    })
])

// To test the ephemeral messages, we add another option
const ephemeral = new utils.Option({
    name: "ephemeral", 
    description: "Set the response to an ephemeral message",
    type: "boolean"
})

// Now we need to add the choices to the command
cmd.setOptions([
    feeling,
    ephemeral
])

// Now we need to register the command
console.log(await utils.global().createCommand(cmd))

/** 
 * Discord is caching all global slash commands for 1 hour but to test the slash command immediately you need create a guild command:
 * 
 * utils.guild("guild id").createCommand(cmd)
 */
```

And here we go. You are getting the command logged, that Discord returns
