# Bot owner only commands

{% embed url="<https://youtu.be/_67r4wq23BA?t=512>" %}

Some commands should only be available to the bot owners. A perfect example of this is a "status" command that updates the status of your bot. WOKCommands comes with this capability.

Here is how your command file should be setup:

{% tabs %}
{% tab title="JavaScript" %}
{% code title="status.js" %}

```javascript
const { CommandType } = require("wokcommands");

const setStatus = (client, status) => {
  client.user?.setPresence({
    status: "online",
    activities: [
      {
        name: status,
        type: ActivityType.Playing,
      },
    ],
  });
};

module.exports = {
  description: "Sets the bot's status",

  type: CommandType.BOTH,

  minArgs: 1,
  expectedArgs: "<status>",

  ownerOnly: true,

  callback: ({ client, text }) => {
    setStatus(client, text);

    return {
      content: `Set status to "${text}"`,
    };
  },
};
```

{% endcode %}
{% endtab %}

{% tab title="TypeScript" %}
{% code title="status.ts" %}

```typescript
import { ActivityType, Client } from "discord.js";
import { CommandObject, CommandType, CommandUsage } from "wokcommands";

const setStatus = (client: Client, status: string) => {
  client.user?.setPresence({
    status: "online",
    activities: [
      {
        name: status,
        type: ActivityType.Playing,
      },
    ],
  });
};

export default {
  description: "Sets the bot's status",

  type: CommandType.BOTH,

  minArgs: 1,
  expectedArgs: "<status>",

  ownerOnly: true,

  callback: (options: CommandUsage) => {
    const { client, text } = options;
    setStatus(client, text);

    return {
      content: `Set status to "${text}"`,
    };
  },
} as CommandObject;
```

{% endcode %}
{% endtab %}
{% endtabs %}

Whenever we initialize WOKCommands we can pass in any number of IDs for the owner's Discord accounts:

{% hint style="info" %}
The bot owner's ID is automatically added to the bot owner list. If you are the only developer working on your project you do not need to add your ID.
{% endhint %}

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

```javascript
const path = require("path");
const WOK = require("wokcommands");
require("dotenv/config");

const client = new Client({
  intents: [
    IntentsBitField.Flags.Guilds,
    IntentsBitField.Flags.GuildMessages,
    IntentsBitField.Flags.DirectMessages,
    IntentsBitField.Flags.MessageContent,
  ],
  partials: [Partials.Channel],
});

client.on("ready", () => {
  console.log("The bot is ready");

  new WOK({
    client,
    commandsDir: path.join(__dirname, "commands"),
    botOwners: ["Your_ID_Here"]
  });
});

client.login(process.env.TOKEN);
```

{% endcode %}
{% endtab %}

{% tab title="TypeScript" %}
{% code title="index.ts" %}

```typescript
import { Client, IntentsBitField, Partials } from "discord.js";
import path from "path";
import WOK from "wokcommands";
require("dotenv/config");

const client = new Client({
  intents: [
    IntentsBitField.Flags.Guilds,
    IntentsBitField.Flags.GuildMessages,
    IntentsBitField.Flags.DirectMessages,
    IntentsBitField.Flags.MessageContent,
  ],
  partials: [Partials.Channel],
});

client.on("ready", () => {
  console.log("The bot is ready");

  new WOK({
    client,
    commandsDir: path.join(__dirname, "commands"),
    botOwners: ["Your_ID_Here"]
  });
});

client.login(process.env.TOKEN);
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wornoffkeys.com/commands/bot-owner-only-commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
