Commands Manual

Playground

User can run commands in two ways, the one way is typing them into the input entry of chat buffer.

The another way is writing the commands to the server.auto-run and chat.auto-run configuration items. For more details, please refer to Configuration Manual.

Syntax

A command is a line of string that has the following format, different elements are separated by whitespace:

<name> [subcommand] [<option> [value]]... [argument]...

The command’s name starts with a slash / and doesn’t contain any whitespace, such as: /join.

Note

When you want to send a message starts with a slash, please prepend another slash to the message. For example, you want to send “/this is a slash prefixed message”, you need to type “//this is a slash prefixed message”.

A subcommand is a instruction behind the command name, it is optional.

An option, as its name, is optional too, starts with a hyphen - and may has a value.

option is often used as the switch of a flag or a way to change some default values. For example, The command /connect -tls -port 6697, option -tls is just a flag that tells srain use secure connections with TLS. And -port requires a value, if -port is not specified, program will use the default value 6667. Check /connect for more details.

If a vaule starts with a hyphen - or contains whitespaces, it should be enclosed by single quotation mark '.

Note

All option should appear behind subcommand (If any), and before argument.

An argument is similar to vaule, but commonly it doesn’t have a default value so it can not be omitted (actually it depends on the implement of the command). If the first argument starts with a hyphen -, it should be enclosed by single quotation mark '. If an argument contains whitespaces, it should be quoted too. Specially, the last argument can contain whitespace without quoted.

If you want to use a single quotation mark in a quoted text, use backslash \ to escape it. For backslash itself, use double backslash \\.

Available Commands

/context

Warning

This command is deprecated.

Usage:

/context <server> [chat]

Change the current context.

Arguments:

  • server: The server you want to operate after
  • chat: Optional, the chat you want operate after, if not set, fallback to server’s current chat

/reload

Usage:

/reload

Reload user configuration.

/server

Usage:

/server [connect|disconnect] <name>

Predefined IRC server management.

Note

This command may changes context.

Sub commands:

  • connect: connect to specified predefined server
  • disconnect: disconnect from specified predefined server

Arguments:

  • name: unique name of server

/connect

Usage:

/connect [-port <port>] [-pwd <password>] [-tls] [-tls-noverify]
    [-user <username>] [-real <realname>] <host> <nick>

Create a IRC server and connect to it immediately.

Note

This command may changes context.

Options:

  • -port: server port, default 6667
  • -pwd: connection password, default empty
  • -tls: use secure connections with TLS
  • -tls-noverify: use TLS connection without certificate verification
  • -user: specify username, default same as nickname
  • -real: specify realname, default same as nickname

Arguments:

  • host: server host
  • nick: specify nickname

Example:

/connect -real 'I am srainbot' -tls -port 6697 chat.freenode.org srainbot
/connect 127.0.0.1 srainbot

Note

The following commands should run under the specified context. The context can be changed by /context, /server or /connect.

/ignore & /unignore

Usage:

/ignore [-cur] <nick>
/unignore [-cur] <nick>

Ignore/unignore somebody’s message.

Options:

  • -cur: only ignore in current chat

/query & /unquery

Usage:

/query <nick>
/unquery [nick]

Start/stop private chat with somebody. For /unquery , If no nick is specified, it stops the current private chat.

/join

Usage:

/join <channel>[,<channel>]... [<passwd>[,<passwd>]]...

Join specified channel(s), channels are separated by commas ,.

Example:

/join #archinux-cn,#gzlug,#linuxba
/join #channel1,#channe2 passwd1

/part

Usage:

/part [<channel>[,<channel>]]... [<reason>]

Leave specified channel(s) with optional reason, channels are separated by commas ,. If no channel is specified, it leaves the current channel.

Example:

/part #archinux-cn Zzz...
/part #archlinux-cn,#tuna
/part

/quit

Usage:

/quit [reason]

Quit current server with optional reason.

