added english and hello message
authorEduardo <[email protected]>
Thu, 28 Mar 2024 19:45:37 +0000 (20:45 +0100)
committerEduardo <[email protected]>
Thu, 28 Mar 2024 19:45:37 +0000 (20:45 +0100)
conversacional.go
telegram.go

index 4708131abff19df64a2d01eb692492b9ad3407aa..c9e55c4c0c68d878b5063b898922cd24c3f2406a 100644 (file)
@@ -5,7 +5,7 @@ import (
 )
 
 func onlineOnRoles(s string) bool {
-       if !strings.Contains(s, "quien") {
+       if !strings.Contains(s, "quien") && !strings.Contains(s, "who") && !strings.Contains(s, "whos") {
                return false
        }
 
@@ -13,7 +13,25 @@ func onlineOnRoles(s string) bool {
                return false
        }
 
-       if !strings.Contains(s, "online") && !strings.Contains(s, "linea") && !strings.Contains(s, "esta") {
+       if !strings.Contains(s, "online") && !strings.Contains(s, "linea") && !strings.Contains(s, "esta") && !strings.Contains(s, "on") {
+               return false
+       }
+
+       return true
+}
+
+func saludo(s string) bool {
+       if !strings.Contains(s, "hola") &&
+               !strings.Contains(s, "hi") &&
+               !strings.Contains(s, "hello") &&
+               !strings.Contains(s, "hey") &&
+               !strings.Contains(s, "ola") &&
+               !strings.Contains(s, "saludos") &&
+               !strings.Contains(s, "salu2") &&
+               !strings.Contains(s, "salu3") &&
+               !strings.Contains(s, "owa") &&
+               !strings.Contains(s, "owi") &&
+               !strings.Contains(s, "owiwi") {
                return false
        }
 
index 106eea95accb20dd34ae234ddab414452c765bcd..c1fffd6cd5ff02a25a9f9e53077111ef56d5997a 100644 (file)
@@ -142,9 +142,6 @@ func handleConversation(chatId int64, text string) error {
        switch {
        case onlineOnRoles(text):
                err = sendMenu(chatId)
-       case text == "hola",
-               text == "hola sylph":
-               err = sendTelegramMessage(chatId, "Hola!")
 
        case regexIssue.MatchString(text):
                err = manageIssueMessage(chatId, text)
@@ -152,6 +149,9 @@ func handleConversation(chatId int64, text string) error {
        case regexRequest.MatchString(text):
                err = manageSerieRequest(chatId, text)
 
+       case saludo(text):
+               err = sendTelegramMessage(chatId, "Hola!")
+
        default:
                err = sendTelegramMessage(chatId, "Jej. No entiendi. ðŸ¤£")
        }