log !fwarn add/set/del to LOG_CHANNEL, if set
This commit is contained in:
parent
3479b72ce7
commit
ead74e0fe5
@ -38,6 +38,8 @@ ALLOWED_ALT_CHANNELS_COMMANDS = []
|
|||||||
DEV_CHANNEL = ""
|
DEV_CHANNEL = ""
|
||||||
PASTEBIN_ERRORS = False # If DEV_CHANNEL is set, errors will be posted there.
|
PASTEBIN_ERRORS = False # If DEV_CHANNEL is set, errors will be posted there.
|
||||||
|
|
||||||
|
LOG_CHANNEL = "" # Log !fwarns to this channel, if set
|
||||||
|
|
||||||
|
|
||||||
IGNORE_HIDDEN_COMMANDS = True # Ignore commands sent to @#channel or +#channel
|
IGNORE_HIDDEN_COMMANDS = True # Ignore commands sent to @#channel or +#channel
|
||||||
ALLOW_NOTICE_COMMANDS = False # Allow "/notice #channel !command" to be interpreted as a command
|
ALLOW_NOTICE_COMMANDS = False # Allow "/notice #channel !command" to be interpreted as a command
|
||||||
|
@ -796,6 +796,16 @@
|
|||||||
"fwarn_expiry_invalid": "Invalid expiration, must be a number above 0 followed by either d, h, or m, or 'never' for a warning that never expires.",
|
"fwarn_expiry_invalid": "Invalid expiration, must be a number above 0 followed by either d, h, or m, or 'never' for a warning that never expires.",
|
||||||
"fwarn_cannot_add": "Cannot add warning, double-check your parameters (the nick might be wrong or you are not joined to the channel).",
|
"fwarn_cannot_add": "Cannot add warning, double-check your parameters (the nick might be wrong or you are not joined to the channel).",
|
||||||
"fwarn_added": "Added warning #{0}.",
|
"fwarn_added": "Added warning #{0}.",
|
||||||
|
"fwarn_log_add": "(\u000304ADD\u0003) Warning #{0} to {1} by {2} - {3} ({4} point{5}, {6})",
|
||||||
|
"fwarn_log_add_expiry": "expires in {0}",
|
||||||
|
"fwarn_log_add_noexpiry": "never expires",
|
||||||
|
"fwarn_log_set": "(\u000302SET\u0003) Warning #{0} to {1} modified by {2} - {3}",
|
||||||
|
"fwarn_log_set_expiry": "expire time changed from {0} to {1}",
|
||||||
|
"fwarn_log_set_noexpiry": "never",
|
||||||
|
"fwarn_log_set_reason": "reason changed from '{0}' to '{1}'",
|
||||||
|
"fwarn_log_set_notes": "notes changed from '{0}' to '{1}'",
|
||||||
|
"fwarn_log_set_notes_new": "notes changed to '{0}'",
|
||||||
|
"fwarn_log_del": "(\u000303DEL\u0003) Warning #{0} to {1} ({2}) deleted by {3}",
|
||||||
"fwarn_done": "Done.",
|
"fwarn_done": "Done.",
|
||||||
"fwarn_sanction_invalid": "Invalid sanction, can be either deny, stasis, or tempban.",
|
"fwarn_sanction_invalid": "Invalid sanction, can be either deny, stasis, or tempban.",
|
||||||
"fwarn_stasis_invalid": "Invalid stasis amount, specify sanction as \"stasis=number\".",
|
"fwarn_stasis_invalid": "Invalid stasis amount, specify sanction as \"stasis=number\".",
|
||||||
|
@ -91,6 +91,9 @@ def connect_callback(cli):
|
|||||||
if botconfig.DEV_CHANNEL:
|
if botconfig.DEV_CHANNEL:
|
||||||
channels.update(chan.lstrip("".join(var.STATUSMSG_PREFIXES)) for chan in botconfig.DEV_CHANNEL.split(","))
|
channels.update(chan.lstrip("".join(var.STATUSMSG_PREFIXES)) for chan in botconfig.DEV_CHANNEL.split(","))
|
||||||
|
|
||||||
|
if var.LOG_CHANNEL:
|
||||||
|
channels.add(var.LOG_CHANNEL.lstrip("".join(var.STATUSMSG_PREFIXES)))
|
||||||
|
|
||||||
cli.join(",".join(channels))
|
cli.join(",".join(channels))
|
||||||
|
|
||||||
if var.CHANSERV_OP_COMMAND:
|
if var.CHANSERV_OP_COMMAND:
|
||||||
|
@ -197,6 +197,8 @@ NICKSERV_REGAIN_COMMAND = "REGAIN {nick}"
|
|||||||
CHANSERV = "ChanServ"
|
CHANSERV = "ChanServ"
|
||||||
CHANSERV_OP_COMMAND = "OP {channel}"
|
CHANSERV_OP_COMMAND = "OP {channel}"
|
||||||
|
|
||||||
|
LOG_CHANNEL = "" # Log !fwarns to this channel, if set
|
||||||
|
|
||||||
# TODO: move this to a game mode called "fixed" once we implement a way to randomize roles (and have that game mode be called "random")
|
# TODO: move this to a game mode called "fixed" once we implement a way to randomize roles (and have that game mode be called "random")
|
||||||
DEFAULT_ROLE = "villager"
|
DEFAULT_ROLE = "villager"
|
||||||
ROLE_INDEX = ( 4 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 15 , 16 , 18 , 20 , 21 , 23 , 24 )
|
ROLE_INDEX = ( 4 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 15 , 16 , 18 , 20 , 21 , 23 , 24 )
|
||||||
|
@ -671,6 +671,10 @@ def fwarn(cli, nick, chan, rest):
|
|||||||
acc, hm = parse_warning_target(nick)
|
acc, hm = parse_warning_target(nick)
|
||||||
db.del_warning(warn_id, acc, hm)
|
db.del_warning(warn_id, acc, hm)
|
||||||
reply(cli, nick, chan, messages["fwarn_done"])
|
reply(cli, nick, chan, messages["fwarn_done"])
|
||||||
|
|
||||||
|
if var.LOG_CHANNEL:
|
||||||
|
cli.msg(var.LOG_CHANNEL, messages["fwarn_log_del"].format(warn_id, hm, acc, nick))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if command == "set":
|
if command == "set":
|
||||||
@ -749,6 +753,24 @@ def fwarn(cli, nick, chan, rest):
|
|||||||
|
|
||||||
db.set_warning(warn_id, expires, reason, notes)
|
db.set_warning(warn_id, expires, reason, notes)
|
||||||
reply(cli, nick, chan, messages["fwarn_done"])
|
reply(cli, nick, chan, messages["fwarn_done"])
|
||||||
|
|
||||||
|
if var.LOG_CHANNEL:
|
||||||
|
changes = []
|
||||||
|
if expires != warning["expires"]:
|
||||||
|
oldexpiry = warning["expires"] if warning["expires"] else messages["fwarn_log_set_noexpiry"]
|
||||||
|
newexpiry = expires if expires else messages["fwarn_log_set_noexpiry"]
|
||||||
|
changes.append(messages["fwarn_log_set_expiry"].format(oldexpiry, newexpiry))
|
||||||
|
if reason != warning["reason"]:
|
||||||
|
changes.append(messages["fwarn_log_set_reason"].format(warning["reason"], reason))
|
||||||
|
if notes != warning["notes"]:
|
||||||
|
if warning["notes"]:
|
||||||
|
changes.append(messages["fwarn_log_set_notes"].format(warning["notes"], notes))
|
||||||
|
else:
|
||||||
|
changes.append(messages["fwarn_log_set_notes_new"].format(notes))
|
||||||
|
if changes:
|
||||||
|
log_msg = messages["fwarn_log_set"].format(warn_id, warning["target"], nick, " | ".join(changes))
|
||||||
|
cli.msg(var.LOG_CHANNEL, log_msg)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# command == "add"
|
# command == "add"
|
||||||
@ -859,6 +881,18 @@ def fwarn(cli, nick, chan, rest):
|
|||||||
reply(cli, nick, chan, messages["fwarn_cannot_add"])
|
reply(cli, nick, chan, messages["fwarn_cannot_add"])
|
||||||
else:
|
else:
|
||||||
reply(cli, nick, chan, messages["fwarn_added"].format(warn_id))
|
reply(cli, nick, chan, messages["fwarn_added"].format(warn_id))
|
||||||
|
# Log to ops/log channel (even if the warning was placed in that channel)
|
||||||
|
if var.LOG_CHANNEL:
|
||||||
|
log_reason = reason
|
||||||
|
if notes is not None:
|
||||||
|
log_reason += " ({0})".format(notes)
|
||||||
|
if expires is None:
|
||||||
|
log_length = messages["fwarn_log_add_noexpiry"]
|
||||||
|
else:
|
||||||
|
log_length = messages["fwarn_log_add_expiry"].format(expires)
|
||||||
|
log_msg = messages["fwarn_log_add"].format(warn_id, target, nick, log_reason, points,
|
||||||
|
"" if points == 1 else "s", log_length)
|
||||||
|
cli.msg(var.LOG_CHANNEL, log_msg)
|
||||||
|
|
||||||
|
|
||||||
# vim: set sw=4 expandtab:
|
# vim: set sw=4 expandtab:
|
||||||
|
Loading…
Reference in New Issue
Block a user