From 0be8f3f23b8ed2fb295315b60609146564e9ca27 Mon Sep 17 00:00:00 2001 From: echo <91651232+exhq@users.noreply.github.com> Date: Thu, 24 Nov 2022 11:49:31 +0330 Subject: [PATCH] based uwuifier so true brotha on god --- utils/printing.go | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/utils/printing.go b/utils/printing.go index 57e8d3c..7390ed8 100644 --- a/utils/printing.go +++ b/utils/printing.go @@ -123,16 +123,44 @@ func printLogoIfAtBeginningOfNewLine() { func uwuify(message string) string { sentence := strings.Split(message, " ") ret := "" + uwuified := false for i, word := range sentence { - if !strings.Contains(strings.ToLower(word), "uwu") { - word = strings.ReplaceAll(word, "u", "UwU") - - if !strings.Contains(strings.ToLower(word), "owo") { - word = strings.ReplaceAll(word, "o", "OwO") - } - word = strings.ReplaceAll(word, "r", "w") + ret = strings.ToLower(ret) + if len(word) < 4 { + 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 { + ret += " " + } + continue + } + + if !strings.HasSuffix("n", word) { + word = strings.ReplaceAll(word, "n", "ny") + } + + word = strings.ReplaceAll(strings.ReplaceAll(word, "l", "w"), "r", "w") + if i != 0 { ret += " " }