Improvements to !rules
* RULES is now not defined in settings.py, only in botconfig.py. * If there are no rules specified, a default message is shown instructing users to configure it. * The "#CHANNEL channel rules: " prefix is now automatically prepended (skipped if the string already contains that, for backwards-compatibility). * The prefix and the no-rules message can be customized as they are in messages.py now.
This commit is contained in:
parent
629fe51fd7
commit
2c3aafc101
@ -24,7 +24,7 @@ SERVER_PASS = "{account}:{password}"
|
|||||||
OWNERS = ("unaffiliated/wolfbot_admin1",) # The comma is required at the end if there is only one owner.
|
OWNERS = ("unaffiliated/wolfbot_admin1",) # The comma is required at the end if there is only one owner.
|
||||||
OWNERS_ACCOUNTS = ("1owner_acc",)
|
OWNERS_ACCOUNTS = ("1owner_acc",)
|
||||||
|
|
||||||
#RULES = "{0} channel rules: https://werewolf.chat/Freenode:Rules".format(botconfig.CHANNEL)
|
#RULES = "https://werewolf.chat/Freenode:Rules"
|
||||||
|
|
||||||
ALLOWED_NORMAL_MODE_COMMANDS = [] # Debug mode commands to be allowed in normal mode
|
ALLOWED_NORMAL_MODE_COMMANDS = [] # Debug mode commands to be allowed in normal mode
|
||||||
OWNERS_ONLY_COMMANDS = [] # Commands that should only be allowed for owners, regardless of their original permissions
|
OWNERS_ONLY_COMMANDS = [] # Commands that should only be allowed for owners, regardless of their original permissions
|
||||||
|
@ -864,6 +864,8 @@
|
|||||||
"tempban_kick": "Temporary ban for warning: {reason}",
|
"tempban_kick": "Temporary ban for warning: {reason}",
|
||||||
"error_log": "An error has occurred and has been logged.",
|
"error_log": "An error has occurred and has been logged.",
|
||||||
"error_pastebin": "(Unable to pastebin traceback; please check the console)",
|
"error_pastebin": "(Unable to pastebin traceback; please check the console)",
|
||||||
|
"channel_rules": "{0} channel rules: {1}",
|
||||||
|
"no_channel_rules": "No rules are defined for {0}. Set RULES in botconfig.py to configure this.",
|
||||||
|
|
||||||
"_": " vim: set sw=4 expandtab:"
|
"_": " vim: set sw=4 expandtab:"
|
||||||
}
|
}
|
||||||
|
@ -320,8 +320,6 @@ FORTUNE_CHANCE = 1/25
|
|||||||
|
|
||||||
ALL_FLAGS = frozenset("AaDdFjms")
|
ALL_FLAGS = frozenset("AaDdFjms")
|
||||||
|
|
||||||
RULES = "To configure this command, the bot administrator should uncomment and modify RULES in botconfig.py."
|
|
||||||
|
|
||||||
GRAVEYARD_LOCK = threading.RLock()
|
GRAVEYARD_LOCK = threading.RLock()
|
||||||
WARNING_LOCK = threading.RLock()
|
WARNING_LOCK = threading.RLock()
|
||||||
WAIT_TB_LOCK = threading.RLock()
|
WAIT_TB_LOCK = threading.RLock()
|
||||||
|
@ -6550,11 +6550,22 @@ def reset_game(cli, nick, chan, rest):
|
|||||||
reset()
|
reset()
|
||||||
cli.msg(botconfig.CHANNEL, "PING! {0}".format(" ".join(pl)))
|
cli.msg(botconfig.CHANNEL, "PING! {0}".format(" ".join(pl)))
|
||||||
|
|
||||||
|
|
||||||
@cmd("rules", pm=True)
|
@cmd("rules", pm=True)
|
||||||
def show_rules(cli, nick, chan, rest):
|
def show_rules(cli, nick, chan, rest):
|
||||||
"""Displays the rules."""
|
"""Displays the rules."""
|
||||||
reply(cli, nick, chan, var.RULES)
|
|
||||||
|
if hasattr(botconfig, "RULES"):
|
||||||
|
rules = botconfig.RULES
|
||||||
|
|
||||||
|
# Backwards-compatibility
|
||||||
|
pattern = re.compile(r"^\S+ channel rules: ")
|
||||||
|
|
||||||
|
if pattern.search(rules):
|
||||||
|
rules = pattern.sub("", rules)
|
||||||
|
|
||||||
|
reply(cli, nick, chan, messages["channel_rules"].format(botconfig.CHANNEL, rules))
|
||||||
|
else:
|
||||||
|
reply(cli, nick, chan, messages["no_channel_rules"].format(botconfig.CHANNEL))
|
||||||
|
|
||||||
@cmd("help", raw_nick=True, pm=True)
|
@cmd("help", raw_nick=True, pm=True)
|
||||||
def get_help(cli, rnick, chan, rest):
|
def get_help(cli, rnick, chan, rest):
|
||||||
|
Loading…
Reference in New Issue
Block a user