Page MenuHomePhabricator
Paste P16204

irc-close-channel.sh
ActivePublic

Authored by bd808 on May 25 2021, 4:47 PM.
#!/usr/bin/env bash
# Generate ChanServ commands to "close" an IRC channel.
#
# == Usage ==
# ./irc-close-channel.sh "#wikimedia-foo-baz"
# ./irc-close-channel.sh "#wikimedia-foo-baz" --msg
#
# Borrows heavily from <https://w.wiki/3McM> and <https://gist.github.com/nurupo/91b0ebc7f85059b57ea7108a25ae6c69>
#
# license: CC0
CHANNEL=${1:?Channel required (including #)}
TOPIC="This channel has moved to Libera.Chat, see https://w.wiki/3McM for more information."
REDIR="#wikimedia-libera"
PREFIX=""
[[ -n $2 ]] && PREFIX="/msg ChanServ "
echo "${PREFIX}OP ${CHANNEL}"
echo "${PREFIX}TOPIC ${CHANNEL} ${TOPIC}"
echo "${PREFIX}SET ${CHANNEL} ENTRYMSG ${TOPIC}"
echo "${PREFIX}SET ${CHANNEL} MLOCK +fist ${REDIR}"
echo "${PREFIX}SET ${CHANNEL} TOPICLOCK ON"
echo "${PREFIX}SET ${CHANNEL} KEEPTOPIC ON"
echo "${PREFIX}SET ${CHANNEL} GUARD ON"
echo "${PREFIX}CLEAR ${CHANNEL} BANS I"
echo "${PREFIX}CLEAR ${CHANNEL} USERS ${TOPIC}"

Event Timeline

The /msg ChanServ CLEAR <channel> BANS I seems not to work without +F? At least it worked in channels where I had +F and did not in a channel where I did not have that bit. The more manual /mode <#channel> +I + /mode <#channel> -I <invex> method from https://meta.wikimedia.org/wiki/IRC/Migrating_to_Libera_Chat#Closing_Freenode_channels did work however. (Just not fun if there are a lot of +I modes to clear.)

You need the +R flag for CLEAR.

Thanks! -ChanServ-     +R - Enables use of the recover, sync and clear commands.