test
This commit is contained in:
parent
65b22a2975
commit
b5cbf333bd
@ -34,3 +34,4 @@ sopel.plugins =
|
||||
spicebot_command_upper = spicebot_command_upper
|
||||
spicebot_command_echo = spicebot_command_echo
|
||||
spicebot_command_spongemock = spicebot_command_spongemock
|
||||
spicebot_command_leetspeak = spicebot_command_leetspeak
|
||||
|
||||
54
spicebot_command_leetspeak/__init__.py
Normal file
54
spicebot_command_leetspeak/__init__.py
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
import random
|
||||
|
||||
from sopel import plugin
|
||||
|
||||
from sopel_SpiceBot_Core_Prerun import prerun
|
||||
|
||||
|
||||
@prerun()
|
||||
@plugin.command('spongemock', 'smock')
|
||||
def upper(bot, trigger, comrun):
|
||||
comrun.say(leet_convert(comrun.command["trigger_str"]))
|
||||
|
||||
|
||||
def leet_convert(message):
|
||||
message = message.strip()
|
||||
|
||||
char_map = {
|
||||
"a": ["4", "@", "/-\\", "^"],
|
||||
"b": ["I3", "8", "13", "|3"],
|
||||
"c": ["[", "{", "<", "("],
|
||||
"d": [")", "|)", "[)", "|>"],
|
||||
"e": ["3", "[-"],
|
||||
"f": ["|=", "ph", "|#", "/="],
|
||||
"g": ["&", "6", "(_+]", "9", "C-", "gee"],
|
||||
"h": ["#", "/-/", "[-]", "]-[", ")-(", "(-)", ":-:", "|-|", "}{"],
|
||||
"i": ["1", "[]", "!", "|", "eye", "3y3", "]["],
|
||||
"j": [",_|", "_|", "._|", "._]", ",_]", "]"],
|
||||
"k": [">|", "|<", "/<", "1<", "|c", "|(", "|{"],
|
||||
"l": ["1", "7", "|_", "|"],
|
||||
"m": ["/\\/\\", "/V\\", "JVI", "[V]", "[]V[]", "|\\/|", "^^"],
|
||||
"n": ["^/", "|\\|", "/\\/", "[\]", "<\\>", "{\\}", "|V", "/V"],
|
||||
"o": ["0", "Q", "()", "oh", "[]"],
|
||||
"p": ["|*", "|o", "?", "|^", "[]D"],
|
||||
"q": ["(_,)", "()_", "2", "O_"],
|
||||
"r": ["12", "|`", "|~", "|?", "/2", "|^", "Iz", "|9"],
|
||||
"s": ["$", "5", "z", "ehs", "es"],
|
||||
"t": ["7", "+", "-|-", "']['", '"|"', "~|~"],
|
||||
"u": ["|_|", "(_)", "V", "L|"],
|
||||
"v": ["\\/", "|/", "\\|"],
|
||||
"w": ["\\/\\/", "VV", "\\N", "'//", "\\\\'", "\\^/", "\\X/"],
|
||||
"x": ["><", ">|<", "}{", "ecks"],
|
||||
"y": ["j", "`/", "\\|/", "\\//"],
|
||||
"z": ["2", "7_", "-/_", "%", ">_", "~/_", "-\_", "-|_"],
|
||||
}
|
||||
leetspeak = ""
|
||||
for char in message:
|
||||
if char.lower() in char_map and random.random() <= 0.70: # 70% convert
|
||||
possible_replacements = char_map[char.lower()]
|
||||
leet_replacement = random.choice(possible_replacements)
|
||||
leetspeak = leetspeak + leet_replacement
|
||||
else:
|
||||
leetspeak = leetspeak + char
|
||||
return leetspeak
|
||||
Loading…
Reference in New Issue
Block a user