> For the complete documentation index, see [llms.txt](https://go-adam.gitbook.io/adam/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://go-adam.gitbook.io/adam/first-steps/modules.md).

# Grouping Commands in Modules

## What are Modules?

Apart from commands, adam also provides modules as a way of grouping commands. You might know command groups from other bot frameworks, however, modules are a bit more strict. Each module has its own name and every command in it can only be invoked if prefixed by its module's name.

## Creating a Module

Just as commands, a module is also abstracted through the `plugin.Module` interface. Luckily, using a module is even easier than a command, and one can be created by calling `module.New`.

{% code title="plugins/mod/mod.go" %}

```go
package mod

import (
    "github.com/mavolin/adam/pkg/impl/module"
    "github.com/mavolin/adam/pkg/plugin"
)

// New creates a new moderation module.
func New() plugin.Module {
    return module.New(module.Meta{Name: "mod"}})
}
```

{% endcode %}

{% hint style="info" %}
Just like with `command.Meta`, `module.Meta` also offers some more fields. Refer to its [documentation](https://pkg.go.dev/github.com/mavolin/adam/pkg/impl/module#Meta) for more information.
{% endhint %}

## Adding Plugins

Similarly to`bot.Bot`, `module.Module` also provides a `AddCommand` and `AddModule` method to add plugins.

{% code title="plugins/mod/mod.go" %}

```go
package mod

import (
    "github.com/mavolin/myBot/plugin/mod/ban"
    "github.com/mavolin/myBot/plugin/mod/kick"

    "github.com/mavolin/adam/pkg/impl/module"
    "github.com/mavolin/adam/pkg/plugin"
)

// New creates a new moderation module.
func New() plugin.Module {
    m := module.New(module.Meta{Name: "mod"}})
    
    m.AddCommand(ban.New())
    m.AddCommand(kick.New())
    
    return m
}
```

{% endcode %}
