2018-07-23 16:59:39 +02:00
|
|
|
/*
|
|
|
|
* @Author: Bartuccio Antoine
|
|
|
|
* @Date: 2018-07-23 15:24:22
|
|
|
|
* @Last Modified by: klmp200
|
2018-07-23 17:26:15 +02:00
|
|
|
* @Last Modified time: 2018-07-23 17:25:09
|
2018-07-23 16:59:39 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"./settings"
|
|
|
|
tb "gopkg.in/tucnak/telebot.v2"
|
|
|
|
"log"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
settings.LoadSettings("settings.json", "settings_custom.json")
|
|
|
|
|
|
|
|
log.Println("Bot initialisation")
|
|
|
|
b, err := tb.NewBot(tb.Settings{
|
|
|
|
Token: settings.Settings["token"].(string),
|
|
|
|
Poller: &tb.LongPoller{Timeout: 10 * time.Second},
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
b.Handle("/hello", func(m *tb.Message) {
|
2018-07-23 17:26:15 +02:00
|
|
|
b.Send(m.Chat, "Bonjour "+m.Sender.Username)
|
2018-07-23 16:59:39 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
log.Println("Starting bot")
|
|
|
|
b.Start()
|
|
|
|
}
|