aboutsummaryrefslogtreecommitdiff
path: root/telegram_bot.go
diff options
context:
space:
mode:
Diffstat (limited to 'telegram_bot.go')
-rw-r--r--telegram_bot.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/telegram_bot.go b/telegram_bot.go
index e8ae294..cf023ab 100644
--- a/telegram_bot.go
+++ b/telegram_bot.go
@@ -18,6 +18,7 @@ const (
commandBantuan = "bantuan"
commandDefinisi = "definisi"
+ commandStart = "start"
)
//
@@ -38,8 +39,8 @@ func NewTelegramBot(token, webhookURL string) (tgbot *TelegramBot, err error) {
var commands = []bot.Command{{
Command: commandDefinisi,
- Description: "Cari definisi dari satu atau lebih kata." +
- " Pisahkan antara kata dengan koma.",
+ Description: `Cari definisi dari kata.` +
+ ` Contoh: "/definisi kamus,bahasa"`,
Handler: tgbot.handleCommandDefinisi,
}}
@@ -72,7 +73,15 @@ func (tgbot *TelegramBot) handleUpdate(update bot.Update) {
if update.Message == nil {
return
}
- fmt.Printf("update.Message: %+v\n", update.Message)
+
+ msg := update.Message
+
+ if len(msg.Command) != 0 {
+ text := fmt.Sprintf(`Perintah tidak dikenal %q. Contoh: "/definisi kamus,bahasa"`,
+ msg.Command)
+
+ tgbot.sendError(update.Message, "", text)
+ }
}
//