Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __module_name__ = "beespoiler"
- __module_version__ = "0.1"
- __module_description__ = "conceal your text in a stylish bee-inspired pattern"
- # Name: Beespoiler
- # Authors: ed <irc.rizon.net>
- # Purpose: BEEEEEES
- import re # RegEx, language for extracting and replacing text
- import xchat # opens the portal for interacting with xchat
- syntax = re.compile(r'\x0F\x0F([^\x0F]*)') # beespoiler syntax (defined with regex)
- def bsp_re(m): # eats text, spits out BLACK'n YELLO'
- spoiler = "" # prepare the spoiler that we'll make
- text = m.group(0) # get the text extracted by regex
- for position in range(0, len(text)): # spoiler the letters one at a time
- color = 1 if position%2 else 8 # choose irc colour 8 for even positions, 1 for odd
- spoiler += '{0}0{1},0{2}{3}'.format( # add all the ingredients of a single letter:
- "\x03", # ...the colour control code (^C)
- color, # ...the first colour
- color, # ...the second colour
- text[position]) # ...the letter!
- return spoiler
- def bsp_cb(word, word_eol, userdata): # SOMEONE used the /BS command!
- text = word_eol[1] # get the text after the BS command itself
- text = syntax.sub(bsp_re, text) # let bs_re have each of the spoilers and pimp them
- xchat.command('SAY {0}'.format(text)) # send the spoilered text to the current channel
- return xchat.EAT_ALL # hexchat wants this for some reason, :idk:
- xchat.hook_command("BSP", bsp_cb, help="/BSP some ^O^Ospoiler^O text") # Beeeees SPoiler made into a command
Advertisement
Add Comment
Please, Sign In to add comment