Mode (IRC Command)
This command is used for changing channel modes or user modes, although never in the same command. This command accepts between 0 and 21 arguments. The first argument are the modes you wish to set or unset, while remaining arguments are used to name the users on which you wish to set these modes. Note that for changing user modes, only one argument is ever used, the modes you wish to change. If this command is issued without arguments, then you will see a list of the currently set modes. Whether these are your user modes or the modes of a specific channel depend on your IRC client. You will need to consult its documentation for further information. Note that you can only ever change a maximum of 20 modes at one time, although you will unlikely to ever be changing this many user modes at once.
For the following examples, <nick> is used to denote your current nickname, and <channel> is used to denote a channel you wish to target with the command. If other nicknames are to be specified in the examples, these will be made clear. Also note that this article does not cover in detail what the individual channel modes or user modes do in detail. Consult the channel modes or user modes document for further information about this.
To change your user mode to +R so that only registered users can send you messages, you can issue this command:
/mode <nick> +R
To undo this change, use the following command:
/mode <nick> -R
If you wish to set user modes +g and +w, but unset user modes +R and +W, you can issue this command:
/mode <nick> +gw-RW
Channel modes are issued in a similar way, except that a channel is the target instead of your nickname, and channel modes sometimes accept arguments. To start off with a basic example, if you wish to make a channel moderated, or +m, you can issue this command:
/mode <channel> +m
To unmoderate the channel again, you can use this command:
/mode <channel> -m
If you wish to give voice to a user called nick1, you would issue this command:
/mode <channel> +v nick1
To remove voice from nick1, you can issue this command instead:
/mode <channel> -v nick1
To give voice back to nick1, and remove voice from nick2, you can use this command:
/mode <channel> +v-v nick1 nick2
Note that when you do this, modes are applied in the same order that you give the arguments. If you wanted to do the opposite, and give voice to nick2 while removing voice from nick1, you can either switch the order of channel modes or switch the order of arguments. If you switch both however, you will have the exact same results as the original command.
This can be taken further by allowing you to set other modes as well. Let's again say you wish to moderate the channel, but want to give voice to nick1 and remove voice from nick2. You can use this command:
/mode <channel> +vm-v nick1 nick2
Not all channel modes take their arguments as nicknames. Some use numbers, host masks, and other types of argument instead. This is all documented in the channel modes page. Just as above, arguments are assigned in the order you provide channel modes. This means it is up to you to ensure that when you set multiple modes in a channel, that the arguments are passed in the same order as the modes, or unintended consequences could happen. The following, much more complicated example, is a perfectly valid mode command:
/mode <channel> +vvbelj-bem nick1 nick2 *!*@host1 nick3!*@host2 12 3:10 *!*@host4 nick10!*@host5
Be sure that you know what you are doing when running commands like this. It sometimes pays to run them in a test channel first if at all possible.