aboutsummaryrefslogtreecommitdiff
path: root/cmd/bot-kbbi/main.go
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2020-04-11 04:00:59 +0700
committerShulhan <m.shulhan@gmail.com>2020-04-11 04:00:59 +0700
commitd044fe5904d4a5301ad32b85cb5a61cf6326ea57 (patch)
treeab8fd059533ec93ce304007fcc3b5565c9d95d5c /cmd/bot-kbbi/main.go
parent1fb4ed2592fa4f077184a9ca52a0af738f4fbaf9 (diff)
downloadkamusku-d044fe5904d4a5301ad32b85cb5a61cf6326ea57.tar.xz
all: implementasi bot untuk Telegram
Diffstat (limited to 'cmd/bot-kbbi/main.go')
-rw-r--r--cmd/bot-kbbi/main.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/cmd/bot-kbbi/main.go b/cmd/bot-kbbi/main.go
new file mode 100644
index 0000000..66b2edf
--- /dev/null
+++ b/cmd/bot-kbbi/main.go
@@ -0,0 +1,35 @@
+// Copyright 2020, Shulhan <m.shulhan@gmail.com>. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+ "log"
+ "os"
+ "os/signal"
+
+ "github.com/shuLhan/kbbi"
+)
+
+func main() {
+ log.SetFlags(0)
+
+ // Use the token and Webhook URL from environment variables.
+ tgbot, err := kbbi.NewTelegramBot("", "")
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ go func() {
+ err := tgbot.Start()
+ if err != nil {
+ log.Println(err)
+ }
+ }()
+ defer tgbot.Stop()
+
+ c := make(chan os.Signal, 1)
+ signal.Notify(c, os.Interrupt)
+ <-c
+}