Browse Source

[tgbot] fix client search

MHSanaei 1 year ago
parent
commit
bbec13c0da
1 changed files with 7 additions and 3 deletions
  1. 7 3
      web/service/tgbot.go

+ 7 - 3
web/service/tgbot.go

@@ -128,10 +128,14 @@ func (t *Tgbot) answerCommand(message *tgbotapi.Message, chatId int64, isAdmin b
 	case "status":
 		msg = "bot is ok ✅"
 	case "usage":
-		if isAdmin {
-			t.searchClient(chatId, message.CommandArguments())
+		if len(message.CommandArguments()) > 1 {
+			if isAdmin {
+				t.searchClient(chatId, message.CommandArguments())
+			} else {
+				t.searchForClient(chatId, message.CommandArguments())
+			}
 		} else {
-			t.searchForClient(chatId, message.CommandArguments())
+			msg = "❗Please provide a text for search!"
 		}
 	default:
 		msg = "❗ Unknown command"