---
description: >-
  Processing commands, arguments, flags and much more to learn here. Recommended
  to read this page before reading the documentation.
---

# How To Use?

Throughout our documentation and when asking for help on our official server, you will run into many different kinds of notations (or say terms). To help you understand the texts that you read, in this guide, we will be going over some standard notations, understanding how commands work, proper usage of commands and much more!

## Proper Usage of commands

In our help message, documentation or anywhere you ask help, you might see that we enclose variables in some weird brackets, sometimes `<>`, sometimes `[]`... But what do they mean?&#x20;

Basically, they tell you how to use those command arguments in your message. Let's learn the meanings, with an example:

```
@Nyaru ban <Mention | User ID> [reason] [flags]
```

### **Required Arguments**

All usage variables enclosed in `<>` are actually required arguments. If a usage says `<text>`, that means the text argument is required in order for command to work. \
\
In the above example, Mentioning the user or providing their user id is an required argument for the command in order to work, or simply the command will fail to work with an error message.

### **Optional Arguments**

All usage variables enclosed in `[]` are actually optional arguments. Command functionality will not break if you don't supply these arguments.\
\
In the above example, supplying a reason for the ban is optional, since the member can also be banned without a reason. Similar case with flags.

### **Conditional Arguments**

All usage variables enclosed in `()` are actually conditional arguments. As the name suggests, the requirement of those argument is always conditional based on the situation. For an instance, you can find them in `purge` command:

```
@Nyaru purge (count) (sub-command) (search value) [flags]
```

If, you want a normal purge, **count** is a **required** argument, without count bot can not purge random amount of messages. \
In another case, if you want filters in your purge, you are going to use a sub-command where **count** is an **optional argument**. You may or may not need the amount of messages you want to filter if you are using a sub command.&#x20;

### **Configuration Arguments**

All usage variables enclosed in `{}` are actually configuration based conditional arguments. You may see the usage of conditional arguments in [Welcome DMs](../automation/welcomedm) command, etc. Basically, the usage of this command is required if you want to change data, and not required if you want to check current data. It is again a conditional argument, but based on configuration.\
\
If you use `welcomedm` command without arguments,&#x20;

```
@Nyaru welcomedm
```

It is not going to break the command. This will show that if any welcome DMs are setup on your server or not - and if yes, it will show you the current welcome DM configuration. If you want to change or create welcome DMs for your server, you can simply:

```
@Nyaru welcomedm Hey, {{user}}. Welcome to our shiny server!
```

Now, your new welcome DMs are setup! Easy enough?

### Or Operator `|`

You might have saw the sign `|` in documentation or in usage/help command. What does it mean?

The sign `|` is called **Or Operator**. A simple - and easy to understand meaning of this operator is either this **or** this. Confused? Jump right over [here](#proper-usage-of-commands) again to see the use of the operator.

## How commands work?

When you trigger a command, Nyaru breaks your command message into command arguments and flags - and then act accordingly to her best intelligence.

Anything you send without starting with command prefix, our mentioning Nyaru will not be considered as a command. Let's learn more about arguments, flags, triggers and much more.

Your entire command to bot is called as **command message**. Consider the following example:

```
@Nyaru ban @Lumi being naughty so much -dm
```

_Commands are broken into 3 parts over here:_

1. **Prefix**: `@Nyaru` is your prefix here. You can also use your server prefix as per your convience, default prefix is `d!`.
2. **Arguments**: `ban @Lumi being naughty so much` are destructured as **command arguments**.
3. **Flags**: `-dm` is **command flag**.

In the above example, you might have guessed - arguments are further more broken into sub-arguments, that is basically **command syntax** or **command usage**.&#x20;

* The triggered command is `ban`,
* `@Lumi` is the victim who is going to be banned,
* `being naughty so much` is the reason of the ban.

And lastly, the **command flags**.

* `-dm` will DM the victim before banning.

An important observation over here is that command **flags** and command **arguments** are both different things.&#x20;

{% hint style="success" %}
**ProTip**: It seems to be difficult to understand, but actually it isn't. You will get used to the syntax as you use Nyaru. Using message flags seperataly rather than command arguments provide more flexiblitiy to various commands.
{% endhint %}

### Command Arguments <a href="#arguments" id="arguments"></a>

As above, anything after the prefix and before message flags are called command arguments. Command arguments are seperated by spaces.

### Command Flags <a href="#flags" id="flags"></a>

Command flags is an advanced feature in Nyaru, that is used in various commands to deliver various options, but they are different than command arguments - independent.

#### How command flags are destructured?

Bot will look all flags from the end of your command message. Any flag in between your command message is usually not considered as a flag. It is taken and considered as a command argument. Take a look at the example -

```
@Nyaru purge 69 bots -force
```

A very extensive example of [purge](../moderation/purge) command, using [bots](../moderation/purge/bots) sub-command option and a message flag `force`!

Let's understand now, how Nyaru will react on this command.

1. From your command arguments, Nyaru received the command `purge`.
2. You specified your count `69`, the second argument,
3. Nyaru will now trigger `bots` sub-command and filter messages that are sent by bot accounts.\
   By default, Nyaru also filter pinned messages, so you don't loose them - but, you used `force` flag.
4. Because you used `force` flag, now Nyaru will also delete pinned messages forcefully.

And, that's how - Nyaru fetches last 69 messages and killed all messages sent by bots.

{% hint style="info" %}
We understand things can be confusing, but humans can not! (At least our support staff) - Just hit up us in our [community server](https://go.nyaru.xyz) for help.
{% endhint %}
