# $channelTopic

The `$channelTopic` function returns the **topic** of the channel where the command is executed, or of another channel when its ID is given. The topic is the text displayed at the top of the channel, generally used to describe its purpose.

## Syntax

```
$channelTopic[(Channel ID)]
```

## Parameters

| Parameter | Description |
|---|---|
| `Channel ID` | Optional. The channel to read. If omitted or empty (`$channelTopic`, `$channelTopic[]`), the current channel is used. A non-numeric or non-positive value raises `Invalid channel ID.`; an unknown channel raises `Channel not found.` |

## Return value

| Type | Description |
|---|---|
| `string` | The topic of the channel. Returns an empty string if no topic is set or if the channel type has no topic. |

## Examples

### Display the topic

```bdfd
$sendMessage[**Channel Topic:** $channelTopic]
```

### Check if a topic exists

```bdfd
$if[$channelTopic!=]
  $sendMessage[Topic: $channelTopic]
$else
  $sendMessage[This channel does not have a topic.]
$endif
```

### Topic of another channel

```bdfd
$sendMessage[Rules topic: $channelTopic[123456789012345678]]
```

### Topic in an embed

```bdfd
$title[#$channelName[$channelID]]
$description[Topic: $channelTopic]
$color[#5865F2]
```

## Notes

- Topics are returned for text, announcement, forum and media channels.
- For other channel types (voice, categories, threads, etc.), the function returns an empty string.
- The function raises an error if the channel cannot be resolved.
