# Channels

A channel is a separate chat group that players can send and receive messages in.\
Each channel has its own purpose and set of recipients, for example:

Global Chat - messages visible to everyone on the server.\
Staff Chat - messages only visible to staff members.

## Format

<pre class="language-yaml"><code class="lang-yaml">channels:
    <a data-footnote-ref href="#user-content-fn-1">&#x3C;channel-name></a>: 
        enabled: true
        require-permissions:
            # if enabled, users are required to have "astrachat.channels.global.read" to read messages
            read: true/false

            # if enabled, users are required to have "astrachat.channels.global.write" to send messages
            write: true/false
        # by default this format uses minimessage
        # to enable legacy support, set text.legacy-support to true
        format: "%prefix%%player%%suffix%&#x3C;white>: %message%"

        # duration between each message in ticks
        # players with the "astrachat.channels.global.manage" permission can change this with /slowmode &#x3C;channel> &#x3C;time>
        # slowmode can be bypassed with the "astrachat.channels.global.manage" or "astrachat.admin" permissions
        default-slowmode: 20

        # use this in front of a message to type in this chat without switching channels.
        # leave blank to disable.
        shortcut-prefix: ""

        # if this chat should be sent to other servers. 
        # must have redis enabled and setup
        cross-server: true

        # you can use these commands to talk in this chat
        # using /global &#x3C;message> would send a message in global chat
        commands:
            - global
        
        
        # allow sending messages to and from discord
        # must have discord setup and enabled
        discord:
            enabled: false

            # the format of discord messages that are displayed in game
            # available placeholders:
            # - %nickname% their name as shown in the guild
            # - %display-name% their discord display name
            # - %username% their discord username
            # - %member-id% their discord id
            # - %guild-name% the guild/server name
            # - %channel-name% the channel name
            format: "&#x3C;light_purple>[DISCORD]&#x3C;/light_purple> &#x3C;white>%nickname%: %message%"
            
            # to find, enable developer mode in User Settings > Advanced > Developer Mode
            # then right click the channel and select Copy Channel ID
            channel: "channelId"

            # Supports embeds. See documentation for detailed usage.
            # See: https://astradev.gitbook.io/astrachat/configuration/discord#discord-message-format
            discord-format:
                # whether to enable/disable mentions
                # setting this to false prevents people from using @everyone in-game
                allow-mentions: false
                content: "**%player%**: %message%"

</code></pre>

### Shortcut Prefix

A shortcut prefix gives you the option to type in this channel without typing a full command or completely changing channels.

```yaml
channels:
    staff:
        shortcut-prefix: "#"
```

<figure><img src="https://1164530192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkbY2fVa6DXJVP4aV6fgr%2Fuploads%2FGU5mbtxaPqNNFKwdWabI%2Fshortcut-prefix.gif?alt=media&#x26;token=fde712ad-4192-4c94-8544-8ee2939dd4a3" alt=""><figcaption></figcaption></figure>

### Cross Server

{% hint style="info" %}
Since v1.1.0
{% endhint %}

Cross sever allows messages to be sent across servers with the same channel. This requires you to setup a Redis server. You can use this to combine your staff chat across your network.

Note: formatting is applied on the server where the player sends the message.&#x20;

```yaml
channels:
    staff:
        # this must be enabled on all servers with this channel
        cross-server: true
```

<figure><img src="https://1164530192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkbY2fVa6DXJVP4aV6fgr%2Fuploads%2Fa0t42C77wpbDweHFshB3%2Fimage.png?alt=media&#x26;token=d3bc1fb7-4a71-43e5-bbba-a695ff03db4d" alt=""><figcaption></figcaption></figure>

#### Redis Setup

Free Redis server: <https://redis.io/>

```yaml
redis:
    enabled: true
    host: ""
    port: 6379
    # if you don't have a username, it is probably "default"
    username: "default"
    password: "some password"

```

## Custom Rules

AstraChat supports adding additional rules ontop of the 3 rules enabled by default.

### Helpop

Helpop is in the configuration file by default but must be enabled.

```yaml
channels:
    helpop:
        enabled: true
        require-permissions:
            # if enabled, users are required to have "astrachat.channels.helpop.read" to read messages
            read: true
        
            # if enabled, users are required to have "astrachat.channels.helpop.write" to send messages
            write: false
        
        format: "<dark_purple>[HELPOP]</dark_purple> %prefix%%player%%suffix%<gray>: %message%"
        
        # duration between each message in ticks
        # players with the "astrachat.channels.helpop.manage" permission can change this with /slowmode <channel> <time>
        # slowmode can be bypassed with the "astrachat.channels.helpop.manage" or "astrachat.admin" permissions
        default-slowmode: 80
        
        # use this in front of a message to type in this chat without switching channels.
        # leave blank to disable.
        shortcut-prefix: ""
        
        # you can use these commands to talk in this chat
        # using /helpop <message> would send a message to people with "astrachat.channels.helpop.read" permission
        commands:
            - helpop
```

<figure><img src="https://1164530192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkbY2fVa6DXJVP4aV6fgr%2Fuploads%2FShREOyobBmpRTechKpTd%2Fhelpop.gif?alt=media&#x26;token=61323b3b-c542-44ac-a4d4-c37cb415998b" alt=""><figcaption></figcaption></figure>

### Advertising

```yaml
channels:
    advertising:
        enabled: true
        require-permissions:
            read: false
            write: false

        format: "<light_purple>[AD]</light_purple> %prefix%%player%%suffix%<gray>: %message%"

        default-slowmode: 1200
        
        shortcut-prefix: ""

        commands:
            - ad
            - advertise
```

<figure><img src="https://1164530192-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkbY2fVa6DXJVP4aV6fgr%2Fuploads%2FpThhDo4TpiFrkcuFGJww%2Fadvertising.gif?alt=media&#x26;token=5782b110-4083-4a97-8ddb-3791f140d10f" alt=""><figcaption></figcaption></figure>

[^1]:
