Skip to content

Instantly share code, notes, and snippets.

@ashafq
Last active June 30, 2017 12:49
Show Gist options
  • Save ashafq/c87cbb6e343f4d0782f417251c0f2a09 to your computer and use it in GitHub Desktop.
Save ashafq/c87cbb6e343f4d0782f417251c0f2a09 to your computer and use it in GitHub Desktop.
1337 §p€@k
__module_name__ = "Hexchat L33T"
__module_version__ = "1.0"
__module_description__ = "Do you speak l33t? No? Well, now you can with /l33t"
__author__ = "ashafq"
import hexchat
import random
def l33t_enc(string):
"""Convert english to l33t.
Some portions of the code is copied from @bussiere's Gist. This is
a simplified version of his l33t translator. See:
>>> git clone [email protected]:648691.git
"""
alphabet = str.maketrans("abcdefghijklmnopqrstuvwxyz",
"@ߢd€ƒ6#!ʝk1mn0pqЯ§7µvɰ×¥z")
vocabulary = {
"crazy": ["m4d"],
"dude": ["d00d"],
"fear": ["ph33r", "ph34r"],
"fool": ["f00"],
"hacker": ["h4x0r"],
"hackers": ["h4x0r"],
"hoot": ["w00t"],
"idiot": ["f00"],
"item": ["13wt"],
"lamer": ["l4m3r"],
"lol": ["lulz", "lawl", "L0L", "LUAL"],
"loot": ["13wt"],
"mad": ["m4d"],
"noob": ["n00b"],
"owned": ["0wn3d"],
"pal": ["d00d"],
"pawn": ["pwn'd", "pwnt"],
"pawned": ["pwn'd", "pwnt"],
"pawns": ["pwn'd", "pwnt"],
"powned": ["pwn'd", "pwnt"],
"pwned": ["pwn'd", "pwnt"],
"skill": ["sk1llz"],
"skills": ["sk1llz"],
"suck": ["sux0r"],
"sucks": ["sux0r"],
"treasure": ["13wt"],
"woot": ["w00t"],
"yo": ["j0"],
"you": ["j00"]
}
str_return = ""
for word in string.split(" "):
word = word.lower()
if word in vocabulary.keys():
str_return += random.choice(vocabulary[word]) + " "
else:
str_return += word.lower().translate(alphabet) + " "
return str_return.strip()
def l33tplugin(word, word_eol, userdata):
"""L33t plugin"""
hexchat.emit_print("Channel Message", hexchat.get_info("nick"),
l33t_enc(word_eol[1]))
return hexchat.EAT_ALL
def main():
"""Main magic"""
full_name = "{} v{} by {}".format(
__module_name__, __module_version__, __author__)
help_hook = "\"/l33t msg\" translate your message into l33t-sp34k"
hexchat.hook_command("l33t", l33tplugin, help=help_hook)
hexchat.prnt(full_name + " loaded.")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment