diff options
author | jomo <github@jomo.tv> | 2014-07-27 19:49:55 +0200 |
---|---|---|
committer | jomo <github@jomo.tv> | 2014-07-27 19:49:55 +0200 |
commit | f9d1d8a83ce67bed6e401e294ae09dcbdf412680 (patch) | |
tree | 0b18af7ddef597684e5bf9c153eb6df9ba07b99a /mentio.py | |
parent | 9231d23bcb87a492f2cbdb8c6342fec72c54beee (diff) |
mentio readability, remove <> around mention highlight
Diffstat (limited to 'mentio.py')
-rw-r--r-- | mentio.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -6,7 +6,7 @@ from traceback import format_exc as print_traceback mentions = open_json_file("mentio", {}) max_amount = 3 arrow = colorify(u"&r&7\u2192&r") -regex = reg_compile(u"\u00A7[\\da-fk-or]") +colors_reg = reg_compile(u"\u00A7[\\da-fk-or]") @hook.event("player.AsyncPlayerChatEvent", "high") @@ -31,8 +31,10 @@ def onChat(event): isMentioned = True if isMentioned: - colors = "".join(regex.findall("".join(words[:i+1]))) # join all color codes used upto this word - rec_words[i] = colorify("&r&a<&6") + stripcolors(word) + colorify("&r&a>&r") + colors # extra fancy highlight + # join all color codes used upto this word + colors = "".join(colors_reg.findall("".join(words[:i+1]))) + # highlight word containing mention, then apply all previous color codes + rec_words[i] = colorify("&r&a&n") + stripcolors(word) + colorify("&r") + colors # player was mentioned if rec_words != words: |