test
This commit is contained in:
parent
bacf4f22a5
commit
e3f6c6e369
@ -15,6 +15,9 @@ def leatspeak(bot, trigger, comrun):
|
|||||||
def leet_convert(message):
|
def leet_convert(message):
|
||||||
message = message.strip()
|
message = message.strip()
|
||||||
|
|
||||||
|
replacements = (('hacker', 'haxor'), ('elite', 'eleet'), ('a', '4'), ('e', '3'),
|
||||||
|
('l', '1'), ('o', '0'), ('t', '+'))
|
||||||
|
|
||||||
char_map = {
|
char_map = {
|
||||||
"a": ["4", "@", "/-\\", "^"],
|
"a": ["4", "@", "/-\\", "^"],
|
||||||
"b": ["I3", "8", "13", "|3"],
|
"b": ["I3", "8", "13", "|3"],
|
||||||
@ -44,11 +47,18 @@ def leet_convert(message):
|
|||||||
"z": ["2", "7_", "-/_", "%", ">_", "~/_", "-\_", "-|_"],
|
"z": ["2", "7_", "-/_", "%", ">_", "~/_", "-\_", "-|_"],
|
||||||
}
|
}
|
||||||
leetspeak = ""
|
leetspeak = ""
|
||||||
for char in message:
|
|
||||||
|
for word in message.split(" "):
|
||||||
|
if word.lower() in [old for old, new in replacements]:
|
||||||
|
leet_word = word.replace([old for old, new in replacements][0], [new for old, new in replacements][0])
|
||||||
|
leetspeak = leetspeak + leet_word
|
||||||
|
else:
|
||||||
|
for char in word:
|
||||||
if char.lower() in char_map and random.random() <= 0.70: # 70% convert
|
if char.lower() in char_map and random.random() <= 0.70: # 70% convert
|
||||||
possible_replacements = char_map[char.lower()]
|
possible_replacements = char_map[char.lower()]
|
||||||
leet_replacement = random.choice(possible_replacements)
|
leet_replacement = random.choice(possible_replacements)
|
||||||
leetspeak = leetspeak + leet_replacement
|
leetspeak = leetspeak + leet_replacement
|
||||||
else:
|
else:
|
||||||
leetspeak = leetspeak + char
|
leetspeak = leetspeak + char
|
||||||
|
|
||||||
return leetspeak
|
return leetspeak
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user