]> jfr.im git - irc/weechat/scripts.git/commitdiff
Add new script rainbow.py (for v0.2.6)
authorSebastien Helleu <redacted>
Wed, 19 Aug 2009 12:13:40 +0000 (14:13 +0200)
committerSebastien Helleu <redacted>
Wed, 19 Aug 2009 12:13:40 +0000 (14:13 +0200)
python/rainbow.py [new file with mode: 0644]

diff --git a/python/rainbow.py b/python/rainbow.py
new file mode 100644 (file)
index 0000000..fe435d2
--- /dev/null
@@ -0,0 +1,26 @@
+#Author: Martin Pugh
+#Contact: mpugh89@gmail.com
+#Usage: /rainbow some text here
+#Displays text in rainbow colours
+#License: WTFPL v2
+
+import weechat
+weechat.register('rainbow', '0.5', '', """Print rainbow-colored text. Usage: /rainbow""")
+weechat.add_command_handler("rainbow", "rainbow", "print rainbow text")
+
+def rainbow(server, args):
+       colors=["9","11","12","13","4"]
+       out = ""
+       ci = 0
+       if args != "":
+               for i in range(0,len(args)):
+                       out += '\x03' + colors[ci] + '\x02' + args[i]
+                       if ci == len(colors)-1:
+                               ci = 0
+                       else:
+                               ci += 1
+               outcommand = '/say ' + out
+               weechat.command(outcommand)
+       else:
+               weechat.prnt("rainbow: no text to output")
+       return weechat.PLUGIN_RC_OK