diff options
| author | 2016-04-14 16:48:44 +0100 | |
|---|---|---|
| committer | 2016-04-14 16:48:44 +0100 | |
| commit | 9c5f0d603596f9264ebee17660f3b1ed1430cb34 (patch) | |
| tree | 5915715b39935b2cf65289b96dec63e02751e3ec | |
| parent | added helper functions to IRCBot to utilise the new bot settings table. (diff) | |
added command-prefix to channel settings.
| -rw-r--r-- | modules/commands.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/commands.py b/modules/commands.py index 14713c2e..5e0456f5 100644 --- a/modules/commands.py +++ b/modules/commands.py @@ -53,10 +53,16 @@ class Module(object): usage="<command>") bot.events.on("received").on("command").on("more").hook(self.more, help="Get more output from the last command") + bot.events.on("boot").on("done").hook(self.boot_done) bot.events.on("new").on("user", "channel").hook(self.new) bot.events.on("send").on("stdout").hook(self.send_stdout) bot.events.on("send").on("stderr").hook(self.send_stderr) + def boot_done(self, event): + self.bot.events.on("postboot").on("configure").on( + "channelset").call(setting="command-prefix", + help="Set the command prefix used in this channel") + def new(self, event): if "user" in event: target = event["user"] @@ -130,8 +136,8 @@ class Module(object): def channel_message(self, event): - command_prefix = event["channel"].get_setting("command_prefix", - event["server"].get_setting("command_prefix", "!")) + command_prefix = event["channel"].get_setting("command-prefix", + event["server"].get_setting("command-prefix", "!")) if event["message_split"][0].startswith(command_prefix): command = event["message_split"][0].replace( command_prefix, "", 1).lower() @@ -193,4 +199,3 @@ class Module(object): stderr.write(event["message"]).send() if stderr.has_text(): event["target"].last_stderr = stderr - |
