> For the complete documentation index, see [llms.txt](https://m-ahmed310.gitbook.io/fignet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://m-ahmed310.gitbook.io/fignet/core-concepts/commands.md).

# Commands

Command is a method that can be binded against unique string id and can be triggered from any where

`Few use cases of commands are, Checking Server Stats, kicking a player, Logging active player count etc.`

### How to create a command

```csharp
static void Main(string[] args)
{
    IServer serverApp = new ServerApplication();
    serverApp.SetUp();
    
    // bind/add command
    serverApp.AddCommand("activeUsers", ()=>{
        FN.Logger.Info($"Users count: {FN.PeerCollection.GetPeers().Count}");
    });
    
    // trigger/execute command
    serverApp.ExecuteCommand("activeUsers");
    
    // get list(ids) of avaliable commands
    List<string>commands = serverApp.ListCommands();
    
    Run(serverApp);
    serverApp.TearDown();
}
```
