From 5be3dbe77158efd53008c6b8933fae4a49630227 Mon Sep 17 00:00:00 2001 From: Arash Taher Date: Sun, 12 Jan 2025 20:49:41 +0100 Subject: [PATCH] Helper message for commands Check for the command with no parameter: Telegram UI suggests commands, and by clicking on them the command is sent to the bot. For start and search commands, this will lead to an unwanted memo --- memogram.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/memogram.go b/memogram.go index b3d9c0d..0397010 100644 --- a/memogram.go +++ b/memogram.go @@ -148,7 +148,19 @@ func (s *Service) handler(ctx context.Context, b *bot.Bot, m *models.Update) { return } message := m.Message - if strings.HasPrefix(message.Text, "/start ") { + if strings.EqualFold(message.Text, "/start") { + b.SendMessage(ctx, &bot.SendMessageParams{ + ChatID: message.Chat.ID, + Text: "Please provide the access token: /start ", + }) + return + } else if strings.EqualFold(message.Text, "/search") { + b.SendMessage(ctx, &bot.SendMessageParams{ + ChatID: message.Chat.ID, + Text: "Usage: /search ", + }) + return + } else if strings.HasPrefix(message.Text, "/start ") { s.startHandler(ctx, b, m) return } else if strings.HasPrefix(message.Text, "/search ") {