update rainbow.py to use command spec
This commit is contained in:
parent
d0c5fc097c
commit
d2d774a644
1 changed files with 2 additions and 7 deletions
|
@ -21,18 +21,13 @@ COLORS = [
|
||||||
class Module(ModuleManager.BaseModule):
|
class Module(ModuleManager.BaseModule):
|
||||||
@utils.hook("received.command.rainbow")
|
@utils.hook("received.command.rainbow")
|
||||||
@utils.kwarg("help", "Rainbowify a given string or the last message")
|
@utils.kwarg("help", "Rainbowify a given string or the last message")
|
||||||
@utils.kwarg("usage", "[string]")
|
@utils.spec("!<string>lstring")
|
||||||
def rainbow(self, event):
|
def rainbow(self, event):
|
||||||
if event["is_channel"] and not event["target"].get_setting(
|
if event["is_channel"] and not event["target"].get_setting(
|
||||||
"rainbow", False):
|
"rainbow", False):
|
||||||
return
|
return
|
||||||
|
|
||||||
args = event["args"]
|
args = utils.irc.strip_font(event["spec"][0])
|
||||||
if not args:
|
|
||||||
args = event["target"].buffer.get()
|
|
||||||
if not args:
|
|
||||||
raise utils.EventError("No line found to rainbowify")
|
|
||||||
args = utils.irc.strip_font(args)
|
|
||||||
|
|
||||||
offset = random.randint(0, len(COLORS))
|
offset = random.randint(0, len(COLORS))
|
||||||
out = ""
|
out = ""
|
||||||
|
|
Loading…
Reference in a new issue