# Exports

## Client Exports

<details>

<summary>AddMessage</summary>

```lua
exports.origen_chat:addMessage(message)
```

* message: `table`&#x20;
  * args: `table` or `string`&#x20;
  * title?: `string`
  * barColor?: `string` or `[number, number, number]`&#x20;
  * type?: `string` (*error, warning, info, success, debug)*
  * timestap?: `string`&#x20;
  * icon?: `string`&#x20;

Example:

```lua
exports.origen_chat:addMessage({
    args = {'Test message'},
    barColor = '#00FF00',
    type = 'info',
    title = 'INFO',
    timestamp = "13:00",
    icon = 'lucide:info'
})
```

</details>

<details>

<summary>AddSuggestion</summary>

```lua
exports.origen_chat:addSuggestion(name, help, params)
```

* name: `string`
* help: `string`
* params: `table`&#x20;

  * name: `string`
  * help: `string`
  * disasbled: `boolean`

Example:

```lua
exports.origen_chat:addSuggestion('test_command', 'Test description', {
    {
        name = 'player',
        help = 'The player to greet',
        disabled = false
    },
    {
        name = 'message',
        help = 'The message to send',
        disabled = false
    }
}, false)
```

</details>

<details>

<summary>RemoveSuggestion</summary>

```lua
exports.origen_chat:removeSuggestion(name)
```

* name: `string`

Example:

```lua
exports.origen_chat:removeSuggestion('test_command')
```

</details>

<details>

<summary>ClearChat</summary>

```lua
exports.origen_chat:clearChat()
```

</details>

## Server Exports

<details>

<summary>AddMessage</summary>

```lua
exports.origen_chat:addMessage(target, message)
```

* target: `number`&#x20;
* message: `table`&#x20;
  * args: `table` or `string`&#x20;
  * title?: `string`
  * barColor?: `string` or `[number, number, number]`&#x20;
  * type?: `string` (*error, warning, info, success, debug)*
  * timestap?: `string`&#x20;
  * icon?: `string`&#x20;

Example:

```lua
exports.origen_chat:addMessage(1, {
    args = {'Test message'},
    barColor = '#00FF00',
    type = 'info',
    title = 'INFO',
    timestamp = "13:00",
    icon = 'lucide:info'
})
```

</details>

<details>

<summary>RegisterCommand</summary>

```lua
exports.origen_chat:registerCommand(config, callback)
```

* config: `table`&#x20;
  * command: `string`
  * help: `string`
  * params?: `table`
    * name: `string`
    * type?: `string` (number, text, player, longText)
    * help: `string`&#x20;
    * optional?: `boolean`
  * permissions?: `table` or `string`
* callback: `function`&#x20;
  * source: `number`
  * args: `table`
  * raw: `string`

Example:

```lua
exports.origen_chat:registerCommand({
    command = 'command_name',
    help = 'Command description',
    params = {
        {
            name = 'arg1',
            type = 'number',
            help = 'Number argument',
        },
        {
            name = 'arg2',
            type = 'text',
            help = 'Text argument',
            optional = true,
        },
        {
            name = 'arg3',
            type = 'player',
            help = 'Player argument',
        },
        {
            name = 'arg4',
            type = 'longText',
            help = 'Long text argument',
        },
    },
    permissions = {
        'admin',
        'mod',
    },
}, function(source, args, raw)
    local arg1 = args.arg1
    local arg2 = args.arg2
    local arg3 = args.arg3
    local arg4 = args.arg4

    print(arg1, arg2, arg3, arg4)
end)
```

</details>

<details>

<summary>ResetChat</summary>

```lua
exports.origen_chat:resetChat(playerId)
```

* playerId?: `number`

Example:

```lua
-- Delete the chat of a specific user
exports.origen_chat:resetChat(1)

-- Delete chat for all
exports.origen_chat:resetChat()
```

</details>
