With ChanServ's MLOCK (Mode Lock) setting you can permanently enable or disable specific channelmodes.
/CHANSERV SET #replaceWithYourChannelname MLOCK modes
Where modes needs to be replaced with the modes you want to permanently enable/disable. For instance the modes +ntS-lips
Note that the modes you set here won't add to existing locked modes, but instead will replace the existing locked modes.
For instance, if we want to set the following permanent modes on channel #coffeecorner:
- no messages allowed from outside the channel (channelmode n)
- only operators are allowed to change the Topic (channelmode t)
- the channel can never be set to secret (channelmode s) or private (channelmode p)
- the invite-only mode can never be applied (channelmode i)
- the channelkey 'milkAndCookies' is always set (channelmode k)
then we need to use the following command:
/CHANSERV SET #coffeecorner MLOCK -spi+ntk milkAndCookies
Explanation of plus and minus
With a plus-sign (+) in front of the modes, you indicate that the modes always need to be active (and thus can't be disabled without changing the MLock).
With a minus-sign (-) in front of the modes, you will get the opposite result: when set with MLock, you prevent those modes from being set with /mode till you've changed the MLock again. For instance it prevents a random operator from (accidentally) setting your channel invite-only.
Remove an MLock
To remove this MLock, you have to use the same command, without adding modes:
/CHANSERV SET #coffeecorner MLOCK +
However, this will also remove the default MLocked modes +nt, so if you want to go back to the standard MLock settings, you can better use this command:
/CHANSERV SET #coffeecorner MLOCK +nt
About locking channelmode +k (channelkey)
Please note that even though setting a channelmode +k in ChanServ MLock will always set the channelkey once the channel gets created, it doesn't prevent the first person from entering that channel without a key.
If the channel is empty, the channel key is not needed to enter, since the channel effectively doesn't exist at that point and thus has no key mode set. This can be worked around by requesting Network Staff to add the ChannelKeeper bot to your channel to keep the channel open just for this situation.
Also, note that if you want to *add* +k to your MLOCKed modes, that you shouldn't forget to include the existing MLOCKed modes. In case of the default MLOCK modes +nt this would be:
/CHANSERV SET #coffeecorner MLOCK +ntk milkandsugar
This would set the channelkey for channel #coffeecorner to be 'milkandsugar', while also retaining the default modes +n (block external messages) and +t (topic only settable by operators).