revamped uwuifying - again

This commit is contained in:
echo 2022-11-25 12:06:38 +03:30
parent 849bb1286f
commit bad3d458a3

View file

@ -32,6 +32,12 @@ var color_map = map[string]string{
"*": "37", "*": "37",
} }
var namechanges = map[string]string{
"linux": "linuwu",
"arch": "nyarch",
"ubuntu": "uwuntu",
}
var logoIndex = 0 var logoIndex = 0
var isInProgressLine = false var isInProgressLine = false
var logoLines []string var logoLines []string
@ -123,43 +129,26 @@ func printLogoIfAtBeginningOfNewLine() {
func uwuify(message string) string { func uwuify(message string) string {
sentence := strings.Split(message, " ") sentence := strings.Split(message, " ")
ret := "" ret := ""
uwuified := false
for i, word := range sentence { for i, word := range sentence {
word = strings.ToLower(word)
ret = strings.ToLower(ret) if namechanges[word] != "" {
if len(word) < 4 { word = namechanges[word]
ret += word
continue
}
if !strings.Contains(word, "uwu") && strings.Contains(word, "u") {
word = strings.ReplaceAll(word, "u", "UwU")
uwuified = true
}
if !strings.Contains(word, "owo") && strings.Contains(word, "o") {
word = strings.ReplaceAll(word, "o", "OwO")
uwuified = true
}
if strings.HasSuffix(word, "y") {
word = word + " " + "w" + word[:len(word)-1]
uwuified = true
}
if uwuified {
ret += word
if i != 0 { if i != 0 {
ret += " " ret += " "
} }
ret += word
continue continue
} }
if !strings.HasSuffix("n", word) { if len(word) > 5 {
word = strings.ReplaceAll(word, "n", "ny") if !strings.Contains(word, "owo") {
word = strings.ReplaceAll(word, "o", "OwO")
} else if !strings.Contains(word, "uwu") {
word = strings.ReplaceAll(word, "u", "UwU")
}
word = strings.ReplaceAll(strings.ReplaceAll(word, "r", "w"), "l", "w")
} }
word = strings.ReplaceAll(strings.ReplaceAll(word, "l", "w"), "r", "w")
if i != 0 { if i != 0 {
ret += " " ret += " "