2013-11-09 09:22:51 -08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
"""
|
|
|
|
rainbow.py - Rainbows
|
|
|
|
Copyright 2013, sfan5
|
|
|
|
"""
|
|
|
|
import random
|
|
|
|
|
|
|
|
def colorize(text):
|
|
|
|
out = ""
|
|
|
|
for c in text:
|
2013-11-09 11:53:47 -08:00
|
|
|
if c in list(str(i) for i in range(10)):
|
|
|
|
c = u"\u200b" + c # 'ZERO WIDTH SPACE' cuz IRC clients are stupid
|
2013-11-09 09:28:35 -08:00
|
|
|
out += "\x03" + str(random.randint(2, 15)) + c
|
2013-11-09 09:22:51 -08:00
|
|
|
return out
|
|
|
|
|
|
|
|
def rainbow(phenny, input):
|
|
|
|
for x in phenny.bot.commands["high"].values():
|
|
|
|
if x[0].__name__ == "aa_hook":
|
|
|
|
if x[0](phenny, input):
|
|
|
|
return # Abort function
|
|
|
|
arg = input.group(2)
|
|
|
|
if not arg:
|
2013-11-09 11:53:47 -08:00
|
|
|
return phenny.say(colorize("Rainbow") + "\x03 What?")
|
2013-11-09 09:22:51 -08:00
|
|
|
phenny.say(colorize(arg))
|
|
|
|
|
|
|
|
rainbow.commands = ['rainbow']
|