From 3c851391414109782308cdce1a6167e23021a2f7 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Thu, 28 Mar 2024 20:45:37 +0100 Subject: [PATCH] added english and hello message --- conversacional.go | 22 ++++++++++++++++++++-- telegram.go | 6 +++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/conversacional.go b/conversacional.go index 4708131..c9e55c4 100644 --- a/conversacional.go +++ b/conversacional.go @@ -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 } diff --git a/telegram.go b/telegram.go index 106eea9..c1fffd6 100644 --- a/telegram.go +++ b/telegram.go @@ -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. 🤣") } -- 2.30.2