/topic

Usage:

/topic [-rm|<topic>]

Set the current channel’s topic. If no topic specified, it just displays the current channel’s topic.

  • -rm: remove current channel’s topic

Example:

# Just view the topic
/topic
# Set the topic to "Welcome to Srain!"
/topic Welcome to Srain!
# Clear the topic
/topic -rm

/msg

Usage:

/msg <target> <message>

Send message to a target, the target can be channel or somebody’s nick. If you want to send a message to channel, you should /join it first.

/me

Usage:

/me <message>

Send an action message to the current target.

/nick

Usage:

/nick <new_nick>

Change your nickname.

/whois

Usage:

/whois <nick>

Get somebody’s information on the server.

/invite

Usage:

/invite <nick> [channel]

Invite somebody to join a channel. If no channel is specified, it falls back to current channel.

/kick

Usage:

/kick <nick> [channel] [reason]

Kick somebody from a channel, with optional reason. If no channel is specified, it falls back to current channel.

/mode

Usage:

/mode <target> <mode>

Change target ‘s mode.

/ctcp

Usage:

/ctcp <target> <command> [message]

Send a CTCP request to target. The commonly used commands are: CLIENTINFO, FINGER, PING, SOURCE, TIME, VERSION, USERINFO. For the detail of each command, please refer to https://modern.ircdocs.horse/ctcp.html .

If you send a CTCP PING request without message, you will get the latency between the target.

Note

DCC is not yet supported.

/pattern

Usage:

/pattern add <name> <pattern>
/pattern rm <name>
/pattern list

Regular expression pattern management. The added pattern can be used elsewhere in the application, such as /filter & /unfilter and /render & /unrender.

Sub commands:

  • add: add a pattern with given name
  • rm: remove a pattern with given name
  • list: list all availables patterns

Arguments:

/filter & /unfilter

Usage:

/filter [-cur] <pattern>
/unfilter [-cur] <pattern>

Filter message whose content matches specified pattern.

Options:

  • -cur: only ignore in current chat

Arguments:

  • pattern: name of regular expression pattern which is managed by /pattern

Example:

This filter message that content is “Why GTK and not Qt?”:

/pattern add troll ^Why GTK and not Qt\?$
/filter troll

To cancel the filter of these kind of message, use:

/unfilter troll

Note

Pattern NO NEED to consider the case where the mIRC color code is included in the message.

/render & /unrender

Usage:

/render [-cur] <nick> <pattern>
/unrender [-cur] <nick> <pattern>

Render message of specific user via specific pattern.

The given pattern should contains specific Named Subpatterns used for capturing message fragment from original message content and become part of rendered message.

There are list of available named subpatterns:

  • (?<sender>): match name of sender, once this subpatterns is matched, the original sender will be displayed as message remark
  • (?<content>): match content of rendered message
  • (?<time>): match time of rendered message

Arguments:

  • nick: nickname of user
  • pattern: name of regular expression pattern which is managed by /pattern

Options:

  • -cur: only effects the user under current chat

Example:

We assume that there is a IRC bot named “xmppbot”. It forwards message between XMPP and IRC. On IRC side, the forwarded message looks like “<xmppbot> [xmpp_user] xmpp_message”, you can render it to a more easy-to-read format via the following commands:

/pattern add xmpp \[(?<sender>[^:]+?)\] (?<content>.*)
/render xmppbot xmpp

The forwarded meessage will look like “<xmpp_user> xmpp_message”, and the original message sender “xmppbot” will be displayed as message remark.

Note

TODO: Add figure

Note

Pattern SHOULD consider the case where the mIRC color code is included in the message.

Obsoleted Commands

/rignore & /unrignore

This command has been dropped since 2019-06-14 Version 1.0.0rc5, please use /filter & /unfilter instead.

/relay & /unrelay

This command has been dropped since 2019-06-14 Version 1.0.0rc5, please use /render & /unrender instead.