The TOPIC command lets a chanop set a channel’s topic, and lets anyone view the topic.


TOPIC <channel> [<topic>]
  • <channel>: Channel to modify/view.
  • <topic>: If given, the new topic to set on the channel.

A TOPIC message sent from the server indicates that the topic has been changed. In this case, the <prefix> is the user that’s changed the topic. If a chanop’s TOPIC command is successful, they receive one of these messages. In addition, all other clients in the channel also receive a TOPIC message. For example, if dan and alice are on #v4, and dan sets a new topic (or unsets the topic), both of them will receive a TOPIC message indicating that the topic’s been changed. The examples illustrate this in action.

If <topic> is given, the command is a request to change the topic. If <topic> is given and is an empty string, the server unsets the current topic. If <topic> is not given, the server returns a topic burst with the current topic information.

A topic burst consists of:

  • If the topic is set, an RPL_TOPIC numeric and possibly an RPL_TOPICWHOTIME numeric.
  • If the topic is not set, an RPL_NOTOPIC numeric.

When the protected topic mode is set, changing the topic (setting or unsetting it) is restricted to channel operators, and sometimes alternate permission levels added to the server such as halfop.

If the channel does not exist, the server returns ERR_NOSUCHCHANNEL. If the user is not joined to the channel, the server returns ERR_NOTONCHANNEL. If the user changing the topic does not have appropriate permissions, the server returns ERR_CHANOPRIVSNEEDED.


Examples

C  ->  TOPIC #v3 :This is a cool channel!!
S <-   :dan!d@Clk-830D7DDC TOPIC #v3 :This is a cool channel!!

Setting a topic

C  ->  TOPIC #v3 :
S <-   :dan!d@Clk-830D7DDC TOPIC #v3 :

Unsetting a topic

C  ->  topic #v4
S <-   :irc.example.com 332 dan #v4 :Coolest topic
S <-   :irc.example.com 333 dan #v4 dan 1547858123

Viewing a set topic

C  ->  topic #v4
S <-   :irc.example.com 331 dan #v4 :No topic is set.

Viewing no topic

C  ->  TOPIC #v5 :New topic!
S <-   :irc.example.com 482 dan #v5 :You're not channel operator

Setting a topic with no privileges (while protected topic is set)

C  ->  TOPIC #v6 :New topic!
S <-   :irc.example.com 442 dan #v6 :You're not on that channel

Setting a topic while not on the channel


Compatibility


Related Numerics

  • RPL_NOTOPIC (331)
  • RPL_TOPIC (332)
  • RPL_TOPICTIME (333)
  • ERR_NOSUCHCHANNEL (403)
  • ERR_NOTONCHANNEL (442)
  • ERR_NEEDMOREPARAMS (461)
  • ERR_CHANOPRIVSNEEDED (482)

Contributors to this page: Daniel Oaks

You can edit and contribute changes to this page on GitHub here.