added command-prefix to channel settings.

This commit is contained in:
jesopo 2016-04-14 16:48:44 +01:00
parent 98718546cf
commit 9c5f0d6035
No known key found for this signature in database
GPG key ID: 0BBDEB2AEFCFFCB3

View file

@ -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