aboutsummaryrefslogtreecommitdiff
path: root/telegram_bot.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-04-06 17:44:13 +0700
committerShulhan <ms@kilabit.info>2024-04-06 17:44:13 +0700
commit3245b00f0246f7f2f0afd8635cfd3ff9bf2cf584 (patch)
tree286817224a5d72569e4db335578b3549f566deda /telegram_bot.go
parent6c7bfd42bc1128f5969e9e40b23d6b828601f7cb (diff)
downloadkamusku-3245b00f0246f7f2f0afd8635cfd3ff9bf2cf584.tar.xz
all: replace "share" module with "pakakeh.go"
The "share" module has been moved to new forge, SourceHut, with new name "pakakeh.go".
Diffstat (limited to 'telegram_bot.go')
-rw-r--r--telegram_bot.go16
1 files changed, 3 insertions, 13 deletions
diff --git a/telegram_bot.go b/telegram_bot.go
index 3892ece..0d83fa2 100644
--- a/telegram_bot.go
+++ b/telegram_bot.go
@@ -12,7 +12,7 @@ import (
"strings"
"git.sr.ht/~shulhan/kamusku"
- "github.com/shuLhan/share/api/telegram/bot"
+ "git.sr.ht/~shulhan/pakakeh.go/api/telegram/bot"
)
const (
@@ -22,17 +22,13 @@ const (
commandStart = "start"
)
-//
// TelegramBot implement Telegram Bot for KBBI.
-//
type TelegramBot struct {
*bot.Bot
apiClient *apiClient
}
-//
// NewTelegramBot create and initialize new Telegram Bot.
-//
func NewTelegramBot(token, webhookURL string) (tgbot *TelegramBot, err error) {
tgbot = &TelegramBot{
apiClient: newAPIClient(""),
@@ -77,9 +73,7 @@ func NewTelegramBot(token, webhookURL string) (tgbot *TelegramBot, err error) {
return tgbot, nil
}
-//
// handleUpdate process the Update information send by Telegram server.
-//
func (tgbot *TelegramBot) handleUpdate(update bot.Update) {
if update.Message == nil {
return
@@ -94,9 +88,7 @@ func (tgbot *TelegramBot) handleUpdate(update bot.Update) {
}
}
-//
// handleCommandDefinisi lookup the words definition and reply back to client.
-//
func (tgbot *TelegramBot) handleCommandDefinisi(update bot.Update) {
msgReq := update.Message
@@ -126,11 +118,9 @@ func (tgbot *TelegramBot) handleCommandDefinisi(update bot.Update) {
}
}
-//
// handleCommandStart handle the "/start" command by welcoming the user.
-//
func (tgbot *TelegramBot) handleCommandStart(update bot.Update) {
- //nolint: lll
+ //nolint:lll
text := `Selamat datang <b>` + update.Message.From.FirstName + `</b>,
Untuk mencari definisi kata ketikan perintah <code>/definisi</code> diikuti dengan spasi dan kata yang ingin dicari. Pisahkan kata dengan koma untuk mencari lebih dari satu kata.
@@ -151,7 +141,7 @@ func (tgbot *TelegramBot) sendError(msg *bot.Message, parseMode, errMsg string)
}
}
-//nolint: unused
+//nolint:unused
func (tgbot *TelegramBot) sendShutdownNotice(msg *bot.Message) {
text := `Mohon maaf, KamuskuBot untuk sementara berhenti beroperasi dulu karena masalah legalitas.