-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhuify.lua
More file actions
33 lines (24 loc) · 1 KB
/
huify.lua
File metadata and controls
33 lines (24 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--[[
Huify
Модуль который хуефицирует текст, заменяя первые три буквы каждого слова
by https://t.me/aye_ya, https://t.me/Svatosh, https://t.me/wavecat
--]]
require "iutf8"
local pattern = luajava.bindClass("java.util.regex.Pattern"):compile("([еуаоэяию])")
local replacements = { "хуе", "хуи", "хую", "хуя" }
local function huify(input, query)
local result = ""
for word in string.gmatch(query:replaceExpression(""), "(%S+)") do
if utf8.len(word) > 4 then
local matcher = pattern:matcher(utf8.sub(word, 2, 3))
local replacement = matcher:find() and math.random(1, 2) or math.random(3, 4)
result = result .. replacements[replacement] .. utf8.sub(word, 3, utf8.len(word)) .. " "
else
result = result .. word .. " "
end
end
inline:setText(input, result)
end
return function(module)
module:registerCommand("huify", huify, "Makes text dick-like")
end