1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487
|
===============
Commands Manual
===============
.. contents::
:local:
:depth: 3
:backlinks: none
.. _commands-playground:
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
:doc:`config`.
.. _commands-syntax:
Syntax
======
A command is a line of string that has the following format, different elements
are separated by whitespace::
/<name|alias> [subcommand] [<option> [value]]... [argument]...
User should use ``name`` to invoke a command.
The command's ``name`` starts with a slash ``/`` and doesn't contain any
whitespace, such as: ``/join``.
Some commands have ``alias`` that can be used instead of ``name``,
for example, user can use ``/j`` instead of ``/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 :ref:`commands-connect` for more details.
If a ``value`` 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 ``value``, 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
==================
/reload
-------
Usage::
/reload
Reload user configuration.
.. _commands-server:
/server
-------
Usage::
/server [connect|disconnect|list] <name>
Predefined IRC server management.
Sub commands:
* ``connect``: connect to specified predefined server
* ``disconnect``: disconnect from specified predefined server
* ``list``: list all predefined servers
Arguments:
* ``name``: unique name of server
.. _commands-connect:
/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.
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
.. _commands-ignore:
/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|q <nick>
/unquery [nick]
Start/stop private chat with somebody. For ``/unquery`` , If no ``nick`` is
specified, it stops the current private chat.
.. _commands-join:
/join
-----
Usage::
/join|j <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|leave [<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|m <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 :ref:`commands-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.
.. _commands-ctcp:
/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.
.. _commands-pattern:
/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
:ref:`commands-filter` and :ref:`commands-render`.
Sub commands:
* ``add``: add a pattern with given name
* ``rm``: remove a pattern with given name
* ``list``: list all availables patterns
Arguments:
* ``name``: unique name of pattern
* ``pattern``: a valid Perl-compatible Regular Expression,
see :manpage:`pcrepattern(3)`
.. _commands-filter:
/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
:ref:`commands-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.
.. _commands-render:
/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.
.. _Named Subpatterns: https://developer.gnome.org/glib/stable/glib-regex-syntax.html#id-1.5.25.13
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
:ref:`commands-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.
Please refer to :ref:`faq-relay-message-transform` see its effect.
.. note::
Pattern **SHOULD** consider the case where the mIRC color code is
included in the message.
.. _commands-quote:
/quote
------
Usage::
/quote <raw message>
For sending special IRC commands.
.. versionadded:: 1.2.0
.. _commands-clear:
/clear
------
Usage::
/clear
Clear all messages in current buffer.
.. versionadded:: 1.4
.. _commands-pass:
/pass
------
Usage::
/pass <password>
Send connection password to the server.
.. versionadded:: 1.8
Obsoleted Commands
==================
.. _commands-rignore:
/rignore & /unrignore
---------------------
This command has been dropped since :ref:`version-1.0.0rc5`,
please use :ref:`commands-filter` instead.
.. _commands-relay:
/relay & /unrelay
-----------------
This command has been dropped since :ref:`version-1.0.0rc5`,
please use :ref:`commands-render` instead.
|