update channel_op.py ban formatting to use ${}

This commit is contained in:
jesopo 2020-02-21 15:43:52 +00:00
parent 98b7529605
commit fe4972bc03

View file

@ -12,23 +12,23 @@ QUIET_METHODS = {
} }
KICK_REASON = "your behavior is not conducive to the desired environment" KICK_REASON = "your behavior is not conducive to the desired environment"
NO_QUIETS = "This network doesn't support quiets" NO_QUIETS = "This network doesn't support quiets"
KICK_REASON_SETTING = utils.Setting("default-kick-reason", KICK_REASON_SETTING = utils.Setting("default-kick-reason",
"Set the default kick reason", example="have a nice trip") "Set the default kick reason", example="have a nice trip")
BAN_FORMATTING = "${n} = nick, ${u} = username, ${h} = hostname, ${a} = account"
@utils.export("channelset", utils.Setting("ban-format", @utils.export("channelset", utils.Setting("ban-format",
"Set ban format ($n = nick, $u = username, $h = hostname, $a = account)", "Set ban format (%s)" % BAN_FORMATTING, example="*!${u}@${h}"))
example="*!$u@$h"))
@utils.export("channelset", utils.Setting("ban-format-account", @utils.export("channelset", utils.Setting("ban-format-account",
"Set ban format for users with accounts " "Set ban format for users with accounts (%s)" % BAN_FORMATTING,
"($n = nick, $u = username, $h = hostname, $a = account)", example="~a:$a")) example="~a:${a}"))
@utils.export("serverset", utils.OptionsSetting( @utils.export("serverset", utils.OptionsSetting(
list(QUIET_METHODS.keys())+["none"], "quiet-method", list(QUIET_METHODS.keys())+["none"], "quiet-method",
"Set this server's method of muting users")) "Set this server's method of muting users"))
@utils.export("botset", KICK_REASON_SETTING) @utils.export("botset", KICK_REASON_SETTING)
@utils.export("serverset", KICK_REASON_SETTING) @utils.export("serverset", KICK_REASON_SETTING)
@utils.export("channelset", KICK_REASON_SETTING) @utils.export("channelset", KICK_REASON_SETTING)
@ -82,7 +82,7 @@ class Module(ModuleManager.BaseModule):
if not account_format == None: if not account_format == None:
return self._format_hostmask(user, account_format) return self._format_hostmask(user, account_format)
format = channel.get_setting("ban-format", "*!$u@$h") format = channel.get_setting("ban-format", "*!${u}@${h}")
return self._format_hostmask(user, format) return self._format_hostmask(user, format)
def _ban(self, channel, masks, time, add): def _ban(self, channel, masks, time, add):