Created
December 24, 2013 03:09
-
-
Save antonva/8108297 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import weechat as w | |
import re | |
# Registstration variables. | |
SCRIPT_NAME = "greentext" | |
SCRIPT_AUTHOR = "Anton Vilhelm Asgeirsson <anton@antonvilhelm.is>" | |
SCRIPT_VERSION = "0.0.1" | |
SCRIPT_LICENSE = "MULTIPASS" | |
SCRIPT_DESC = "Change messages starting with '>' to green text." | |
# Registration function. | |
w.register( | |
SCRIPT_NAME, | |
SCRIPT_AUTHOR, | |
SCRIPT_VERSION, | |
SCRIPT_LICENSE, | |
SCRIPT_DESC, | |
"","" | |
) | |
def greentext_cb(data, modifier, modifier_data, string): | |
try: | |
nick, msg = string.split('\t') | |
except ValueError, e: | |
return string | |
if msg[0] == '>': | |
return "%s\t%s%s" % (nick, w.color('green'), msg) | |
else: | |
return string | |
w.prnt("", "%s>Implying that greentext has loaded." % w.color('green')) | |
w.hook_modifier("weechat_print", "greentext_cb", "") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment